public class Unirest
extends Object
Constructor Summary
Constructors
Method Summary
All Methods Static Methods Concrete Methods
Access the default configuration for the primary Unirest instance.
Start a DELETE HttpRequest which supports a body from the primary config
Start a GET HttpRequest which does not support a body from the primary config
Start a HEAD HttpRequest which does not support a body from the primary config
Start a PATCH HttpRequest which supports a JSON Patch builder.
Start a OPTIONS HttpRequest which does not support a body from the primary config
Start a PATCH HttpRequest which supports a body from the primary config
Start a POST HttpRequest which supports a body from the primary config
return the primary UnirestInstance.
Start a PUT HttpRequest which supports a body from the primary config
static void
Close the asynchronous client and its event loop.
static void
Close the asynchronous client and its event loop.
Spawn a new Unirest Instance with a new config.
Methods inherited from class java.lang.Object
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
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
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