com.crabshue.commons.http.client.HttpRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-http-client Show documentation
Show all versions of commons-http-client Show documentation
Library for HTTP client operations.
The newest version!
package com.crabshue.commons.http.client;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.core.Cookie;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
import lombok.Data;
/**
* Definition for an HTTP request. Executed by {@link HttpClient}.
*/
@Data
public class HttpRequest {
private String httpMethod;
private String requestBaseUrl;
private String resourcePath;
private MediaType mediaType = MediaType.WILDCARD_TYPE;
private Object entity;
private MediaType entityMediaType;
private MultivaluedMap headers = new MultivaluedHashMap<>();
private Collection cookies = new ArrayList<>();
private Map queryParameters = new HashMap<>();
public HttpRequest get() {
return this.setHttpMethod(HttpMethod.GET);
}
public HttpRequest post() {
return this.setHttpMethod(HttpMethod.POST);
}
public HttpRequest delete() {
return this.setHttpMethod(HttpMethod.DELETE);
}
public HttpRequest put() {
return this.setHttpMethod(HttpMethod.PUT);
}
public HttpRequest head() {
return this.setHttpMethod(HttpMethod.HEAD);
}
public Optional
© 2015 - 2025 Weber Informatics LLC | Privacy Policy