public final class HttpRequest extends Object
| Modifier and Type | Method and Description |
|---|---|
HttpRequest |
basicAuth(String user,
Object password) |
HttpRequest |
connectionTimeout(int connectionTimeout) |
static HttpRequest |
create(HttpClient httpClient) |
String |
delete() |
<T> T |
delete(Class<T> resultClass) |
<T> T |
delete(Class<T> resultClass,
Object query) |
String |
delete(Object query) |
<T> T |
execute(Class<T> resultClass,
HttpMethod httpMethod) |
<T> T |
execute(Class<T> resultClass,
HttpMethod httpMethod,
Object body) |
void |
execute(File output,
HttpMethod httpMethod,
Object body) |
String |
execute(HttpMethod httpMethod) |
String |
execute(HttpMethod httpMethod,
Object body) |
void |
execute(OutputStream output,
HttpMethod httpMethod,
Object body) |
void |
execute(Writer output,
HttpMethod httpMethod,
Object body) |
String |
get() |
<T> T |
get(Class<T> resultClass) |
<T> T |
get(Class<T> resultClass,
Object query) |
String |
get(Object query) |
HttpRequest |
header(String name,
Object value)
Set http header specified by
name/value. |
HttpRequest |
headers(HttpHeaders headers)
Removes all headers on this
HttpSettings and adds headers. |
HttpRequest |
headers(Map<String,?> headers)
Set http headers specified by the key/value entities from
Map. |
HttpRequest |
headers(String name1,
Object value1,
String name2,
Object value2)
Set http headers specified by
name1/value1, name2/value2. |
HttpRequest |
headers(String name1,
Object value1,
String name2,
Object value2,
String name3,
Object value3)
Set http headers specified by
name1/value1, name2/value2, name3/value3. |
<T> T |
post(Class<T> resultClass,
Object body) |
String |
post(Object body) |
<T> T |
put(Class<T> resultClass,
Object body) |
String |
put(Object body) |
HttpRequest |
readTimeout(int readTimeout) |
static HttpRequest |
url(String url) |
static HttpRequest |
url(String url,
long connectionTimeoutInMillis,
long readTimeoutInMillis) |
HttpRequest |
useCaches(boolean useCaches) |
public static HttpRequest create(HttpClient httpClient)
httpClient - public static HttpRequest url(String url)
url - public static HttpRequest url(String url, long connectionTimeoutInMillis, long readTimeoutInMillis)
url - connectionTimeoutInMillis - readTimeoutInMillis - public HttpRequest basicAuth(String user, Object password)
user - password - public HttpRequest header(String name, Object value)
name/value.
If this HttpSettings already has any headers with that name, they are all replaced.name - value - HttpSettings.header(String, Object)public HttpRequest headers(String name1, Object value1, String name2, Object value2)
name1/value1, name2/value2.
If this HttpSettings already has any headers with that name, they are all replaced.name1 - value1 - name2 - value2 - HttpSettings.headers(String, Object, String, Object)public HttpRequest headers(String name1, Object value1, String name2, Object value2, String name3, Object value3)
name1/value1, name2/value2, name3/value3.
If this HttpSettings already has any headers with that name, they are all replaced.name1 - value1 - name2 - value2 - name3 - value3 - HttpSettings.headers(String, Object, String, Object, String, Object)public HttpRequest headers(Map<String,?> headers)
Map.
If this HttpSettings already has any headers with that name, they are all replaced.headers - HttpSettings.headers(Map)public HttpRequest headers(HttpHeaders headers)
HttpSettings and adds headers.headers - HttpSettings.headers(HttpHeaders)public String get() throws UncheckedIOException
UncheckedIOException - the unchecked IO exceptionpublic <T> T get(Class<T> resultClass) throws UncheckedIOException
T - resultClass - UncheckedIOException - the unchecked IO exceptionpublic <T> T get(Class<T> resultClass, Object query) throws UncheckedIOException
T - resultClass - query - UncheckedIOException - the unchecked IO exceptionpublic <T> T post(Class<T> resultClass, Object body) throws UncheckedIOException
T - resultClass - body - UncheckedIOException - the unchecked IO exceptionpublic String put(Object body) throws UncheckedIOException
body - UncheckedIOException - the unchecked IO exceptionpublic <T> T put(Class<T> resultClass, Object body) throws UncheckedIOException
T - resultClass - body - UncheckedIOException - the unchecked IO exceptionpublic String delete() throws UncheckedIOException
UncheckedIOException - the unchecked IO exceptionpublic <T> T delete(Class<T> resultClass) throws UncheckedIOException
T - resultClass - UncheckedIOException - the unchecked IO exceptionpublic String delete(Object query) throws UncheckedIOException
query - UncheckedIOException - the unchecked IO exceptionpublic <T> T delete(Class<T> resultClass, Object query) throws UncheckedIOException
T - resultClass - query - UncheckedIOException - the unchecked IO exceptionpublic String execute(HttpMethod httpMethod) throws UncheckedIOException
httpMethod - UncheckedIOExceptionpublic <T> T execute(Class<T> resultClass, HttpMethod httpMethod) throws UncheckedIOException
T - resultClass - httpMethod - UncheckedIOException - the unchecked IO exceptionpublic String execute(HttpMethod httpMethod, Object body) throws UncheckedIOException
httpMethod - body - UncheckedIOExceptionpublic <T> T execute(Class<T> resultClass, HttpMethod httpMethod, Object body) throws UncheckedIOException
T - resultClass - httpMethod - body - UncheckedIOException - the unchecked IO exceptionpublic void execute(File output, HttpMethod httpMethod, Object body) throws UncheckedIOException
UncheckedIOExceptionpublic void execute(OutputStream output, HttpMethod httpMethod, Object body) throws UncheckedIOException
UncheckedIOExceptionpublic void execute(Writer output, HttpMethod httpMethod, Object body) throws UncheckedIOException
UncheckedIOExceptionpublic HttpRequest connectionTimeout(int connectionTimeout)
public HttpRequest readTimeout(int readTimeout)
public HttpRequest useCaches(boolean useCaches)
Copyright © 2021. All rights reserved.