- All Known Subinterfaces:
ClientRequestHeaders
HTTP headers of a server request.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HeaderHeader value of the non compliantAcceptheader sent byHttpURLConnectionwhen none is set.static final List<HttpMediaType> Accepted types forHUC_ACCEPT_DEFAULT. -
Method Summary
Modifier and TypeMethodDescriptiondefault Optional<ZonedDateTime> Optionally returns acceptedTypes version in time (HeaderNames.ACCEPT_DATETIMEheader).bestAccepted(MediaType... mediaTypes) Optionally returns a single media type from the given media types that is the best one accepted by the client.default Parameterscookies()Returns cookies (parsed from 'Cookie:' header) based on RFC6265.static ServerRequestHeaderscreate()Create new empty server request headers.static ServerRequestHeadersCreate a new instance from headers.default Optional<ZonedDateTime> date()Optionally returns request date (HeaderNames.DATEheader).default Optional<ZonedDateTime> Optionally returns a value ofHeaderNames.IF_MODIFIED_SINCEheader.default Optional<ZonedDateTime> Optionally returns a value ofHeaderNames.IF_UNMODIFIED_SINCEheader.default booleanisAccepted(MediaType mediaType) Test if the given media type is acceptable as a response for this request.referer()Optionally returns the address of the previous web page (headerHeaderNames.REFERER) from which a link to the currently requested page was followed.Methods inherited from interface io.helidon.http.Headers
acceptedTypes, all, contains, contains, contentLength, contentType, first, get, size, stream, toMap, value, valuesMethods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Field Details
-
HUC_ACCEPT_DEFAULT
Header value of the non compliantAcceptheader sent byHttpURLConnectionwhen none is set.- See Also:
-
HUC_ACCEPT_DEFAULT_TYPES
Accepted types forHUC_ACCEPT_DEFAULT.
-
-
Method Details
-
create
Create a new instance from headers.- Parameters:
headers- headers parsed from server request- Returns:
- immutable instance of request headers
-
create
Create new empty server request headers.- Returns:
- empty headers
-
ifModifiedSince
Optionally returns a value ofHeaderNames.IF_MODIFIED_SINCEheader.Allows a 304 Not Modified to be returned if content is unchanged.
- Returns:
- Content of
HeaderNames.IF_MODIFIED_SINCEheader.
-
ifUnmodifiedSince
Optionally returns a value ofHeaderNames.IF_UNMODIFIED_SINCEheader.Only send the response if the entity has not been modified since a specific time.
- Returns:
- Content of
HeaderNames.IF_UNMODIFIED_SINCEheader.
-
isAccepted
Test if the given media type is acceptable as a response for this request. A media type is accepted if theAcceptheader is not present in the request or if it contains the provided media type.- Specified by:
isAcceptedin interfaceHeaders- Parameters:
mediaType- the media type to test- Returns:
trueif provided type is acceptable,falseotherwise- Throws:
NullPointerException- if the provided type isnull.
-
bestAccepted
Optionally returns a single media type from the given media types that is the best one accepted by the client. Method uses content negotiationHeaderNames.ACCEPTheader parameter and returns an empty value in case nothing matches.- Parameters:
mediaTypes- media type candidates, never null- Returns:
- an accepted media type.
-
cookies
Returns cookies (parsed from 'Cookie:' header) based on RFC6265. It parses also older formats including RFC2965 but skips parameters. Only cookienameandvalueis 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.
- Returns:
- An unmodifiable cookies represented by
Parametersinterface where key is a name of the cookie and values are cookie values.
-
acceptDatetime
Optionally returns acceptedTypes version in time (HeaderNames.ACCEPT_DATETIMEheader).- Returns:
- Acceptable version in time.
-
date
Optionally returns request date (HeaderNames.DATEheader).- Returns:
- Request date.
-
referer
Optionally returns the address of the previous web page (headerHeaderNames.REFERER) from which a link to the currently requested page was followed.The word
referrerhas 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- Returns:
- Referrers URI
-