public interface RequestHeaders extends Headers
Parameters interface by adding HTTP request headers oriented convenient methods.
Use constants located in Http.Header as standard header names.Http.Header| Modifier and Type | Method and Description |
|---|---|
java.util.Optional<java.time.ZonedDateTime> |
acceptDatetime()
Optionally returns acceptedTypes version in time ("Accept-Datetime" header).
|
java.util.List<MediaType> |
acceptedTypes()
Returns a list of acceptedTypes ("Accept" header) content types in quality
factor order.
|
java.util.Optional<MediaType> |
bestAccepted(MediaType... mediaTypes)
Optionally returns single media type from provided parameters which is best accepted by the client.
|
java.util.OptionalLong |
contentLength()
Optionally returns the length of the request body in octets (8-bit bytes).
|
java.util.Optional<MediaType> |
contentType()
Optionally returns the MIME type of the body of the request.
|
Parameters |
cookies()
Returns cookies (parsed from '
Cookie:' header) based on RFC6265. |
java.util.Optional<java.time.ZonedDateTime> |
date()
Optionally returns request date ("Accept-Datetime" header).
|
java.util.Optional<java.time.ZonedDateTime> |
ifModifiedSince()
Optionally returns a value of "If-Modified-Since" header.
|
java.util.Optional<java.time.ZonedDateTime> |
ifUnmodifiedSince()
Optionally returns a value of "If-Unmodified-Since" header.
|
boolean |
isAccepted(MediaType mediaType)
Test if provided type is acceptable as a response for this request.
|
java.util.Optional<java.net.URI> |
referer()
Optionally returns the address of the previous web page (header "Referer") from which a link
to the currently requested page was followed.
|
add, add, addAll, computeIfAbsent, computeSingleIfAbsent, first, put, put, putAll, putIfAbsent, putIfAbsent, remove, toMap, toUnmodifiableParametersjava.util.Optional<MediaType> contentType()
java.util.OptionalLong contentLength()
Parameters cookies()
Cookie:' header) based on RFC6265.
It parse also older formats including RFC2965 but skips parameters. Only cookie name and value is returned.
Multiple cookies can be returned in a single headers and a single cookie-name can have multiple values. Note that base on RFC6265 an order of cookie values has no semantics.
Parameters interface where key is a name of the cookie and
values are cookie values.java.util.List<MediaType> acceptedTypes()
null.boolean isAccepted(MediaType mediaType)
mediaType - a media type to test if it is acceptable.true if provided type is acceptable.java.lang.NullPointerException - if parameter mediaType is null.java.util.Optional<MediaType> bestAccepted(MediaType... mediaTypes)
mediaTypes - Supported media type candidates.java.util.Optional<java.time.ZonedDateTime> acceptDatetime()
java.util.Optional<java.time.ZonedDateTime> date()
java.util.Optional<java.time.ZonedDateTime> ifModifiedSince()
Allows a 304 Not Modified to be returned if content is unchanged.
java.util.Optional<java.time.ZonedDateTime> ifUnmodifiedSince()
Only send the response if the entity has not been modified since a specific time.
java.util.Optional<java.net.URI> referer()
The word referrer has been misspelled in the RFC as well as in most implementations to the point that it
has become standard usage and is considered correct terminology
Copyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.