Class HttpHeaders
- java.lang.Object
-
- java.util.AbstractMap<java.lang.String,java.lang.Object>
-
- com.google.api.client.util.GenericData
-
- com.google.api.client.http.HttpHeaders
-
- All Implemented Interfaces:
java.lang.Cloneable,java.util.Map<java.lang.String,java.lang.Object>
public class HttpHeaders extends GenericData
Stores HTTP headers used in an HTTP request or response, as defined in Header Field Definitions.nullis not allowed as a name or value of a header. Names are case-insensitive.Implementation is not thread-safe.
- Since:
- 1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classHttpHeaders.HeaderParsingFakeLevelHttpRequestLowLevelHttpRequest which will call the .parseHeader() method for every header added.private static classHttpHeaders.ParseHeaderStateState container forparseHeader(String, String, ParseHeaderState).-
Nested classes/interfaces inherited from class com.google.api.client.util.GenericData
GenericData.Flags
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>accept"Accept"header.private java.util.List<java.lang.String>acceptEncoding"Accept-Encoding"header.private java.util.List<java.lang.Long>age"Age"header.private java.util.List<java.lang.String>authenticate"WWW-Authenticate"header.private java.util.List<java.lang.String>authorization"Authorization"header.private java.util.List<java.lang.String>cacheControl"Cache-Control"header.private java.util.List<java.lang.String>contentEncoding"Content-Encoding"header.private java.util.List<java.lang.Long>contentLength"Content-Length"header.private java.util.List<java.lang.String>contentMD5"Content-MD5"header.private java.util.List<java.lang.String>contentRange"Content-Range"header.private java.util.List<java.lang.String>contentType"Content-Type"header.private java.util.List<java.lang.String>cookie"Cookie"header.private java.util.List<java.lang.String>date"Date"header.private java.util.List<java.lang.String>etag"ETag"header.private java.util.List<java.lang.String>expires"Expires"header.private java.util.List<java.lang.String>ifMatch"If-Match"header.private java.util.List<java.lang.String>ifModifiedSince"If-Modified-Since"header.private java.util.List<java.lang.String>ifNoneMatch"If-None-Match"header.private java.util.List<java.lang.String>ifRange"If-Range"header.private java.util.List<java.lang.String>ifUnmodifiedSince"If-Unmodified-Since"header.private java.util.List<java.lang.String>lastModified"Last-Modified"header.private java.util.List<java.lang.String>location"Location"header.private java.util.List<java.lang.String>mimeVersion"MIME-Version"header.private java.util.List<java.lang.String>range"Range"header.private java.util.List<java.lang.String>retryAfter"Retry-After"header.private java.util.List<java.lang.String>userAgent"User-Agent"header.private java.util.List<java.lang.String>warning"Warning"header.
-
Constructor Summary
Constructors Constructor Description HttpHeaders()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voidaddHeader(java.util.logging.Logger logger, java.lang.StringBuilder logbuf, java.lang.StringBuilder curlbuf, LowLevelHttpRequest lowLevelHttpRequest, java.lang.String name, java.lang.Object value, java.io.Writer writer)HttpHeadersaddWarning(java.lang.String warning)Adds the"Warning"header ornullfor none.HttpHeadersclone()Makes a "deep" clone of the generic data, in which the clone is completely independent of the original.voidfromHttpHeaders(HttpHeaders headers)Puts all headers of theHttpHeadersobject into thisHttpHeadersobject.voidfromHttpResponse(LowLevelHttpResponse response, java.lang.StringBuilder logger)Puts all headers of theLowLevelHttpResponseinto thisHttpHeadersobject.java.lang.StringgetAccept()Returns the first"Accept"header ornullfor none.java.lang.StringgetAcceptEncoding()Returns the first"Accept-Encoding"header ornullfor none.java.lang.LonggetAge()Returns the first"Age"header ornullfor none.private <T> java.util.List<T>getAsList(T passedValue)Returns the list value to use for the given parameter passed to the setter method.java.lang.StringgetAuthenticate()Returns the first"WWW-Authenticate"header ornullfor none.java.util.List<java.lang.String>getAuthenticateAsList()Returns all"WWW-Authenticate"headers ornullfor none.java.lang.StringgetAuthorization()Returns the first"Authorization"header ornullfor none.java.util.List<java.lang.String>getAuthorizationAsList()Returns all"Authorization"headers ornullfor none.java.lang.StringgetCacheControl()Returns the first"Cache-Control"header ornullfor none.java.lang.StringgetContentEncoding()Returns the first"Content-Encoding"header ornullfor none.java.lang.LonggetContentLength()Returns the first"Content-Length"header ornullfor none.java.lang.StringgetContentMD5()Returns the first"Content-MD5"header ornullfor none.java.lang.StringgetContentRange()Returns the first"Content-Range"header ornullfor none.java.lang.StringgetContentType()Returns the first"Content-Type"header ornullfor none.java.lang.StringgetCookie()Returns the first"Cookie"header ornullfor none.java.lang.StringgetDate()Returns the first"Date"header ornullfor none.java.lang.StringgetETag()Returns the first"ETag"header ornullfor none.java.lang.StringgetExpires()Returns the first"Expires"header ornullfor none.java.lang.StringgetFirstHeaderStringValue(java.lang.String name)Returns the first header string value for the given header name.private <T> TgetFirstHeaderValue(java.util.List<T> internalValue)Returns the first header value based on the given internal list value.java.util.List<java.lang.String>getHeaderStringValues(java.lang.String name)Returns an unmodifiable list of the header string values for the given header name.java.lang.StringgetIfMatch()Returns the first"If-Match"header ornullfor none.java.lang.StringgetIfModifiedSince()Returns the first"If-Modified-Since"header ornullfor none.java.lang.StringgetIfNoneMatch()Returns the first"If-None-Match"header ornullfor none.java.lang.StringgetIfRange()Returns the first"If-Range"header ornullfor none.java.lang.StringgetIfUnmodifiedSince()Returns the first"If-Unmodified-Since"header ornullfor none.java.lang.StringgetLastModified()Returns the first"Last-Modified"header ornullfor none.java.lang.StringgetLocation()Returns the first"Location"header ornullfor none.java.lang.StringgetMimeVersion()Returns the first"MIME-Version"header ornullfor none.java.lang.StringgetRange()Returns the first"Range"header ornullfor none.java.lang.StringgetRetryAfter()Returns the first"Retry-After"header ornullfor none.java.lang.StringgetUserAgent()Returns the first"User-Agent"header ornullfor none.java.util.List<java.lang.String>getWarning()Returns all"Warning"headers ornullfor none.(package private) voidparseHeader(java.lang.String headerName, java.lang.String headerValue, HttpHeaders.ParseHeaderState state)Parses the specified case-insensitive header pair into this HttpHeaders instance.private static java.lang.ObjectparseValue(java.lang.reflect.Type valueType, java.util.List<java.lang.reflect.Type> context, java.lang.String value)(package private) static voidserializeHeaders(HttpHeaders headers, java.lang.StringBuilder logbuf, java.lang.StringBuilder curlbuf, java.util.logging.Logger logger, LowLevelHttpRequest lowLevelHttpRequest)Serializes headers to anLowLevelHttpRequest.(package private) static voidserializeHeaders(HttpHeaders headers, java.lang.StringBuilder logbuf, java.lang.StringBuilder curlbuf, java.util.logging.Logger logger, LowLevelHttpRequest lowLevelHttpRequest, java.io.Writer writer)static voidserializeHeadersForMultipartRequests(HttpHeaders headers, java.lang.StringBuilder logbuf, java.util.logging.Logger logger, java.io.Writer writer)Serializes headers to anWriterfor Multi-part requests.HttpHeadersset(java.lang.String fieldName, java.lang.Object value)Sets the given field value (may benull) for the given field name.HttpHeaderssetAccept(java.lang.String accept)Sets the"Accept"header ornullfor none.HttpHeaderssetAcceptEncoding(java.lang.String acceptEncoding)Sets the"Accept-Encoding"header ornullfor none.HttpHeaderssetAge(java.lang.Long age)Sets the"Age"header ornullfor none.HttpHeaderssetAuthenticate(java.lang.String authenticate)Sets the"WWW-Authenticate"header ornullfor none.HttpHeaderssetAuthorization(java.lang.String authorization)Sets the"Authorization"header ornullfor none.HttpHeaderssetAuthorization(java.util.List<java.lang.String> authorization)Sets the"Authorization"header ornullfor none.HttpHeaderssetBasicAuthentication(java.lang.String username, java.lang.String password)Sets theauthorizationheader as specified in Basic Authentication Scheme.HttpHeaderssetCacheControl(java.lang.String cacheControl)Sets the"Cache-Control"header ornullfor none.HttpHeaderssetContentEncoding(java.lang.String contentEncoding)Sets the"Content-Encoding"header ornullfor none.HttpHeaderssetContentLength(java.lang.Long contentLength)Sets the"Content-Length"header ornullfor none.HttpHeaderssetContentMD5(java.lang.String contentMD5)Sets the"Content-MD5"header ornullfor none.HttpHeaderssetContentRange(java.lang.String contentRange)Sets the"Content-Range"header ornullfor none.HttpHeaderssetContentType(java.lang.String contentType)Sets the"Content-Type"header ornullfor none.HttpHeaderssetCookie(java.lang.String cookie)Sets the"Cookie"header ornullfor none.HttpHeaderssetDate(java.lang.String date)Sets the"Date"header ornullfor none.HttpHeaderssetETag(java.lang.String etag)Sets the"ETag"header ornullfor none.HttpHeaderssetExpires(java.lang.String expires)Sets the"Expires"header ornullfor none.HttpHeaderssetIfMatch(java.lang.String ifMatch)Sets the"If-Match"header ornullfor none.HttpHeaderssetIfModifiedSince(java.lang.String ifModifiedSince)Sets the"If-Modified-Since"header ornullfor none.HttpHeaderssetIfNoneMatch(java.lang.String ifNoneMatch)Sets the"If-None-Match"header ornullfor none.HttpHeaderssetIfRange(java.lang.String ifRange)Sets the"If-Range"header ornullfor none.HttpHeaderssetIfUnmodifiedSince(java.lang.String ifUnmodifiedSince)Sets the"If-Unmodified-Since"header ornullfor none.HttpHeaderssetLastModified(java.lang.String lastModified)Sets the"Last-Modified"header ornullfor none.HttpHeaderssetLocation(java.lang.String location)Sets the"Location"header ornullfor none.HttpHeaderssetMimeVersion(java.lang.String mimeVersion)Sets the"MIME-Version"header ornullfor none.HttpHeaderssetRange(java.lang.String range)Sets the"Range"header ornullfor none.HttpHeaderssetRetryAfter(java.lang.String retryAfter)Sets the"Retry-After"header ornullfor none.HttpHeaderssetUserAgent(java.lang.String userAgent)Sets the"User-Agent"header ornullfor none.private static java.lang.StringtoStringValue(java.lang.Object headerValue)Returns the string header value for the given header value as an object.-
Methods inherited from class com.google.api.client.util.GenericData
entrySet, equals, get, getClassInfo, getUnknownKeys, hashCode, put, putAll, remove, setUnknownKeys, toString
-
Methods inherited from class java.util.AbstractMap
clear, containsKey, containsValue, isEmpty, keySet, size, values
-
-
-
-
Field Detail
-
accept
private java.util.List<java.lang.String> accept
"Accept"header.
-
acceptEncoding
private java.util.List<java.lang.String> acceptEncoding
"Accept-Encoding"header.
-
authorization
private java.util.List<java.lang.String> authorization
"Authorization"header.
-
cacheControl
private java.util.List<java.lang.String> cacheControl
"Cache-Control"header.
-
contentEncoding
private java.util.List<java.lang.String> contentEncoding
"Content-Encoding"header.
-
contentLength
private java.util.List<java.lang.Long> contentLength
"Content-Length"header.
-
contentMD5
private java.util.List<java.lang.String> contentMD5
"Content-MD5"header.
-
contentRange
private java.util.List<java.lang.String> contentRange
"Content-Range"header.
-
contentType
private java.util.List<java.lang.String> contentType
"Content-Type"header.
-
cookie
private java.util.List<java.lang.String> cookie
"Cookie"header.
-
date
private java.util.List<java.lang.String> date
"Date"header.
-
etag
private java.util.List<java.lang.String> etag
"ETag"header.
-
expires
private java.util.List<java.lang.String> expires
"Expires"header.
-
ifModifiedSince
private java.util.List<java.lang.String> ifModifiedSince
"If-Modified-Since"header.
-
ifMatch
private java.util.List<java.lang.String> ifMatch
"If-Match"header.
-
ifNoneMatch
private java.util.List<java.lang.String> ifNoneMatch
"If-None-Match"header.
-
ifUnmodifiedSince
private java.util.List<java.lang.String> ifUnmodifiedSince
"If-Unmodified-Since"header.
-
ifRange
private java.util.List<java.lang.String> ifRange
"If-Range"header.
-
lastModified
private java.util.List<java.lang.String> lastModified
"Last-Modified"header.
-
location
private java.util.List<java.lang.String> location
"Location"header.
-
mimeVersion
private java.util.List<java.lang.String> mimeVersion
"MIME-Version"header.
-
range
private java.util.List<java.lang.String> range
"Range"header.
-
retryAfter
private java.util.List<java.lang.String> retryAfter
"Retry-After"header.
-
userAgent
private java.util.List<java.lang.String> userAgent
"User-Agent"header.
-
warning
private java.util.List<java.lang.String> warning
"Warning"header.
-
authenticate
private java.util.List<java.lang.String> authenticate
"WWW-Authenticate"header.
-
age
private java.util.List<java.lang.Long> age
"Age"header.
-
-
Method Detail
-
clone
public HttpHeaders clone()
Description copied from class:GenericDataMakes a "deep" clone of the generic data, in which the clone is completely independent of the original.- Overrides:
clonein classGenericData
-
set
public HttpHeaders set(java.lang.String fieldName, java.lang.Object value)
Description copied from class:GenericDataSets the given field value (may benull) for the given field name. Any existing value for the field will be overwritten. It may be more slightly more efficient thanGenericData.put(String, Object)because it avoids accessing the field's original value.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Overrides:
setin classGenericData
-
getAccept
public final java.lang.String getAccept()
Returns the first"Accept"header ornullfor none.- Since:
- 1.5
-
setAccept
public HttpHeaders setAccept(java.lang.String accept)
Sets the"Accept"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getAcceptEncoding
public final java.lang.String getAcceptEncoding()
Returns the first"Accept-Encoding"header ornullfor none.- Since:
- 1.5
-
setAcceptEncoding
public HttpHeaders setAcceptEncoding(java.lang.String acceptEncoding)
Sets the"Accept-Encoding"header ornullfor none.By default, this is
"gzip".- Since:
- 1.5
-
getAuthorization
public final java.lang.String getAuthorization()
Returns the first"Authorization"header ornullfor none.- Since:
- 1.5
-
getAuthorizationAsList
public final java.util.List<java.lang.String> getAuthorizationAsList()
Returns all"Authorization"headers ornullfor none.- Since:
- 1.13
-
setAuthorization
public HttpHeaders setAuthorization(java.lang.String authorization)
Sets the"Authorization"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
setAuthorization
public HttpHeaders setAuthorization(java.util.List<java.lang.String> authorization)
Sets the"Authorization"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.13
-
getCacheControl
public final java.lang.String getCacheControl()
Returns the first"Cache-Control"header ornullfor none.- Since:
- 1.5
-
setCacheControl
public HttpHeaders setCacheControl(java.lang.String cacheControl)
Sets the"Cache-Control"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getContentEncoding
public final java.lang.String getContentEncoding()
Returns the first"Content-Encoding"header ornullfor none.- Since:
- 1.5
-
setContentEncoding
public HttpHeaders setContentEncoding(java.lang.String contentEncoding)
Sets the"Content-Encoding"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getContentLength
public final java.lang.Long getContentLength()
Returns the first"Content-Length"header ornullfor none.- Since:
- 1.5
-
setContentLength
public HttpHeaders setContentLength(java.lang.Long contentLength)
Sets the"Content-Length"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getContentMD5
public final java.lang.String getContentMD5()
Returns the first"Content-MD5"header ornullfor none.- Since:
- 1.5
-
setContentMD5
public HttpHeaders setContentMD5(java.lang.String contentMD5)
Sets the"Content-MD5"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getContentRange
public final java.lang.String getContentRange()
Returns the first"Content-Range"header ornullfor none.- Since:
- 1.5
-
setContentRange
public HttpHeaders setContentRange(java.lang.String contentRange)
Sets the"Content-Range"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getContentType
public final java.lang.String getContentType()
Returns the first"Content-Type"header ornullfor none.- Since:
- 1.5
-
setContentType
public HttpHeaders setContentType(java.lang.String contentType)
Sets the"Content-Type"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getCookie
public final java.lang.String getCookie()
- Since:
- 1.6
-
setCookie
public HttpHeaders setCookie(java.lang.String cookie)
Sets the"Cookie"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.6
-
getDate
public final java.lang.String getDate()
Returns the first"Date"header ornullfor none.- Since:
- 1.5
-
setDate
public HttpHeaders setDate(java.lang.String date)
Sets the"Date"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getETag
public final java.lang.String getETag()
Returns the first"ETag"header ornullfor none.- Since:
- 1.5
-
setETag
public HttpHeaders setETag(java.lang.String etag)
Sets the"ETag"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getExpires
public final java.lang.String getExpires()
Returns the first"Expires"header ornullfor none.- Since:
- 1.5
-
setExpires
public HttpHeaders setExpires(java.lang.String expires)
Sets the"Expires"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getIfModifiedSince
public final java.lang.String getIfModifiedSince()
Returns the first"If-Modified-Since"header ornullfor none.- Since:
- 1.5
-
setIfModifiedSince
public HttpHeaders setIfModifiedSince(java.lang.String ifModifiedSince)
Sets the"If-Modified-Since"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getIfMatch
public final java.lang.String getIfMatch()
Returns the first"If-Match"header ornullfor none.- Since:
- 1.5
-
setIfMatch
public HttpHeaders setIfMatch(java.lang.String ifMatch)
Sets the"If-Match"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getIfNoneMatch
public final java.lang.String getIfNoneMatch()
Returns the first"If-None-Match"header ornullfor none.- Since:
- 1.5
-
setIfNoneMatch
public HttpHeaders setIfNoneMatch(java.lang.String ifNoneMatch)
Sets the"If-None-Match"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getIfUnmodifiedSince
public final java.lang.String getIfUnmodifiedSince()
Returns the first"If-Unmodified-Since"header ornullfor none.- Since:
- 1.5
-
setIfUnmodifiedSince
public HttpHeaders setIfUnmodifiedSince(java.lang.String ifUnmodifiedSince)
Sets the"If-Unmodified-Since"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getIfRange
public final java.lang.String getIfRange()
Returns the first"If-Range"header ornullfor none.- Since:
- 1.14
-
setIfRange
public HttpHeaders setIfRange(java.lang.String ifRange)
Sets the"If-Range"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.14
-
getLastModified
public final java.lang.String getLastModified()
Returns the first"Last-Modified"header ornullfor none.- Since:
- 1.5
-
setLastModified
public HttpHeaders setLastModified(java.lang.String lastModified)
Sets the"Last-Modified"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getLocation
public final java.lang.String getLocation()
Returns the first"Location"header ornullfor none.- Since:
- 1.5
-
setLocation
public HttpHeaders setLocation(java.lang.String location)
Sets the"Location"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getMimeVersion
public final java.lang.String getMimeVersion()
Returns the first"MIME-Version"header ornullfor none.- Since:
- 1.5
-
setMimeVersion
public HttpHeaders setMimeVersion(java.lang.String mimeVersion)
Sets the"MIME-Version"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getRange
public final java.lang.String getRange()
Returns the first"Range"header ornullfor none.- Since:
- 1.5
-
setRange
public HttpHeaders setRange(java.lang.String range)
Sets the"Range"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getRetryAfter
public final java.lang.String getRetryAfter()
Returns the first"Retry-After"header ornullfor none.- Since:
- 1.5
-
setRetryAfter
public HttpHeaders setRetryAfter(java.lang.String retryAfter)
Sets the"Retry-After"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getUserAgent
public final java.lang.String getUserAgent()
Returns the first"User-Agent"header ornullfor none.- Since:
- 1.5
-
setUserAgent
public HttpHeaders setUserAgent(java.lang.String userAgent)
Sets the"User-Agent"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
getAuthenticate
public final java.lang.String getAuthenticate()
Returns the first"WWW-Authenticate"header ornullfor none.- Since:
- 1.5
-
getAuthenticateAsList
public final java.util.List<java.lang.String> getAuthenticateAsList()
Returns all"WWW-Authenticate"headers ornullfor none.- Since:
- 1.16
-
setAuthenticate
public HttpHeaders setAuthenticate(java.lang.String authenticate)
Sets the"WWW-Authenticate"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.5
-
addWarning
public HttpHeaders addWarning(java.lang.String warning)
Adds the"Warning"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.28
-
getWarning
public final java.util.List<java.lang.String> getWarning()
Returns all"Warning"headers ornullfor none.- Since:
- 1.28
-
getAge
public final java.lang.Long getAge()
Returns the first"Age"header ornullfor none.- Since:
- 1.14
-
setAge
public HttpHeaders setAge(java.lang.Long age)
Sets the"Age"header ornullfor none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.14
-
setBasicAuthentication
public HttpHeaders setBasicAuthentication(java.lang.String username, java.lang.String password)
Sets theauthorizationheader as specified in Basic Authentication Scheme.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.2
-
addHeader
private static void addHeader(java.util.logging.Logger logger, java.lang.StringBuilder logbuf, java.lang.StringBuilder curlbuf, LowLevelHttpRequest lowLevelHttpRequest, java.lang.String name, java.lang.Object value, java.io.Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
toStringValue
private static java.lang.String toStringValue(java.lang.Object headerValue)
Returns the string header value for the given header value as an object.
-
serializeHeaders
static void serializeHeaders(HttpHeaders headers, java.lang.StringBuilder logbuf, java.lang.StringBuilder curlbuf, java.util.logging.Logger logger, LowLevelHttpRequest lowLevelHttpRequest) throws java.io.IOException
Serializes headers to anLowLevelHttpRequest.- Parameters:
headers- HTTP headerslogbuf- log buffer ornullfor nonecurlbuf- log buffer for logging curl requests ornullfor nonelogger- logger ornullfor none. Logger must be specified if log buffer is specifiedlowLevelHttpRequest- low level HTTP request where HTTP headers will be serialized to ornullfor none- Throws:
java.io.IOException
-
serializeHeaders
static void serializeHeaders(HttpHeaders headers, java.lang.StringBuilder logbuf, java.lang.StringBuilder curlbuf, java.util.logging.Logger logger, LowLevelHttpRequest lowLevelHttpRequest, java.io.Writer writer) throws java.io.IOException
- Throws:
java.io.IOException
-
serializeHeadersForMultipartRequests
public static void serializeHeadersForMultipartRequests(HttpHeaders headers, java.lang.StringBuilder logbuf, java.util.logging.Logger logger, java.io.Writer writer) throws java.io.IOException
Serializes headers to anWriterfor Multi-part requests.- Parameters:
headers- HTTP headerslogbuf- log buffer ornullfor nonelogger- logger ornullfor none. Logger must be specified if log buffer is specifiedwriter- Writer where HTTP headers will be serialized to ornullfor none- Throws:
java.io.IOException- Since:
- 1.9
-
fromHttpResponse
public final void fromHttpResponse(LowLevelHttpResponse response, java.lang.StringBuilder logger) throws java.io.IOException
Puts all headers of theLowLevelHttpResponseinto thisHttpHeadersobject.- Parameters:
response- Response from which the headers are copiedlogger-StringBuilderto which logging output is added ornullto disable logging- Throws:
java.io.IOException- Since:
- 1.10
-
getFirstHeaderValue
private <T> T getFirstHeaderValue(java.util.List<T> internalValue)
Returns the first header value based on the given internal list value.
-
getAsList
private <T> java.util.List<T> getAsList(T passedValue)
Returns the list value to use for the given parameter passed to the setter method.
-
getFirstHeaderStringValue
public java.lang.String getFirstHeaderStringValue(java.lang.String name)
Returns the first header string value for the given header name.- Parameters:
name- header name (may be any case)- Returns:
- first header string value or
nullif not found - Since:
- 1.13
-
getHeaderStringValues
public java.util.List<java.lang.String> getHeaderStringValues(java.lang.String name)
Returns an unmodifiable list of the header string values for the given header name.- Parameters:
name- header name (may be any case)- Returns:
- header string values or empty if not found
- Since:
- 1.13
-
fromHttpHeaders
public final void fromHttpHeaders(HttpHeaders headers)
Puts all headers of theHttpHeadersobject into thisHttpHeadersobject.- Parameters:
headers-HttpHeadersfrom where the headers are taken- Since:
- 1.10
-
parseHeader
void parseHeader(java.lang.String headerName, java.lang.String headerValue, HttpHeaders.ParseHeaderState state)Parses the specified case-insensitive header pair into this HttpHeaders instance.
-
parseValue
private static java.lang.Object parseValue(java.lang.reflect.Type valueType, java.util.List<java.lang.reflect.Type> context, java.lang.String value)
-
-