Package kong.unirest.core
Class Unirest
java.lang.Object
kong.unirest.core.Unirest
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Config
config()
Access the default configuration for the primary Unirest instance.static HttpRequestWithBody
Start a DELETE HttpRequest which supports a body from the primary configstatic GetRequest
Start a GET HttpRequest which does not support a body from the primary configstatic GetRequest
Start a HEAD HttpRequest which does not support a body from the primary configstatic JsonPatchRequest
Start a PATCH HttpRequest which supports a JSON Patch builder.static GetRequest
Start a OPTIONS HttpRequest which does not support a body from the primary configstatic HttpRequestWithBody
Start a PATCH HttpRequest which supports a body from the primary configstatic HttpRequestWithBody
Start a POST HttpRequest which supports a body from the primary configstatic UnirestInstance
return the primary UnirestInstance.static HttpRequestWithBody
Start a PUT HttpRequest which supports a body from the primary configstatic HttpRequestWithBody
static void
shutDown()
Close the asynchronous client and its event loop.static void
shutDown
(boolean clearOptions) Close the asynchronous client and its event loop.static UnirestInstance
Spawn a new Unirest Instance with a new config.static WebSocketRequest
-
Field Details
-
-
Constructor Details
-
Unirest
public Unirest()
-
-
Method Details
-
config
Access the default configuration for the primary Unirest instance.- Returns:
- the config object of the primary instance
-
shutDown
public static void shutDown()Close the asynchronous client and its event loop. Use this method to close all the threads and allow an application to exit. This will also clear any options returning Unirest to a default state -
shutDown
public static void shutDown(boolean clearOptions) Close the asynchronous client and its event loop. Use this method to close all the threads and allow an application to exit.- Parameters:
clearOptions
- indicates if options should be cleared. Note that the HttpClient, AsyncClient and thread monitors will not be retained after shutDown.
-
get
Start a GET HttpRequest which does not support a body from the primary config- Parameters:
url
- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
head
Start a HEAD HttpRequest which does not support a body from the primary config- Parameters:
url
- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
options
Start a OPTIONS HttpRequest which does not support a body from the primary config- Parameters:
url
- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
post
Start a POST HttpRequest which supports a body from the primary config- Parameters:
url
- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
delete
Start a DELETE HttpRequest which supports a body from the primary config- Parameters:
url
- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
patch
Start a PATCH HttpRequest which supports a body from the primary config- Parameters:
url
- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
put
Start a PUT HttpRequest which supports a body from the primary config- Parameters:
url
- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
jsonPatch
Start a PATCH HttpRequest which supports a JSON Patch builder. this supports RFC-6902 https://tools.ietf.org/html/rfc6902- Parameters:
url
- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
request
-
webSocket
-
spawnInstance
Spawn a new Unirest Instance with a new config. Don't forget to shut it down when your done. It will not be tracked and shutdown with Unirest.shutDown()- Returns:
- a new UnirestInstance
-
primaryInstance
return the primary UnirestInstance.- Returns:
- a new UnirestInstance
-