Class Location

All Implemented Interfaces:
Serializable, Cloneable, Header, NameValuePair

@Header("Location") public class Location extends BasicUriHeader
Represents a parsed Location HTTP response header.

Used in redirection, or when a new resource has been created.

Example

Location: http://www.w3.org/pub/WWW/People.html

RFC2616 Specification
The Location response-header field is used to redirect the recipient to a location other than the Request-URI for completion of the request or identification of a new resource. For 201 (Created) responses, the Location is that of the new resource which was created by the request. For 3xx responses, the location SHOULD indicate the server's preferred URI for automatic redirection to the resource. The field value consists of a single absolute URI.

Location = "Location" ":" absoluteURI

An example is:

Location: http://www.w3.org/pub/WWW/People.html

Note: The Content-Location header field (section 14.14) differs from Location in that the Content-Location identifies the original location of the entity enclosed in the request. It is therefore possible for a response to contain header fields for both Location and Content-Location. Also see section 13.10 for cache requirements of some methods.

See Also:
  • Constructor Details

    • Location

      public Location(String value)
      Constructor.
      Parameters:
      value - The header value.
      Must be parsable by URI.create(String).
      Can be null.
    • Location

      public Location(URI value)
      Constructor.
      Parameters:
      value - The header value.
      Can be null.
    • Location

      public Location(Supplier<URI> value)
      Constructor with delayed value.

      Header value is re-evaluated on each call to BasicUriHeader.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
  • Method Details

    • of

      public static Location of(String value)
      Static creator.
      Parameters:
      value - The header value.
      Must be parsable by URI.create(String).
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • of

      public static Location of(URI value)
      Static creator.
      Parameters:
      value - The header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.
    • of

      public static Location of(Supplier<URI> value)
      Static creator with delayed value.

      Header value is re-evaluated on each call to BasicUriHeader.getValue().

      Parameters:
      value - The supplier of the header value.
      Can be null.
      Returns:
      A new header bean, or null if the value is null.