Class HttpRequest


  • public class HttpRequest
    extends Object
    HttpRequest represents the data that will be used to create the actual request to the remote endpoint. It will be passed to different RequestInterceptor that can update its values. The body can be anything as the interceptor may change what the payload is. Also contains some convenience Strings for common HTTP header key and values and HTTP methods.
    • Method Detail

      • headers

        public Map<String,​String> headers()
        Get the headers of the request.
        Returns:
        a map of headers. This can be used to directly update the entries.
      • getBody

        public Object getBody()
        Get the body of the request.
        Returns:
        an Object representing the body.
      • getUri

        public URI getUri()
        Get the URI of the request.
        Returns:
        the request URI.
      • getMethod

        public String getMethod()
        Get the HTTP method of the request. The standard /gremlin endpoint only supports POST.
        Returns:
        the HTTP method.
      • setBody

        public HttpRequest setBody​(Object body)
        Set the HTTP body of the request. During processing, the body can be any type but the final interceptor must set the body to a byte[].
        Returns:
        this HttpRequest for method chaining.
      • setMethod

        public HttpRequest setMethod​(String method)
        Set the HTTP method of the request.
        Returns:
        this HttpRequest for method chaining.
      • setUri

        public HttpRequest setUri​(URI uri)
        Set the URI of the request.
        Returns:
        this HttpRequest for method chaining.