Class RequestContextImpl

    • Constructor Detail

      • RequestContextImpl

        public RequestContextImpl​(HttpHeaders headers,
                                  java.net.URI uri,
                                  HttpClient.Method method,
                                  java.lang.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​(java.lang.String name,
                              java.lang.String value)
        Specified by:
        putHeader in interface RequestContext
      • getBody

        public java.util.Optional<java.lang.Object> getBody()
        Specified by:
        getBody in interface RequestContext
      • addResponseCallback

        public void addResponseCallback​(java.util.function.BiConsumer<ResponseContext,​java.lang.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 responseCallback consumer is called with a non-null Exception object, if the HTTP request technically failed.
        Specified by:
        addResponseCallback in interface RequestContext
        Parameters:
        responseCallback - callback that receives either a non-null ResponseContext or a non-null Exception.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object