public class Unirest extends Object
Constructor and Description |
---|
Unirest() |
Modifier and Type | Method and Description |
---|---|
static void |
clearDefaultHeaders()
Clear default headers
|
static HttpRequestWithBody |
delete(String url) |
static GetRequest |
get(String url) |
static GetRequest |
head(String url) |
static boolean |
isRunning() |
static JsonPatchRequest |
jsonPatch(String url) |
static HttpRequestWithBody |
options(String url) |
static HttpRequestWithBody |
patch(String url) |
static HttpRequestWithBody |
post(String url) |
static HttpRequestWithBody |
put(String url) |
static void |
setAsyncHttpClient(org.apache.http.impl.nio.client.CloseableHttpAsyncClient asyncHttpClient)
Set the asynchronous AbstractHttpAsyncClient implementation to use for every asynchronous request
|
static void |
setConcurrency(int maxTotal,
int maxPerRoute)
Set the concurrency levels
|
static void |
setDefaultHeader(String name,
String value)
Set default header to appear on all requests
|
static void |
setHttpClient(org.apache.http.client.HttpClient httpClient)
Set the HttpClient implementation to use for every synchronous request
|
static void |
setObjectMapper(ObjectMapper objectMapper)
Set the ObjectMapper implementation to use for Response to Object binding
|
static void |
setProxy(org.apache.http.HttpHost proxy)
Set a proxy
|
static void |
setTimeouts(int connectionTimeout,
int socketTimeout)
Set the connection timeout and socket timeout
|
static void |
shutdown()
Close the asynchronous client and its event loop.
|
static void |
shutdown(boolean clearOptions)
Close the asynchronous client and its event loop.
|
public static void setHttpClient(org.apache.http.client.HttpClient httpClient)
httpClient
- Custom httpClient implementationpublic static void setAsyncHttpClient(org.apache.http.impl.nio.client.CloseableHttpAsyncClient asyncHttpClient)
asyncHttpClient
- Custom CloseableHttpAsyncClient implementationpublic static void setProxy(org.apache.http.HttpHost proxy)
proxy
- Proxy settings object.public static void setObjectMapper(ObjectMapper objectMapper)
objectMapper
- Custom implementation of ObjectMapper interfacepublic static void setTimeouts(int connectionTimeout, int socketTimeout)
connectionTimeout
- The timeout until a connection with the server is established (in milliseconds). Default is 10000. Set to zero to disable the timeout.socketTimeout
- The timeout to receive data (in milliseconds). Default is 60000. Set to zero to disable the timeout.public static void setConcurrency(int maxTotal, int maxPerRoute)
maxTotal
- Defines the overall connection limit for a connection pool. Default is 200.maxPerRoute
- Defines a connection limit per one HTTP route (this can be considered a per target host limit). Default is 20.public static void clearDefaultHeaders()
public static void setDefaultHeader(String name, String value)
name
- The name of the header.value
- The value of the header.public static void shutdown()
public static void shutdown(boolean clearOptions)
clearOptions
- indicates if options should be cleared. Note that the HttpClient, AsyncClient and thread monitors will not be retained after shutdown.public static GetRequest get(String url)
public static GetRequest head(String url)
public static HttpRequestWithBody options(String url)
public static HttpRequestWithBody post(String url)
public static HttpRequestWithBody delete(String url)
public static HttpRequestWithBody patch(String url)
public static HttpRequestWithBody put(String url)
public static JsonPatchRequest jsonPatch(String url)
public static boolean isRunning()
Copyright © 2018. All rights reserved.