Class ResponseMetadata


  • public final class ResponseMetadata
    extends Object
    Immutable HTTP response metadata captured before the connection is closed.
    Author:
    Luca Frosini (ISTI - CNR)
    • Constructor Detail

      • ResponseMetadata

        public ResponseMetadata​(int statusCode,
                                Map<String,​List<String>> headers,
                                URI requestUri)
        Creates immutable response metadata.
        Parameters:
        statusCode - HTTP status code
        headers - response headers, preserving repeated values
        requestUri - effective request URI, or null when unavailable
    • Method Detail

      • statusCode

        public int statusCode()
        Returns:
        the HTTP status code
      • headers

        public Map<String,​List<String>> headers()
        Returns:
        the immutable case-insensitive multi-valued header map
      • headerValues

        public List<String> headerValues​(String name)
        Parameters:
        name - header name
        Returns:
        immutable values associated with the name
      • firstHeaderValue

        public Optional<String> firstHeaderValue​(String name)
        Parameters:
        name - header name
        Returns:
        the first value, when present
      • requestUri

        public Optional<URI> requestUri()
        Returns:
        the effective request URI, when available
      • links

        public List<String> links()
        Returns:
        all Link header field values
      • contentLocation

        public Optional<String> contentLocation()
        Returns:
        the Content-Location value, when present
      • preferenceApplied

        public Optional<String> preferenceApplied()
        Returns:
        the Preference-Applied value, when present
      • warnings

        public List<String> warnings()
        Returns:
        all X-Warning header field values
      • resultScopes

        public Set<ResultScope> resultScopes()
        Returns:
        recognized immutable X-Result-Scope values