Class HttpHeaders
- java.lang.Object
-
- com.foxinmy.weixin4j.http.HttpHeaders
-
- All Implemented Interfaces:
MultiValueMap<String,String>,Serializable,Map<String,List<String>>
public class HttpHeaders extends Object implements MultiValueMap<String,String>, Serializable
Represents HTTP request and response headers, mapping string header names to list of string values.In addition to the normal methods defined by
Map, this class offers the following convenience methods:getFirst(String)returns the first value associated with a given header nameadd(String, String)adds a header value to the list of values for a header nameset(String, String)sets the header value to a single string value
- Since:
- 3.0
- Author:
- Arjen Poutsma, Sebastien Deleuze
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringACCEPTThe HTTPAcceptheader field name.static StringACCEPT_CHARSETThe HTTPAccept-Charsetheader field name.static StringACCEPT_ENCODINGThe HTTPAccept-Encodingheader field name.static StringACCEPT_LANGUAGEThe HTTPAccept-Languageheader field name.static StringACCEPT_RANGESThe HTTPAccept-Rangesheader field name.static StringACCESS_CONTROL_ALLOW_CREDENTIALSThe CORSAccess-Control-Allow-Credentialsresponse header field name.static StringACCESS_CONTROL_ALLOW_HEADERSThe CORSAccess-Control-Allow-Headersresponse header field name.static StringACCESS_CONTROL_ALLOW_METHODSThe CORSAccess-Control-Allow-Methodsresponse header field name.static StringACCESS_CONTROL_ALLOW_ORIGINThe CORSAccess-Control-Allow-Originresponse header field name.static StringACCESS_CONTROL_EXPOSE_HEADERSThe CORSAccess-Control-Expose-Headersresponse header field name.static StringACCESS_CONTROL_MAX_AGEThe CORSAccess-Control-Max-Ageresponse header field name.static StringACCESS_CONTROL_REQUEST_HEADERSThe CORSAccess-Control-Request-Headersrequest header field name.static StringACCESS_CONTROL_REQUEST_METHODThe CORSAccess-Control-Request-Methodrequest header field name.static StringAGEThe HTTPAgeheader field name.static StringALLOWThe HTTPAllowheader field name.static StringAUTHORIZATIONThe HTTPAuthorizationheader field name.static StringCACHE_CONTROLThe HTTPCache-Controlheader field name.static StringCONNECTIONThe HTTPConnectionheader field name.static StringCONTENT_DISPOSITIONThe HTTPContent-Dispositionheader field namestatic StringCONTENT_ENCODINGThe HTTPContent-Encodingheader field name.static StringCONTENT_LANGUAGEThe HTTPContent-Languageheader field name.static StringCONTENT_LENGTHThe HTTPContent-Lengthheader field name.static StringCONTENT_LOCATIONThe HTTPContent-Locationheader field name.static StringCONTENT_RANGEThe HTTPContent-Rangeheader field name.static StringCONTENT_TYPEThe HTTPContent-Typeheader field name.static StringCOOKIEThe HTTPCookieheader field name.static StringDATEThe HTTPDateheader field name.static StringETAGThe HTTPETagheader field name.static StringEXPECTThe HTTPExpectheader field name.static StringEXPIRESThe HTTPExpiresheader field name.static StringFROMThe HTTPFromheader field name.static StringHOSTThe HTTPHostheader field name.static StringIF_MATCHThe HTTPIf-Matchheader field name.static StringIF_MODIFIED_SINCEThe HTTPIf-Modified-Sinceheader field name.static StringIF_NONE_MATCHThe HTTPIf-None-Matchheader field name.static StringIF_RANGEThe HTTPIf-Rangeheader field name.static StringIF_UNMODIFIED_SINCEThe HTTPIf-Unmodified-Sinceheader field name.static StringLAST_MODIFIEDThe HTTPLast-Modifiedheader field name.static StringLINKThe HTTPLinkheader field name.static StringLOCATIONThe HTTPLocationheader field name.static StringMAX_FORWARDSThe HTTPMax-Forwardsheader field name.static StringORIGINThe HTTPOriginheader field name.static StringPRAGMAThe HTTPPragmaheader field name.static StringPROXY_AUTHENTICATEThe HTTPProxy-Authenticateheader field name.static StringPROXY_AUTHORIZATIONThe HTTPProxy-Authorizationheader field name.static StringRANGEThe HTTPRangeheader field name.static StringREFERERThe HTTPRefererheader field name.static StringRETRY_AFTERThe HTTPRetry-Afterheader field name.static StringSERVERThe HTTPServerheader field name.static StringSET_COOKIEThe HTTPSet-Cookieheader field name.static StringSET_COOKIE2The HTTPSet-Cookie2header field name.static StringTEThe HTTPTEheader field name.static StringTRAILERThe HTTPTrailerheader field name.static StringTRANSFER_ENCODINGThe HTTPTransfer-Encodingheader field name.static StringUPGRADEThe HTTPUpgradeheader field name.static StringUSER_AGENTThe HTTPUser-Agentheader field name.static StringVARYThe HTTPVaryheader field name.static StringVIAThe HTTPViaheader field name.static StringWARNINGThe HTTPWarningheader field name.static StringWWW_AUTHENTICATEThe HTTPWWW-Authenticateheader field name.
-
Constructor Summary
Constructors Constructor Description HttpHeaders()Constructs a new, empty instance of theHttpHeadersobject.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(String headerName, String headerValue)Add the given, single header value under the given name.voidclear()booleancontainsKey(Object key)booleancontainsValue(Object value)Set<Map.Entry<String,List<String>>>entrySet()booleanequals(Object other)List<String>get(Object key)StringgetAccept()Return the list of acceptable media types, as specified by theAcceptheader.List<Charset>getAcceptCharset()Return the list of acceptable charsets, as specified by theAccept-Charsetheader.booleangetAccessControlAllowCredentials()Returns the value of theAccess-Control-Allow-Credentialsresponse header.List<String>getAccessControlAllowHeaders()Returns the value of theAccess-Control-Allow-Headersresponse header.List<HttpMethod>getAccessControlAllowMethods()Returns the value of theAccess-Control-Allow-Methodsresponse header.StringgetAccessControlAllowOrigin()Returns the value of theAccess-Control-Allow-Originresponse header.List<String>getAccessControlExposeHeaders()Returns the value of theAccess-Control-Expose-Headersresponse header.longgetAccessControlMaxAge()Returns the value of theAccess-Control-Max-Ageresponse header.List<String>getAccessControlRequestHeaders()Returns the value of theAccess-Control-Request-Headersrequest header.HttpMethodgetAccessControlRequestMethod()Returns the value of theAccess-Control-Request-Methodrequest header.Set<HttpMethod>getAllow()Return the set of allowedHTTP methods, as specified by theAllowheader.StringgetCacheControl()Returns the value of theCache-Controlheader.List<String>getConnection()Returns the value of theConnectionheader.longgetContentLength()Return the length of the body in bytes, as specified by theContent-Lengthheader.StringgetContentType()Return the media type of the body, as specified by theContent-Typeheader.longgetDate()Return the date and time at which the message was created, as specified by theDateheader.StringgetETag()Return the entity tag of the body, as specified by theETagheader.longgetExpires()Return the date and time at which the message is no longer valid, as specified by theExpiresheader.StringgetFirst(String headerName)Return the first header value for the given header name, if any.longgetFirstDate(String headerName)Parse the first header value for the given header name as a date, return -1 if there is no value, or raiseIllegalArgumentExceptionif the value cannot be parsed as a date.protected List<String>getFirstValueAsList(String header)longgetIfModifiedSince()Return the value of theIf-Modified-Sinceheader.List<String>getIfNoneMatch()Return the value of theIf-None-Matchheader.longgetLastModified()Return the time the resource was last changed, as specified by theLast-Modifiedheader.URIgetLocation()Return the (new) location of a resource as specified by theLocationheader.StringgetOrigin()Return the value of theOriginheader.StringgetPragma()Return the value of thePragmaheader.StringgetRange()Returns the value of theRangeheader.StringgetUpgrade()Returns the value of theUpgradeheader.inthashCode()booleanisEmpty()Set<String>keySet()List<String>put(String key, List<String> value)voidputAll(Map<? extends String,? extends List<String>> map)static HttpHeadersreadOnlyHttpHeaders(HttpHeaders headers)Return aHttpHeadersobject that can only be read, not written to.List<String>remove(Object key)voidset(String headerName, String headerValue)Set the given, single header value under the given name.voidsetAccept(List<ContentType> acceptableMediaTypes)Set the list of acceptable media types, as specified by theAcceptheader.voidsetAcceptCharset(List<Charset> acceptableCharsets)Set the list of acceptable charsets, as specified by theAccept-Charsetheader.voidsetAccessControlAllowCredentials(boolean allowCredentials)Set the (new) value of theAccess-Control-Allow-Credentialsresponse header.voidsetAccessControlAllowHeaders(List<String> allowedHeaders)Set the (new) value of theAccess-Control-Allow-Headersresponse header.voidsetAccessControlAllowMethods(List<HttpMethod> allowedMethods)Set the (new) value of theAccess-Control-Allow-Methodsresponse header.voidsetAccessControlAllowOrigin(String allowedOrigin)Set the (new) value of theAccess-Control-Allow-Originresponse header.voidsetAccessControlExposeHeaders(List<String> exposedHeaders)Set the (new) value of theAccess-Control-Expose-Headersresponse header.voidsetAccessControlMaxAge(long maxAge)Set the (new) value of theAccess-Control-Max-Ageresponse header.voidsetAccessControlRequestHeaders(List<String> requestHeaders)Set the (new) value of theAccess-Control-Request-Headersrequest header.voidsetAccessControlRequestMethod(HttpMethod requestedMethod)Set the (new) value of theAccess-Control-Request-Methodrequest header.voidsetAll(Map<String,String> values)Set the given values under.voidsetAllow(Set<HttpMethod> allowedMethods)Set the set of allowedHTTP methods, as specified by theAllowheader.voidsetCacheControl(String cacheControl)Set the (new) value of theCache-Controlheader.voidsetConnection(String connection)Set the (new) value of theConnectionheader.voidsetConnection(List<String> connection)Set the (new) value of theConnectionheader.voidsetContentDispositionFormData(String name, String filename)Set the (new) value of theContent-Dispositionheader forform-data.voidsetContentLength(long contentLength)Set the length of the body in bytes, as specified by theContent-Lengthheader.voidsetContentType(ContentType contentType)Set the media type of the body, as specified by theContent-Typeheader.voidsetDate(long date)Set the date and time at which the message was created, as specified by theDateheader.voidsetDate(String headerName, long date)Set the given date under the given header name after formatting it as a string using the pattern"EEE, dd MMM yyyy HH:mm:ss zzz".voidsetETag(String eTag)Set the (new) entity tag of the body, as specified by theETagheader.voidsetExpires(long expires)Set the date and time at which the message is no longer valid, as specified by theExpiresheader.voidsetIfModifiedSince(long ifModifiedSince)Set the (new) value of theIf-Modified-Sinceheader.voidsetIfNoneMatch(String ifNoneMatch)Set the (new) value of theIf-None-Matchheader.voidsetIfNoneMatch(List<String> ifNoneMatchList)Set the (new) values of theIf-None-Matchheader.voidsetLastModified(long lastModified)Set the time the resource was last changed, as specified by theLast-Modifiedheader.voidsetLocation(URI location)Set the (new) location of a resource, as specified by theLocationheader.voidsetOrigin(String origin)Set the (new) value of theOriginheader.voidsetPragma(String pragma)Set the (new) value of thePragmaheader.voidsetRange(String range)Sets the (new) value of theRangeheader.voidsetUpgrade(String upgrade)Set the (new) value of theUpgradeheader.intsize()protected StringtoCommaDelimitedString(List<String> list)Map<String,String>toSingleValueMap()Returns the first values contained in thisMultiValueMap.StringtoString()Collection<List<String>>values()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Field Detail
-
ACCEPT
public static final String ACCEPT
The HTTPAcceptheader field name.- See Also:
- Section 5.3.2 of RFC 7231, Constant Field Values
-
ACCEPT_CHARSET
public static final String ACCEPT_CHARSET
The HTTPAccept-Charsetheader field name.- See Also:
- Section 5.3.3 of RFC 7231, Constant Field Values
-
ACCEPT_ENCODING
public static final String ACCEPT_ENCODING
The HTTPAccept-Encodingheader field name.- See Also:
- Section 5.3.4 of RFC 7231, Constant Field Values
-
ACCEPT_LANGUAGE
public static final String ACCEPT_LANGUAGE
The HTTPAccept-Languageheader field name.- See Also:
- Section 5.3.5 of RFC 7231, Constant Field Values
-
ACCEPT_RANGES
public static final String ACCEPT_RANGES
The HTTPAccept-Rangesheader field name.- See Also:
- Section 5.3.5 of RFC 7233, Constant Field Values
-
ACCESS_CONTROL_ALLOW_CREDENTIALS
public static final String ACCESS_CONTROL_ALLOW_CREDENTIALS
The CORSAccess-Control-Allow-Credentialsresponse header field name.- See Also:
- CORS W3C recommandation, Constant Field Values
-
ACCESS_CONTROL_ALLOW_HEADERS
public static final String ACCESS_CONTROL_ALLOW_HEADERS
The CORSAccess-Control-Allow-Headersresponse header field name.- See Also:
- CORS W3C recommandation, Constant Field Values
-
ACCESS_CONTROL_ALLOW_METHODS
public static final String ACCESS_CONTROL_ALLOW_METHODS
The CORSAccess-Control-Allow-Methodsresponse header field name.- See Also:
- CORS W3C recommandation, Constant Field Values
-
ACCESS_CONTROL_ALLOW_ORIGIN
public static final String ACCESS_CONTROL_ALLOW_ORIGIN
The CORSAccess-Control-Allow-Originresponse header field name.- See Also:
- CORS W3C recommandation, Constant Field Values
-
ACCESS_CONTROL_EXPOSE_HEADERS
public static final String ACCESS_CONTROL_EXPOSE_HEADERS
The CORSAccess-Control-Expose-Headersresponse header field name.- See Also:
- CORS W3C recommandation, Constant Field Values
-
ACCESS_CONTROL_MAX_AGE
public static final String ACCESS_CONTROL_MAX_AGE
The CORSAccess-Control-Max-Ageresponse header field name.- See Also:
- CORS W3C recommandation, Constant Field Values
-
ACCESS_CONTROL_REQUEST_HEADERS
public static final String ACCESS_CONTROL_REQUEST_HEADERS
The CORSAccess-Control-Request-Headersrequest header field name.- See Also:
- CORS W3C recommandation, Constant Field Values
-
ACCESS_CONTROL_REQUEST_METHOD
public static final String ACCESS_CONTROL_REQUEST_METHOD
The CORSAccess-Control-Request-Methodrequest header field name.- See Also:
- CORS W3C recommandation, Constant Field Values
-
AGE
public static final String AGE
The HTTPAgeheader field name.- See Also:
- Section 5.1 of RFC 7234, Constant Field Values
-
ALLOW
public static final String ALLOW
The HTTPAllowheader field name.- See Also:
- Section 7.4.1 of RFC 7231, Constant Field Values
-
AUTHORIZATION
public static final String AUTHORIZATION
The HTTPAuthorizationheader field name.- See Also:
- Section 4.2 of RFC 7235, Constant Field Values
-
CACHE_CONTROL
public static final String CACHE_CONTROL
The HTTPCache-Controlheader field name.- See Also:
- Section 5.2 of RFC 7234, Constant Field Values
-
CONNECTION
public static final String CONNECTION
The HTTPConnectionheader field name.- See Also:
- Section 6.1 of RFC 7230, Constant Field Values
-
CONTENT_ENCODING
public static final String CONTENT_ENCODING
The HTTPContent-Encodingheader field name.- See Also:
- Section 3.1.2.2 of RFC 7231, Constant Field Values
-
CONTENT_DISPOSITION
public static final String CONTENT_DISPOSITION
The HTTPContent-Dispositionheader field name- See Also:
- RFC 6266, Constant Field Values
-
CONTENT_LANGUAGE
public static final String CONTENT_LANGUAGE
The HTTPContent-Languageheader field name.- See Also:
- Section 3.1.3.2 of RFC 7231, Constant Field Values
-
CONTENT_LENGTH
public static final String CONTENT_LENGTH
The HTTPContent-Lengthheader field name.- See Also:
- Section 3.3.2 of RFC 7230, Constant Field Values
-
CONTENT_LOCATION
public static final String CONTENT_LOCATION
The HTTPContent-Locationheader field name.- See Also:
- Section 3.1.4.2 of RFC 7231, Constant Field Values
-
CONTENT_RANGE
public static final String CONTENT_RANGE
The HTTPContent-Rangeheader field name.- See Also:
- Section 4.2 of RFC 7233, Constant Field Values
-
CONTENT_TYPE
public static final String CONTENT_TYPE
The HTTPContent-Typeheader field name.- See Also:
- Section 3.1.1.5 of RFC 7231, Constant Field Values
-
COOKIE
public static final String COOKIE
The HTTPCookieheader field name.- See Also:
- Section 4.3.4 of RFC 2109, Constant Field Values
-
DATE
public static final String DATE
The HTTPDateheader field name.- See Also:
- Section 7.1.1.2 of RFC 7231, Constant Field Values
-
ETAG
public static final String ETAG
The HTTPETagheader field name.- See Also:
- Section 2.3 of RFC 7232, Constant Field Values
-
EXPECT
public static final String EXPECT
The HTTPExpectheader field name.- See Also:
- Section 5.1.1 of RFC 7231, Constant Field Values
-
EXPIRES
public static final String EXPIRES
The HTTPExpiresheader field name.- See Also:
- Section 5.3 of RFC 7234, Constant Field Values
-
FROM
public static final String FROM
The HTTPFromheader field name.- See Also:
- Section 5.5.1 of RFC 7231, Constant Field Values
-
HOST
public static final String HOST
The HTTPHostheader field name.- See Also:
- Section 5.4 of RFC 7230, Constant Field Values
-
IF_MATCH
public static final String IF_MATCH
The HTTPIf-Matchheader field name.- See Also:
- Section 3.1 of RFC 7232, Constant Field Values
-
IF_MODIFIED_SINCE
public static final String IF_MODIFIED_SINCE
The HTTPIf-Modified-Sinceheader field name.- See Also:
- Section 3.3 of RFC 7232, Constant Field Values
-
IF_NONE_MATCH
public static final String IF_NONE_MATCH
The HTTPIf-None-Matchheader field name.- See Also:
- Section 3.2 of RFC 7232, Constant Field Values
-
IF_RANGE
public static final String IF_RANGE
The HTTPIf-Rangeheader field name.- See Also:
- Section 3.2 of RFC 7233, Constant Field Values
-
IF_UNMODIFIED_SINCE
public static final String IF_UNMODIFIED_SINCE
The HTTPIf-Unmodified-Sinceheader field name.- See Also:
- Section 3.4 of RFC 7232, Constant Field Values
-
LAST_MODIFIED
public static final String LAST_MODIFIED
The HTTPLast-Modifiedheader field name.- See Also:
- Section 2.2 of RFC 7232, Constant Field Values
-
LINK
public static final String LINK
The HTTPLinkheader field name.- See Also:
- RFC 5988, Constant Field Values
-
LOCATION
public static final String LOCATION
The HTTPLocationheader field name.- See Also:
- Section 7.1.2 of RFC 7231, Constant Field Values
-
MAX_FORWARDS
public static final String MAX_FORWARDS
The HTTPMax-Forwardsheader field name.- See Also:
- Section 5.1.2 of RFC 7231, Constant Field Values
-
ORIGIN
public static final String ORIGIN
The HTTPOriginheader field name.- See Also:
- RFC 6454, Constant Field Values
-
PRAGMA
public static final String PRAGMA
The HTTPPragmaheader field name.- See Also:
- Section 5.4 of RFC 7234, Constant Field Values
-
PROXY_AUTHENTICATE
public static final String PROXY_AUTHENTICATE
The HTTPProxy-Authenticateheader field name.- See Also:
- Section 4.3 of RFC 7235, Constant Field Values
-
PROXY_AUTHORIZATION
public static final String PROXY_AUTHORIZATION
The HTTPProxy-Authorizationheader field name.- See Also:
- Section 4.4 of RFC 7235, Constant Field Values
-
RANGE
public static final String RANGE
The HTTPRangeheader field name.- See Also:
- Section 3.1 of RFC 7233, Constant Field Values
-
REFERER
public static final String REFERER
The HTTPRefererheader field name.- See Also:
- Section 5.5.2 of RFC 7231, Constant Field Values
-
RETRY_AFTER
public static final String RETRY_AFTER
The HTTPRetry-Afterheader field name.- See Also:
- Section 7.1.3 of RFC 7231, Constant Field Values
-
SERVER
public static final String SERVER
The HTTPServerheader field name.- See Also:
- Section 7.4.2 of RFC 7231, Constant Field Values
-
SET_COOKIE
public static final String SET_COOKIE
The HTTPSet-Cookieheader field name.- See Also:
- Section 4.2.2 of RFC 2109, Constant Field Values
-
SET_COOKIE2
public static final String SET_COOKIE2
The HTTPSet-Cookie2header field name.- See Also:
- RFC 2965, Constant Field Values
-
TE
public static final String TE
The HTTPTEheader field name.- See Also:
- Section 4.3 of RFC 7230, Constant Field Values
-
TRAILER
public static final String TRAILER
The HTTPTrailerheader field name.- See Also:
- Section 4.4 of RFC 7230, Constant Field Values
-
TRANSFER_ENCODING
public static final String TRANSFER_ENCODING
The HTTPTransfer-Encodingheader field name.- See Also:
- Section 3.3.1 of RFC 7230, Constant Field Values
-
UPGRADE
public static final String UPGRADE
The HTTPUpgradeheader field name.- See Also:
- Section 6.7 of RFC 7230, Constant Field Values
-
USER_AGENT
public static final String USER_AGENT
The HTTPUser-Agentheader field name.- See Also:
- Section 5.5.3 of RFC 7231, Constant Field Values
-
VARY
public static final String VARY
The HTTPVaryheader field name.- See Also:
- Section 7.1.4 of RFC 7231, Constant Field Values
-
VIA
public static final String VIA
The HTTPViaheader field name.- See Also:
- Section 5.7.1 of RFC 7230, Constant Field Values
-
WARNING
public static final String WARNING
The HTTPWarningheader field name.- See Also:
- Section 5.5 of RFC 7234, Constant Field Values
-
WWW_AUTHENTICATE
public static final String WWW_AUTHENTICATE
The HTTPWWW-Authenticateheader field name.- See Also:
- Section 4.1 of RFC 7235, Constant Field Values
-
-
Method Detail
-
setAccept
public void setAccept(List<ContentType> acceptableMediaTypes)
Set the list of acceptable media types, as specified by theAcceptheader.
-
getAccept
public String getAccept()
Return the list of acceptable media types, as specified by theAcceptheader.Returns an empty list when the acceptable media types are unspecified.
-
setAccessControlAllowCredentials
public void setAccessControlAllowCredentials(boolean allowCredentials)
Set the (new) value of theAccess-Control-Allow-Credentialsresponse header.
-
getAccessControlAllowCredentials
public boolean getAccessControlAllowCredentials()
Returns the value of theAccess-Control-Allow-Credentialsresponse header.
-
setAccessControlAllowHeaders
public void setAccessControlAllowHeaders(List<String> allowedHeaders)
Set the (new) value of theAccess-Control-Allow-Headersresponse header.
-
getAccessControlAllowHeaders
public List<String> getAccessControlAllowHeaders()
Returns the value of theAccess-Control-Allow-Headersresponse header.
-
setAccessControlAllowMethods
public void setAccessControlAllowMethods(List<HttpMethod> allowedMethods)
Set the (new) value of theAccess-Control-Allow-Methodsresponse header.
-
getAccessControlAllowMethods
public List<HttpMethod> getAccessControlAllowMethods()
Returns the value of theAccess-Control-Allow-Methodsresponse header.
-
setAccessControlAllowOrigin
public void setAccessControlAllowOrigin(String allowedOrigin)
Set the (new) value of theAccess-Control-Allow-Originresponse header.
-
getAccessControlAllowOrigin
public String getAccessControlAllowOrigin()
Returns the value of theAccess-Control-Allow-Originresponse header.
-
setAccessControlExposeHeaders
public void setAccessControlExposeHeaders(List<String> exposedHeaders)
Set the (new) value of theAccess-Control-Expose-Headersresponse header.
-
getAccessControlExposeHeaders
public List<String> getAccessControlExposeHeaders()
Returns the value of theAccess-Control-Expose-Headersresponse header.
-
setAccessControlMaxAge
public void setAccessControlMaxAge(long maxAge)
Set the (new) value of theAccess-Control-Max-Ageresponse header.
-
getAccessControlMaxAge
public long getAccessControlMaxAge()
Returns the value of theAccess-Control-Max-Ageresponse header.Returns -1 when the max age is unknown.
-
setAccessControlRequestHeaders
public void setAccessControlRequestHeaders(List<String> requestHeaders)
Set the (new) value of theAccess-Control-Request-Headersrequest header.
-
getAccessControlRequestHeaders
public List<String> getAccessControlRequestHeaders()
Returns the value of theAccess-Control-Request-Headersrequest header.
-
setAccessControlRequestMethod
public void setAccessControlRequestMethod(HttpMethod requestedMethod)
Set the (new) value of theAccess-Control-Request-Methodrequest header.
-
getAccessControlRequestMethod
public HttpMethod getAccessControlRequestMethod()
Returns the value of theAccess-Control-Request-Methodrequest header.
-
setAcceptCharset
public void setAcceptCharset(List<Charset> acceptableCharsets)
Set the list of acceptable charsets, as specified by theAccept-Charsetheader.
-
getAcceptCharset
public List<Charset> getAcceptCharset()
Return the list of acceptable charsets, as specified by theAccept-Charsetheader.
-
setAllow
public void setAllow(Set<HttpMethod> allowedMethods)
Set the set of allowedHTTP methods, as specified by theAllowheader.
-
getAllow
public Set<HttpMethod> getAllow()
Return the set of allowedHTTP methods, as specified by theAllowheader.Returns an empty set when the allowed methods are unspecified.
-
setCacheControl
public void setCacheControl(String cacheControl)
Set the (new) value of theCache-Controlheader.
-
getCacheControl
public String getCacheControl()
Returns the value of theCache-Controlheader.
-
setConnection
public void setConnection(String connection)
Set the (new) value of theConnectionheader.
-
setConnection
public void setConnection(List<String> connection)
Set the (new) value of theConnectionheader.
-
setContentDispositionFormData
public void setContentDispositionFormData(String name, String filename)
Set the (new) value of theContent-Dispositionheader forform-data.- Parameters:
name- the control namefilename- the filename (may benull)
-
setContentLength
public void setContentLength(long contentLength)
Set the length of the body in bytes, as specified by theContent-Lengthheader.
-
getContentLength
public long getContentLength()
Return the length of the body in bytes, as specified by theContent-Lengthheader.Returns -1 when the content-length is unknown.
-
setContentType
public void setContentType(ContentType contentType)
Set the media type of the body, as specified by theContent-Typeheader.
-
getContentType
public String getContentType()
Return the media type of the body, as specified by theContent-Typeheader.Returns
nullwhen the content-type is unknown.
-
setDate
public void setDate(long date)
Set the date and time at which the message was created, as specified by theDateheader.The date should be specified as the number of milliseconds since January 1, 1970 GMT.
-
getDate
public long getDate()
Return the date and time at which the message was created, as specified by theDateheader.The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
- Throws:
IllegalArgumentException- if the value can't be converted to a date
-
setETag
public void setETag(String eTag)
Set the (new) entity tag of the body, as specified by theETagheader.
-
getETag
public String getETag()
Return the entity tag of the body, as specified by theETagheader.
-
setExpires
public void setExpires(long expires)
Set the date and time at which the message is no longer valid, as specified by theExpiresheader.The date should be specified as the number of milliseconds since January 1, 1970 GMT.
-
getExpires
public long getExpires()
Return the date and time at which the message is no longer valid, as specified by theExpiresheader.The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
-
setIfModifiedSince
public void setIfModifiedSince(long ifModifiedSince)
Set the (new) value of theIf-Modified-Sinceheader.The date should be specified as the number of milliseconds since January 1, 1970 GMT.
-
getIfModifiedSince
public long getIfModifiedSince()
Return the value of theIf-Modified-Sinceheader.The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
-
setIfNoneMatch
public void setIfNoneMatch(String ifNoneMatch)
Set the (new) value of theIf-None-Matchheader.
-
setIfNoneMatch
public void setIfNoneMatch(List<String> ifNoneMatchList)
Set the (new) values of theIf-None-Matchheader.
-
setLastModified
public void setLastModified(long lastModified)
Set the time the resource was last changed, as specified by theLast-Modifiedheader.The date should be specified as the number of milliseconds since January 1, 1970 GMT.
-
getLastModified
public long getLastModified()
Return the time the resource was last changed, as specified by theLast-Modifiedheader.The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
-
setLocation
public void setLocation(URI location)
Set the (new) location of a resource, as specified by theLocationheader.
-
getLocation
public URI getLocation()
Return the (new) location of a resource as specified by theLocationheader.Returns
nullwhen the location is unknown.
-
setOrigin
public void setOrigin(String origin)
Set the (new) value of theOriginheader.
-
getOrigin
public String getOrigin()
Return the value of theOriginheader.
-
setPragma
public void setPragma(String pragma)
Set the (new) value of thePragmaheader.
-
getPragma
public String getPragma()
Return the value of thePragmaheader.
-
setRange
public void setRange(String range)
Sets the (new) value of theRangeheader.
-
getRange
public String getRange()
Returns the value of theRangeheader.Returns an empty list when the range is unknown.
-
setUpgrade
public void setUpgrade(String upgrade)
Set the (new) value of theUpgradeheader.
-
getUpgrade
public String getUpgrade()
Returns the value of theUpgradeheader.
-
getFirstDate
public long getFirstDate(String headerName)
Parse the first header value for the given header name as a date, return -1 if there is no value, or raiseIllegalArgumentExceptionif the value cannot be parsed as a date.
-
setDate
public void setDate(String headerName, long date)
Set the given date under the given header name after formatting it as a string using the pattern"EEE, dd MMM yyyy HH:mm:ss zzz". The equivalent ofset(String, String)but for date headers.
-
getFirst
public String getFirst(String headerName)
Return the first header value for the given header name, if any.- Specified by:
getFirstin interfaceMultiValueMap<String,String>- Parameters:
headerName- the header name- Returns:
- the first header value, or
nullif none
-
add
public void add(String headerName, String headerValue)
Add the given, single header value under the given name.- Specified by:
addin interfaceMultiValueMap<String,String>- Parameters:
headerName- the header nameheaderValue- the header value- Throws:
UnsupportedOperationException- if adding headers is not supported- See Also:
put(String, List),set(String, String)
-
set
public void set(String headerName, String headerValue)
Set the given, single header value under the given name.- Specified by:
setin interfaceMultiValueMap<String,String>- Parameters:
headerName- the header nameheaderValue- the header value- Throws:
UnsupportedOperationException- if adding headers is not supported- See Also:
put(String, List),add(String, String)
-
setAll
public void setAll(Map<String,String> values)
Description copied from interface:MultiValueMapSet the given values under.- Specified by:
setAllin interfaceMultiValueMap<String,String>- Parameters:
values- the values.
-
toSingleValueMap
public Map<String,String> toSingleValueMap()
Description copied from interface:MultiValueMapReturns the first values contained in thisMultiValueMap.- Specified by:
toSingleValueMapin interfaceMultiValueMap<String,String>- Returns:
- a single value representation of this map
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<String,List<String>>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<String,List<String>>
-
values
public Collection<List<String>> values()
-
equals
public boolean equals(Object other)
-
hashCode
public int hashCode()
-
readOnlyHttpHeaders
public static HttpHeaders readOnlyHttpHeaders(HttpHeaders headers)
Return aHttpHeadersobject that can only be read, not written to.
-
-