Class RequestContext


  • public class RequestContext
    extends Object
    Context containing all important info about a request.
    • Constructor Detail

      • RequestContext

        public RequestContext​(HttpHeaders headers,
                              URI uri,
                              HttpClient.Method method,
                              Object body)
        Construct a request context.
        Parameters:
        headers - map of all headers
        uri - uri of the request
        method - verb to be used
        body - optional body of request
    • Method Detail

      • putHeader

        public void putHeader​(String name,
                              String value)
      • containsHeader

        public boolean containsHeader​(String name)
      • removeHeader

        public void removeHeader​(String name)
      • getUri

        public URI getUri()
      • addResponseCallback

        public void addResponseCallback​(BiConsumer<ResponseContext,​Exception> responseCallback)
        Adds a callback to be called when the request has finished. The responseCallback consumer is called with a non-null ResponseContext, if the HTTP request technically succeeded. The The responseCallback consumer is called with a non-null Exception object, if the HTTP request technically failed.
        Parameters:
        responseCallback - callback that receives either a non-null ResponseContext or a non-null Exception.