Package org.projectnessie.client.http
Class RequestContext
- java.lang.Object
-
- org.projectnessie.client.http.RequestContext
-
public class RequestContext extends Object
Context containing all important info about a request.
-
-
Constructor Summary
Constructors Constructor Description RequestContext(HttpHeaders headers, URI uri, HttpClient.Method method, Object body)Construct a request context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddResponseCallback(BiConsumer<ResponseContext,Exception> responseCallback)Adds a callback to be called when the request has finished.booleancontainsHeader(String name)Optional<Object>getBody()HttpClient.MethodgetMethod()URIgetUri()voidputHeader(String name, String value)voidremoveHeader(String name)
-
-
-
Constructor Detail
-
RequestContext
public RequestContext(HttpHeaders headers, URI uri, HttpClient.Method method, Object body)
Construct a request context.- Parameters:
headers- map of all headersuri- uri of the requestmethod- verb to be usedbody- optional body of request
-
-
Method Detail
-
containsHeader
public boolean containsHeader(String name)
-
removeHeader
public void removeHeader(String name)
-
getUri
public URI getUri()
-
getMethod
public HttpClient.Method getMethod()
-
addResponseCallback
public void addResponseCallback(BiConsumer<ResponseContext,Exception> responseCallback)
Adds a callback to be called when the request has finished. TheresponseCallbackconsumeris called with a non-nullResponseContext, if the HTTP request technically succeeded. The TheresponseCallbackconsumeris called with a non-nullExceptionobject, if the HTTP request technically failed.- Parameters:
responseCallback- callback that receives either a non-nullResponseContextor a non-nullException.
-
-