public interface HeaderFields<C extends Cookie,T extends HeaderFields<C,T>> extends HttpFields<T>
HeaderFields
reflect the structure of a HTTP header and may be
used to represent a HTTP header.Modifier and Type | Method and Description |
---|---|
C |
addCookie(C aCookie)
Adds an individual server-side cookie to be sent to the client to this
ResponseHeaderFields instance. |
C |
addCookie(String aCookieName,
String aValue)
Adds an individual server-side cookie to be sent to the client to this
ResponseHeaderFields instance. |
default void |
addTo(HeaderField aHeaderField,
String aValue) |
default MediaType[] |
getAcceptTypes()
Gets the communication partner's expected (supported) kinds of content.
|
default HttpMethod[] |
getAllows()
Gets the HTTP methods allowed for the resource.
|
default MediaType |
getContentType()
Gets the
MediaType for the HTTP body. |
List<C> |
getCookie(String aCookieName)
Retrieves an individual cookie sent by the client stored in this
RequestHeaderFields instance. |
List<C> |
getCookies()
Retrieves an array of cookies sent by the client stored in this
RequestHeaderFields instance. |
default String |
getCorrelationId()
Gets the (interprocess) correlation ID.
|
default String |
getFirst(HeaderField aHeaderField) |
default String |
getHost()
Gets the originating host.
|
default String |
getUserAgent()
Gets the originating user agent.
|
default void |
set(HeaderField aHeaderField,
String aValue) |
default void |
setAcceptTypes(MediaType... aMediaTypes)
Tells the communication partner the expected (supported) kinds of
content.
|
default void |
setAllows(HttpMethod... aHttpMethods)
Sets the HTTP methods allowed for the resource.
|
default void |
setContentType(MediaType aMediaType)
Sets the
MediaType for the HTTP body. |
default void |
setCorrelationId(String aCorrelationId)
Sets the (interprocess) correlation ID.
|
default void |
setHost(String aHost)
Sets the originating host.
|
default void |
setUserAgent(String aUserAgent)
Sets the originating user agent.
|
default String[] |
toHttpCookies()
Creates a HTTP header field value from the herein stored
Cookie
instances. |
default T |
withAcceptTypes(MediaType... aMediaTypes)
Tells the communication partner the expected (supported) kinds of
content.
|
default HeaderFields<C,T> |
withAddCookie(C aCookie)
Builder method for the
addCookie(Cookie) method. |
default HeaderFields<C,T> |
withAddCookie(String aCookieName,
String aValue)
Builder method for the
addCookie(String, String) method. |
default HeaderFields<C,T> |
withAddTo(HeaderField aHeaderField,
String aValue) |
default T |
withAllows(HttpMethod... aHttpMethods)
Sets the HTTP methods allowed for the resource.
|
default T |
withContentType(MediaType aMediaType)
Sets the
MediaType for the HTTP body. |
default T |
withCorrelationId(String aCorrelationId)
Sets the (interprocess) correlation ID.
|
default T |
withHost(String aHost)
Sets the originating host.
|
default HeaderFields<C,T> |
withSet(HeaderField aHeaderField,
String aValue) |
default HeaderFields<C,T> |
withSet(String aHeaderField,
String aValue)
Builder method for the
HttpFields.set(String, String) method. |
default T |
withUserAgent(String aUserAgent)
Sets the originating user agent.
|
addTo, getFirst, set, withAddTo
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
default T withAllows(HttpMethod... aHttpMethods)
aHttpMethods
- The HTTP methods allowed for the resource.default void setAllows(HttpMethod... aHttpMethods)
aHttpMethods
- The HTTP methods allowed for the resource.default HttpMethod[] getAllows()
default T withContentType(MediaType aMediaType)
MediaType
for the HTTP body.aMediaType
- The media type expected by a client from a server.default void setContentType(MediaType aMediaType)
MediaType
for the HTTP body.aMediaType
- The media type expected by a client from a server.default MediaType getContentType()
MediaType
for the HTTP body.default T withAcceptTypes(MediaType... aMediaTypes)
MediaType
for the
HeaderField.ACCEPT
header.aMediaTypes
- The according MediaType
.default void setAcceptTypes(MediaType... aMediaTypes)
MediaType
for the
HeaderField.ACCEPT
header.aMediaTypes
- The according MediaType
.default MediaType[] getAcceptTypes()
MediaType
as found in
the HeaderField.ACCEPT
header.MediaType
.default T withUserAgent(String aUserAgent)
aUserAgent
- The according user agent.default void setUserAgent(String aUserAgent)
aUserAgent
- The according user agent.default String getUserAgent()
default T withHost(String aHost)
aHost
- The according host.default void setHost(String aHost)
aHost
- The according host.default String getHost()
default T withCorrelationId(String aCorrelationId)
aCorrelationId
- The according correlation ID..default void setCorrelationId(String aCorrelationId)
aCorrelationId
- The according correlation ID..default String getCorrelationId()
default String getFirst(HeaderField aHeaderField)
HttpFields.getFirst(String)
default void addTo(HeaderField aHeaderField, String aValue)
HttpFields.addTo(String, String)
default void set(HeaderField aHeaderField, String aValue)
HttpFields.set(String, String)
default HeaderFields<C,T> withSet(String aHeaderField, String aValue)
HttpFields.set(String, String)
method.aHeaderField
- The header field for which to set a single value.aValue
- The single value to be set for the header field (key).HeaderFields
instance to continue building up the
header fields.default HeaderFields<C,T> withSet(HeaderField aHeaderField, String aValue)
withSet(String, String)
default HeaderFields<C,T> withAddTo(HeaderField aHeaderField, String aValue)
HttpFields.withAddTo(String, String)
C addCookie(String aCookieName, String aValue)
ResponseHeaderFields
instance. The server-side cookies are
retrieved from the #HEADER_SET_FIELD_COOKIE
header field.
WITH THE METHOD getCookies()
and getCookie(String)
ONLY
THE COOKIES SENT BY THE CLIENT CAN BE RETRIEVED. (E.G. COOKIES RESIDING
IN THE HEADER FIELD #HEADER_FIELD_COOKIE). COOKIES SET VIA
addCookie(String, String)
OR
withAddCookie(String, String)
CANNOT BE RETRIEVED, AS THE
COOKIES BEING SET SERVER-SIDE ARE PUT IN THE #HEADER_FIELD_COOKIE
.aCookieName
- The name for the cookie to be added.aValue
- The value of the cookie to be added.ResponseHeaderFields
instance!C addCookie(C aCookie)
ResponseHeaderFields
instance. The server-side cookies are
retrieved from the #HEADER_SET_FIELD_COOKIE
header field.
WITH THE METHOD getCookies()
and getCookie(String)
ONLY
THE COOKIES SENT BY THE CLIENT CAN BE RETRIEVED. (E.G. COOKIES RESIDING
IN THE HEADER FIELD #HEADER_FIELD_COOKIE). COOKIES SET VIA
addCookie(String, String)
OR
withAddCookie(String, String)
CANNOT BE RETRIEVED, AS THE
COOKIES BEING SET SERVER-SIDE ARE PUT IN THE #HEADER_FIELD_COOKIE
.aCookie
- The cookie to be added.ResponseHeaderFields
instance!default HeaderFields<C,T> withAddCookie(String aCookieName, String aValue)
addCookie(String, String)
method.
WITH THE METHOD getCookies()
and getCookie(String)
ONLY
THE COOKIES SENT BY THE CLIENT CAN BE RETRIEVED. (E.G. COOKIES RESIDING
IN THE HEADER FIELD #HEADER_FIELD_COOKIE). COOKIES SET VIA
addCookie(String, String)
OR
withAddCookie(String, String)
CANNOT BE RETRIEVED, AS THE
COOKIES BEING SET SERVER-SIDE ARE PUT IN THE #HEADER_FIELD_COOKIE
.aCookieName
- The name for the cookie to be added.aValue
- The value of the cookie to be added.ResponseHeaderFields
instance to continue building
up the header fields.default HeaderFields<C,T> withAddCookie(C aCookie)
addCookie(Cookie)
method.
WITH THE METHOD getCookies()
and getCookie(String)
ONLY
THE COOKIES SENT BY THE CLIENT CAN BE RETRIEVED. (E.G. COOKIES RESIDING
IN THE HEADER FIELD #HEADER_FIELD_COOKIE). COOKIES SET VIA
addCookie(String, String)
OR
withAddCookie(String, String)
CANNOT BE RETRIEVED, AS THE
COOKIES BEING SET SERVER-SIDE ARE PUT IN THE #HEADER_FIELD_COOKIE
.aCookie
- The cookie to be added.ResponseHeaderFields
instance to continue building
up the header fields.List<C> getCookies()
RequestHeaderFields
instance. If no cookie has been found, then
an empty array is returned. The client-side cookies are retrieved from
the #HEADER_FIELD_COOKIE
header field.
WITH THE METHOD getCookies()
and getCookie(String)
ONLY
THE COOKIES SENT BY THE CLIENT CAN BE RETRIEVED. (E.G. COOKIES RESIDING
IN THE HEADER FIELD #HEADER_FIELD_COOKIE). COOKIES SET VIA
addCookie(String, String)
OR
withAddCookie(String, String)
CANNOT BE RETRIEVED, AS THE
COOKIES BEING SET SERVER-SIDE ARE PUT IN THE #HEADER_FIELD_COOKIE
.
According to the Netscape cookie_spec
(https://curl.haxx.se/rfc/cookie_spec.html) the entire NAME=VALUE string
of a cookie is a sequence of characters excluding semi-colon, comma and
white space.RequestHeaderFields
instance.List<C> getCookie(String aCookieName)
RequestHeaderFields
instance. The client-side cookies are
retrieved from the #HEADER_FIELD_COOKIE
header field.
WITH THE METHOD getCookies()
and getCookie(String)
ONLY
THE COOKIES SENT BY THE CLIENT CAN BE RETRIEVED. (E.G. COOKIES RESIDING
IN THE HEADER FIELD #HEADER_FIELD_COOKIE). COOKIES SET VIA
addCookie(String, String)
OR
withAddCookie(String, String)
CANNOT BE RETRIEVED, AS THE
COOKIES BEING SET SERVER-SIDE ARE PUT IN THE #HEADER_FIELD_COOKIE
.aCookieName
- The name of the cookie to be retrieved.Copyright © 2016. All rights reserved.