Interface HttpMetaData

All Superinterfaces:
ContextMapHolder
All Known Subinterfaces:
BlockingStreamingHttpRequest, BlockingStreamingHttpResponse, BlockingStreamingHttpServerResponse, HttpRequest, HttpRequestMetaData, HttpResponse, HttpResponseMetaData, StreamingHttpRequest, StreamingHttpResponse

public interface HttpMetaData extends ContextMapHolder
Meta data shared between requests and responses.
  • Method Details

    • version

      Returns the protocol version of this HttpMetaData.
      Returns:
      the version.
    • version

      Set the protocol version of this HttpMetaData.
      Parameters:
      version - the protocol version to set.
      Returns:
      this.
    • headers

      HttpHeaders headers()
      Returns the headers of this message.
      Returns:
      the headers.
    • encoding

      @Deprecated default HttpMetaData encoding(ContentCodec encoding)
      Deprecated.
      Use HttpRequestMetaData.contentEncoding(BufferEncoder) for requests and ContentEncodingHttpServiceFilter for responses. An example can be found here.
      The ContentCodec used to encode the payload of a request or a response. If the endpoint is setup with ContentCodingHttpServiceFilter, the server will auto-establish the accepted encoding for the response, unless the caller provides a specific encoding by calling this method. Any encoding passed here, takes precedence. In other words, a compressed response, can be disabled by passing Identity.identity().
      Parameters:
      encoding - The ContentCodec used for the encoding of the payload.
      Returns:
      this.
      See Also:
    • encoding

      @Deprecated @Nullable default ContentCodec encoding()
      Deprecated.
      Use HttpRequestMetaData.contentEncoding() for requests and ContentEncodingHttpServiceFilter for responses. An example can be found here.
      Returns the ContentCodec used to encode the payload of a request or a response.
      Returns:
      The ContentCodec used for the encoding of the payload.
      See Also:
    • addHeader

      default HttpMetaData addHeader(CharSequence name, CharSequence value)
      Adds a new header with the specified name and value.
      Parameters:
      name - the name of the header.
      value - the value of the header.
      Returns:
      this.
    • addHeaders

      default HttpMetaData addHeaders(HttpHeaders headers)
      Adds all header names and values of headers object.
      Parameters:
      headers - the headers to add.
      Returns:
      this.
    • setHeader

      default HttpMetaData setHeader(CharSequence name, CharSequence value)
      Sets a header with the specified name and value. Any existing headers with the same name are overwritten.
      Parameters:
      name - the name of the header.
      value - the value of the header.
      Returns:
      this.
    • setHeaders

      default HttpMetaData setHeaders(HttpHeaders headers)
      Clears the current header entries and copies all header entries of the specified headers object.
      Parameters:
      headers - the headers object which contains new values.
      Returns:
      this.
    • addCookie

      default HttpMetaData addCookie(HttpCookiePair cookie)
      Adds a cookie.

      This may result in multiple HttpCookiePairs with same name.

      Parameters:
      cookie - the cookie to add.
      Returns:
      this.
    • addCookie

      default HttpMetaData addCookie(CharSequence name, CharSequence value)
      Adds a cookie with the specified name and value.

      This may result in multiple HttpSetCookies with same name. Added cookie will not be wrapped, not secure, and not HTTP-only, with no path, domain, expire date and maximum age.

      Parameters:
      name - the name of the cookie.
      value - the value of the cookie.
      Returns:
      this.
    • addSetCookie

      default HttpMetaData addSetCookie(HttpSetCookie cookie)
      Adds a set-cookie.

      This may result in multiple HttpSetCookies with same name.

      Parameters:
      cookie - the cookie to add.
      Returns:
      this.
    • addSetCookie

      default HttpMetaData addSetCookie(CharSequence name, CharSequence value)
      Adds a set-cookie with the specified name and value.

      This may result in multiple HttpSetCookies with same name. Added cookie will not be wrapped, not secure, and not HTTP-only, with no path, domain, expire date and maximum age.

      Parameters:
      name - the name of the cookie.
      value - the value of the cookie.
      Returns:
      this.
    • toString

      String toString()
      Returns a string representation of the message. To avoid accidentally logging sensitive information, implementations should not return any header or content.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the message
    • toString

      default String toString(BiFunction<? super CharSequence,? super CharSequence,CharSequence> headerFilter)
      Returns a string representation of the message and headers.
      Parameters:
      headerFilter - a function that accepts the header name and value and returns the filtered value
      Returns:
      string representation of the message and headers
    • context

      @Nonnull ContextMap context()
      A context associated with this HttpMetaData.

      Context can be used to associate a state with a request or response message without serializing its state on the wire.

      Specified by:
      context in interface ContextMapHolder
      Returns:
      a context associated with this HttpMetaData.
    • context

      HttpMetaData context(ContextMap context)
      Sets a context for this HttpMetaData.

      Context can be used to associate a state with a request or response message without serializing its state on the wire.

      Specified by:
      context in interface ContextMapHolder
      Parameters:
      context - the new context for this HttpMetaData.
      Returns:
      this.