Interface ClientRequestHeaders
- All Superinterfaces:
Headers, Iterable<Header>, ServerRequestHeaders, WritableHeaders<ClientRequestHeaders>
public interface ClientRequestHeaders
extends ServerRequestHeaders, WritableHeaders<ClientRequestHeaders>
Mutable headers of a client request.
-
Field Summary
Fields inherited from interface ServerRequestHeaders
HUC_ACCEPT_DEFAULT, HUC_ACCEPT_DEFAULT_TYPESModifier and TypeFieldDescriptionstatic final HeaderHeader value of the non compliantAcceptheader sent byHttpURLConnectionwhen none is set.static final List<HttpMediaType> Accepted types forServerRequestHeaders.HUC_ACCEPT_DEFAULT. -
Method Summary
Modifier and TypeMethodDescriptiondefault ClientRequestHeadersAccepted media types.static ClientRequestHeadersCreate client request headers from headers.static ClientRequestHeaderscreate(WritableHeaders<?> delegate) Create client request headers from writable headers.Methods inherited from interface Headers
acceptedTypes, all, contains, contains, containsToken, contentLength, contentType, find, first, get, size, stream, toMap, value, valuesModifier and TypeMethodDescriptionReturns a list of acceptedTypes (HeaderNames.ACCEPTheader) content discoveryTypes in quality factor order.all(HeaderName name, Supplier<List<String>> defaultSupplier) Get all values of a header.booleanWhether these headers contain a header with the provided name and value.booleancontains(HeaderName name) Whether these headers contain a header with the provided name.default booleancontainsToken(Header value) Whether these headers contain all tokenized values from the provided header.default OptionalLongContent length if defined.default Optional<HttpMediaType> Content type (if defined).find(HeaderName headerName) Find the first header.first(HeaderName headerName) Returns a first header value.get(HeaderName name) Get a header value.intsize()Number of headers in these headers.stream()A sequential stream with these headers as the source.toMap()Deprecated.use other methods to handle headers, preferably using pull approachvalue(HeaderName headerName) Returns a header value as a singleStringpotentially concatenated using comma character fromHeaders.all(HeaderName, java.util.function.Supplier)header fields.values(HeaderName headerName) Returns an unmodifiableListof all comma separated header value parts - Such segmentation is NOT valid for all header semantics, however it is very common.Methods inherited from interface Iterable
forEach, iterator, spliteratorMethods inherited from interface ServerRequestHeaders
acceptDatetime, bestAccepted, cookies, date, ifModifiedSince, ifUnmodifiedSince, isAccepted, referer, testContentTypeModifier 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.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... mediaTypes) 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.default booleantestContentType(MediaType... mediaTypes) Check if the content type provided over the network matches one of the content types.Methods inherited from interface WritableHeaders
add, add, add, add, clear, contentLength, contentType, from, remove, remove, set, set, set, set, set, setIfAbsentModifier and TypeMethodDescriptionAdd a header or add a header value if the header is already present.default ClientRequestHeadersadd(HeaderName header, int value) Add a header or add a header value if the header is already present.default ClientRequestHeadersadd(HeaderName header, long value) Add a header or add a header value if the header is already present.default ClientRequestHeadersadd(HeaderName header, String... value) Add a header or add a header value if the header is already present.clear()Clear all current headers.default ClientRequestHeaderscontentLength(long length) Content length of the entity in bytes.default ClientRequestHeaderscontentType(MediaType contentType) Sets the MIME type of the response body.For each header from the provided headers, set its value on these headers.remove(HeaderName name) Remove a header.remove(HeaderName name, Consumer<Header> removedConsumer) Remove a header.Set a header and replace it if it already existed.default ClientRequestHeadersset(HeaderName name, int value) Set a header and replace it if it already existed.default ClientRequestHeadersset(HeaderName name, long value) Set a header and replace it if it already existed.default ClientRequestHeadersset(HeaderName name, String... values) Set a header and replace it if it already existed.default ClientRequestHeadersset(HeaderName name, Collection<String> values) Set a header and replace it if it already existed.setIfAbsent(Header header) Set a value of a header unless it is already present.
-
Method Details
-
create
Create client request headers from writable headers.- Parameters:
delegate- headers- Returns:
- client request headers
-
create
Create client request headers from headers.- Parameters:
headers- headers- Returns:
- client request headers
-
accept
Accepted media types. Supports quality factor and wildcards.- Parameters:
accepted- media types to accept- Returns:
- updated headers
-