C
- The Cookie
type to be used by sub-classes.T
- The type of the sub-class, required for the builder methods such
as HeaderFields.withHost(String)
.public abstract class AbstractHeaderFields<C extends Cookie,T extends HeaderFields<C,T>> extends AbstractHttpFields<T> implements HeaderFields<C,T>
HeaderFields
type.AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
BasicAuthCredentialsAccessor.BasicAuthCredentialsBuilder<B extends BasicAuthCredentialsAccessor.BasicAuthCredentialsBuilder<B>>, BasicAuthCredentialsAccessor.BasicAuthCredentialsMutator, BasicAuthCredentialsAccessor.BasicAuthCredentialsProperty
BearerAuthCredentialsAccessor.BearerAuthCredentialsBuilder<B extends BearerAuthCredentialsAccessor.BearerAuthCredentialsBuilder<B>>, BearerAuthCredentialsAccessor.BearerAuthCredentialsMutator, BearerAuthCredentialsAccessor.BearerAuthCredentialsProperty
BASIC_REALM
Constructor and Description |
---|
AbstractHeaderFields()
Instantiates a new abstract Header-Fields.
|
AbstractHeaderFields(Map<String,List<String>> aHttpFields)
Instantiates a new abstract Header-Fields.
|
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. |
void |
addTo(String aHeaderField,
String aValue)
Adds a value to the list of values associated with the given Header-Field
(key),.
|
protected abstract C |
createCookie(String aHttpCookie)
|
protected abstract C |
createCookie(String aCookieName,
String aValue)
Creates a plain
Cookie with the given name and value. |
Set<Map.Entry<String,List<String>>> |
entrySet() |
List<String> |
get(Object aKey) |
List<C> |
getAllCookies()
Retrieves an array of cookies sent by the client stored in this
RequestHeaderFields instance. |
protected abstract String |
getCookieFieldName()
The Header-Field name for the
Cookie elements. |
protected static boolean |
isCommaSeparatedHeaderField(String aHeaderName)
Tests the given HTTP Header-Field name whether it holds a comma separated
value.
|
Set<String> |
keySet() |
List<String> |
put(String aKey,
List<String> aValue) |
void |
putAll(Map<? extends String,? extends List<String>> aMap) |
protected String |
toHeaderField(Object aHeaderField)
Normalizes the case of the provided Header-Field to conform to the
HeaderField.getName() format if possible. |
protected static void |
toHeaderFields(Map<String,List<String>> aFromFields,
HeaderFields<?,?> aToFields)
Copies the provided "from" fields into the provided "to" fields.
|
copyHttpFields
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, forEach, getOrDefault, isEmpty, merge, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
equals, hashCode, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
addCookie, addTo, addTo, addTo, get, getAcceptCharsets, getAcceptEncodings, getAcceptTypes, getAllowMethods, getAuthenticate, getBasicAuth, getBasicAuthCredentials, getBearerAuthCredentials, getContentEncoding, getContentType, getCookies, getFirst, getFirstCookie, getHost, getRequestId, getSessionId, getUnknownAcceptTypes, getUnknownContentTypes, getUserAgent, put, put, put, putAcceptCharsets, putAcceptCharsets, putAcceptEncodings, putAcceptEncodings, putAcceptTypes, putAcceptTypes, putAllowMethods, putAllowMethods, putAuthenticate, putBasicAuthCredentials, putBasicAuthRequired, putBearerAuthCredentials, putContentEncoding, putContentType, putContentType, putHost, putRequestId, putSessionId, putUserAgent, remove, removeAcceptCharsets, removeAcceptEncodings, removeAcceptTypes, removeAllowMethods, removeAuthenticate, removeBasicAuthCredentials, removeBasicAuthenticate, removeBearerAuthCredentials, removeContentEncoding, removeContentType, removeHost, removeRequestId, removeSessionId, removeUserAgent, toBasicAuthRealm, toHeaderFields, toHttpCookies, withAcceptCharsets, withAcceptCharsets, withAcceptEncodings, withAcceptEncodings, withAcceptTypes, withAcceptTypes, withAddCookie, withAddCookie, withAddTo, withAddTo, withAddTo, withAllowMethods, withAllowMethods, withAuthenticate, withBasicAuthCredentials, withBasicAuthCredentials, withBasicAuthRequired, withBearerAuthCredentials, withBearerAuthCredentials, withContentEncoding, withContentType, withContentType, withHost, withPut, withPut, withPut, withRequestId, withSessionId, withUserAgent
addTo, addTo, addTo, addTo, addTo, getFirst, getFirst, put, put, put, put, toField, toField, withAddTo, withAddTo, withAddTo, withAddTo, withAddTo, withAddTo, withPut, withPut, withPut, withPut, withPut, withPut
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, getOrDefault, hashCode, isEmpty, merge, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
putBasicAuthCredentials
putBearerAuthCredentials
public AbstractHeaderFields()
public void addTo(String aHeaderField, String aValue)
addTo
in interface HttpFields<T extends HeaderFields<C,T>>
aHeaderField
- The Header-Field (key) of which's list of values a value is
to be added.aValue
- The value to be added to the list of values associated to
the given Header-Field (key).public C addCookie(C aCookie)
ResponseHeaderFields
instance. The server-side cookies are
retrieved from the HeaderField.SET_COOKIE
Header-Field.
WITH THE METHOD HeaderFields.getAllCookies()
and HeaderFields.getCookies(String)
as well as HeaderFields.getFirstCookie(String)
ONLY THE COOKIES SENT BY THE
CLIENT CAN BE RETRIEVED (E.G. COOKIES RESIDING IN THE HEADER FIELD
HeaderField.COOKIE
). COOKIES SET VIA
HeaderFields.addCookie(String, String)
OR
HeaderFields.withAddCookie(String, String)
CANNOT BE RETRIEVED, AS THE
COOKIES BEING SET SERVER-SIDE ARE PUT IN THE
HeaderField.SET_COOKIE
Header-Field.addCookie
in interface HeaderFields<C extends Cookie,T extends HeaderFields<C,T>>
aCookie
- The cookie to be added.ResponseHeaderFields
instance!public List<C> getAllCookies()
RequestHeaderFields
instance. If no cookie has been found, then
an empty array is returned. The client-side cookies are retrieved from
the HeaderField.COOKIE
Header-Field.
WITH THE METHOD HeaderFields.getAllCookies()
and HeaderFields.getCookies(String)
as well as HeaderFields.getFirstCookie(String)
ONLY THE COOKIES SENT BY THE
CLIENT CAN BE RETRIEVED (E.G. COOKIES RESIDING IN THE HEADER FIELD
HeaderField.COOKIE
). COOKIES SET VIA
HeaderFields.addCookie(String, String)
OR
HeaderFields.withAddCookie(String, String)
CANNOT BE RETRIEVED, AS THE
COOKIES BEING SET SERVER-SIDE ARE PUT IN THE
HeaderField.SET_COOKIE
Header-Field.
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.getAllCookies
in interface HeaderFields<C extends Cookie,T extends HeaderFields<C,T>>
RequestHeaderFields
instance.public C addCookie(String aCookieName, String aValue)
ResponseHeaderFields
instance. The server-side cookies are
retrieved from the HeaderField.SET_COOKIE
Header-Field.
WITH THE METHOD HeaderFields.getAllCookies()
and HeaderFields.getCookies(String)
as well as HeaderFields.getFirstCookie(String)
ONLY THE COOKIES SENT BY THE
CLIENT CAN BE RETRIEVED (E.G. COOKIES RESIDING IN THE HEADER FIELD
HeaderField.COOKIE
). COOKIES SET VIA
HeaderFields.addCookie(String, String)
OR
HeaderFields.withAddCookie(String, String)
CANNOT BE RETRIEVED, AS THE
COOKIES BEING SET SERVER-SIDE ARE PUT IN THE
HeaderField.SET_COOKIE
Header-Field.addCookie
in interface HeaderFields<C extends Cookie,T extends HeaderFields<C,T>>
aCookieName
- The name for the cookie to be added.aValue
- The value of the cookie to be added.ResponseHeaderFields
instance!protected static boolean isCommaSeparatedHeaderField(String aHeaderName)
aHeaderName
- The name of the header to be tested.protected static void toHeaderFields(Map<String,List<String>> aFromFields, HeaderFields<?,?> aToFields)
aFromFields
- The fields from which to copy.aToFields
- The fields to which to copy.protected String toHeaderField(Object aHeaderField)
HeaderField.getName()
format if possible. Else the unmodified
Header-Field is returned.aHeaderField
- The field to normalize.protected abstract String getCookieFieldName()
Cookie
elements. The Header-Field
name differs from the context, e.g. when setting a Cookie
server-side or when retrieving a Cookie
client-side.Cookie
elements are stored.protected abstract C createCookie(String aCookieName, String aValue)
Cookie
with the given name and value.Copyright © 2017. All rights reserved.