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.null
is 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 class
HttpHeaders.HeaderParsingFakeLevelHttpRequest
LowLevelHttpRequest which will call the .parseHeader() method for every header added.private static class
HttpHeaders.ParseHeaderState
State 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 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)
HttpHeaders
addWarning(java.lang.String warning)
Adds the"Warning"
header ornull
for none.HttpHeaders
clone()
Makes a "deep" clone of the generic data, in which the clone is completely independent of the original.void
fromHttpHeaders(HttpHeaders headers)
Puts all headers of theHttpHeaders
object into thisHttpHeaders
object.void
fromHttpResponse(LowLevelHttpResponse response, java.lang.StringBuilder logger)
Puts all headers of theLowLevelHttpResponse
into thisHttpHeaders
object.java.lang.String
getAccept()
Returns the first"Accept"
header ornull
for none.java.lang.String
getAcceptEncoding()
Returns the first"Accept-Encoding"
header ornull
for none.java.lang.Long
getAge()
Returns the first"Age"
header ornull
for 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.String
getAuthenticate()
Returns the first"WWW-Authenticate"
header ornull
for none.java.util.List<java.lang.String>
getAuthenticateAsList()
Returns all"WWW-Authenticate"
headers ornull
for none.java.lang.String
getAuthorization()
Returns the first"Authorization"
header ornull
for none.java.util.List<java.lang.String>
getAuthorizationAsList()
Returns all"Authorization"
headers ornull
for none.java.lang.String
getCacheControl()
Returns the first"Cache-Control"
header ornull
for none.java.lang.String
getContentEncoding()
Returns the first"Content-Encoding"
header ornull
for none.java.lang.Long
getContentLength()
Returns the first"Content-Length"
header ornull
for none.java.lang.String
getContentMD5()
Returns the first"Content-MD5"
header ornull
for none.java.lang.String
getContentRange()
Returns the first"Content-Range"
header ornull
for none.java.lang.String
getContentType()
Returns the first"Content-Type"
header ornull
for none.java.lang.String
getCookie()
Returns the first"Cookie"
header ornull
for none.java.lang.String
getDate()
Returns the first"Date"
header ornull
for none.java.lang.String
getETag()
Returns the first"ETag"
header ornull
for none.java.lang.String
getExpires()
Returns the first"Expires"
header ornull
for none.java.lang.String
getFirstHeaderStringValue(java.lang.String name)
Returns the first header string value for the given header name.private <T> T
getFirstHeaderValue(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.String
getIfMatch()
Returns the first"If-Match"
header ornull
for none.java.lang.String
getIfModifiedSince()
Returns the first"If-Modified-Since"
header ornull
for none.java.lang.String
getIfNoneMatch()
Returns the first"If-None-Match"
header ornull
for none.java.lang.String
getIfRange()
Returns the first"If-Range"
header ornull
for none.java.lang.String
getIfUnmodifiedSince()
Returns the first"If-Unmodified-Since"
header ornull
for none.java.lang.String
getLastModified()
Returns the first"Last-Modified"
header ornull
for none.java.lang.String
getLocation()
Returns the first"Location"
header ornull
for none.java.lang.String
getMimeVersion()
Returns the first"MIME-Version"
header ornull
for none.java.lang.String
getRange()
Returns the first"Range"
header ornull
for none.java.lang.String
getRetryAfter()
Returns the first"Retry-After"
header ornull
for none.java.lang.String
getUserAgent()
Returns the first"User-Agent"
header ornull
for none.java.util.List<java.lang.String>
getWarning()
Returns all"Warning"
headers ornull
for none.(package private) void
parseHeader(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.Object
parseValue(java.lang.reflect.Type valueType, java.util.List<java.lang.reflect.Type> context, java.lang.String value)
(package private) static void
serializeHeaders(HttpHeaders headers, java.lang.StringBuilder logbuf, java.lang.StringBuilder curlbuf, java.util.logging.Logger logger, LowLevelHttpRequest lowLevelHttpRequest)
Serializes headers to anLowLevelHttpRequest
.(package private) static void
serializeHeaders(HttpHeaders headers, java.lang.StringBuilder logbuf, java.lang.StringBuilder curlbuf, java.util.logging.Logger logger, LowLevelHttpRequest lowLevelHttpRequest, java.io.Writer writer)
static void
serializeHeadersForMultipartRequests(HttpHeaders headers, java.lang.StringBuilder logbuf, java.util.logging.Logger logger, java.io.Writer writer)
Serializes headers to anWriter
for Multi-part requests.HttpHeaders
set(java.lang.String fieldName, java.lang.Object value)
Sets the given field value (may benull
) for the given field name.HttpHeaders
setAccept(java.lang.String accept)
Sets the"Accept"
header ornull
for none.HttpHeaders
setAcceptEncoding(java.lang.String acceptEncoding)
Sets the"Accept-Encoding"
header ornull
for none.HttpHeaders
setAge(java.lang.Long age)
Sets the"Age"
header ornull
for none.HttpHeaders
setAuthenticate(java.lang.String authenticate)
Sets the"WWW-Authenticate"
header ornull
for none.HttpHeaders
setAuthorization(java.lang.String authorization)
Sets the"Authorization"
header ornull
for none.HttpHeaders
setAuthorization(java.util.List<java.lang.String> authorization)
Sets the"Authorization"
header ornull
for none.HttpHeaders
setBasicAuthentication(java.lang.String username, java.lang.String password)
Sets theauthorization
header as specified in Basic Authentication Scheme.HttpHeaders
setCacheControl(java.lang.String cacheControl)
Sets the"Cache-Control"
header ornull
for none.HttpHeaders
setContentEncoding(java.lang.String contentEncoding)
Sets the"Content-Encoding"
header ornull
for none.HttpHeaders
setContentLength(java.lang.Long contentLength)
Sets the"Content-Length"
header ornull
for none.HttpHeaders
setContentMD5(java.lang.String contentMD5)
Sets the"Content-MD5"
header ornull
for none.HttpHeaders
setContentRange(java.lang.String contentRange)
Sets the"Content-Range"
header ornull
for none.HttpHeaders
setContentType(java.lang.String contentType)
Sets the"Content-Type"
header ornull
for none.HttpHeaders
setCookie(java.lang.String cookie)
Sets the"Cookie"
header ornull
for none.HttpHeaders
setDate(java.lang.String date)
Sets the"Date"
header ornull
for none.HttpHeaders
setETag(java.lang.String etag)
Sets the"ETag"
header ornull
for none.HttpHeaders
setExpires(java.lang.String expires)
Sets the"Expires"
header ornull
for none.HttpHeaders
setIfMatch(java.lang.String ifMatch)
Sets the"If-Match"
header ornull
for none.HttpHeaders
setIfModifiedSince(java.lang.String ifModifiedSince)
Sets the"If-Modified-Since"
header ornull
for none.HttpHeaders
setIfNoneMatch(java.lang.String ifNoneMatch)
Sets the"If-None-Match"
header ornull
for none.HttpHeaders
setIfRange(java.lang.String ifRange)
Sets the"If-Range"
header ornull
for none.HttpHeaders
setIfUnmodifiedSince(java.lang.String ifUnmodifiedSince)
Sets the"If-Unmodified-Since"
header ornull
for none.HttpHeaders
setLastModified(java.lang.String lastModified)
Sets the"Last-Modified"
header ornull
for none.HttpHeaders
setLocation(java.lang.String location)
Sets the"Location"
header ornull
for none.HttpHeaders
setMimeVersion(java.lang.String mimeVersion)
Sets the"MIME-Version"
header ornull
for none.HttpHeaders
setRange(java.lang.String range)
Sets the"Range"
header ornull
for none.HttpHeaders
setRetryAfter(java.lang.String retryAfter)
Sets the"Retry-After"
header ornull
for none.HttpHeaders
setUserAgent(java.lang.String userAgent)
Sets the"User-Agent"
header ornull
for none.private static java.lang.String
toStringValue(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:GenericData
Makes a "deep" clone of the generic data, in which the clone is completely independent of the original.- Overrides:
clone
in classGenericData
-
set
public HttpHeaders set(java.lang.String fieldName, java.lang.Object value)
Description copied from class:GenericData
Sets 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:
set
in classGenericData
-
getAccept
public final java.lang.String getAccept()
Returns the first"Accept"
header ornull
for none.- Since:
- 1.5
-
setAccept
public HttpHeaders setAccept(java.lang.String accept)
Sets the"Accept"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setAcceptEncoding
public HttpHeaders setAcceptEncoding(java.lang.String acceptEncoding)
Sets the"Accept-Encoding"
header ornull
for none.By default, this is
"gzip"
.- Since:
- 1.5
-
getAuthorization
public final java.lang.String getAuthorization()
Returns the first"Authorization"
header ornull
for none.- Since:
- 1.5
-
getAuthorizationAsList
public final java.util.List<java.lang.String> getAuthorizationAsList()
Returns all"Authorization"
headers ornull
for none.- Since:
- 1.13
-
setAuthorization
public HttpHeaders setAuthorization(java.lang.String authorization)
Sets the"Authorization"
header ornull
for 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 ornull
for 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 ornull
for none.- Since:
- 1.5
-
setCacheControl
public HttpHeaders setCacheControl(java.lang.String cacheControl)
Sets the"Cache-Control"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setContentEncoding
public HttpHeaders setContentEncoding(java.lang.String contentEncoding)
Sets the"Content-Encoding"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setContentLength
public HttpHeaders setContentLength(java.lang.Long contentLength)
Sets the"Content-Length"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setContentMD5
public HttpHeaders setContentMD5(java.lang.String contentMD5)
Sets the"Content-MD5"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setContentRange
public HttpHeaders setContentRange(java.lang.String contentRange)
Sets the"Content-Range"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setContentType
public HttpHeaders setContentType(java.lang.String contentType)
Sets the"Content-Type"
header ornull
for 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 ornull
for 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 ornull
for none.- Since:
- 1.5
-
setDate
public HttpHeaders setDate(java.lang.String date)
Sets the"Date"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setETag
public HttpHeaders setETag(java.lang.String etag)
Sets the"ETag"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setExpires
public HttpHeaders setExpires(java.lang.String expires)
Sets the"Expires"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setIfModifiedSince
public HttpHeaders setIfModifiedSince(java.lang.String ifModifiedSince)
Sets the"If-Modified-Since"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setIfMatch
public HttpHeaders setIfMatch(java.lang.String ifMatch)
Sets the"If-Match"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setIfNoneMatch
public HttpHeaders setIfNoneMatch(java.lang.String ifNoneMatch)
Sets the"If-None-Match"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setIfUnmodifiedSince
public HttpHeaders setIfUnmodifiedSince(java.lang.String ifUnmodifiedSince)
Sets the"If-Unmodified-Since"
header ornull
for 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 ornull
for none.- Since:
- 1.14
-
setIfRange
public HttpHeaders setIfRange(java.lang.String ifRange)
Sets the"If-Range"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setLastModified
public HttpHeaders setLastModified(java.lang.String lastModified)
Sets the"Last-Modified"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setLocation
public HttpHeaders setLocation(java.lang.String location)
Sets the"Location"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setMimeVersion
public HttpHeaders setMimeVersion(java.lang.String mimeVersion)
Sets the"MIME-Version"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setRange
public HttpHeaders setRange(java.lang.String range)
Sets the"Range"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setRetryAfter
public HttpHeaders setRetryAfter(java.lang.String retryAfter)
Sets the"Retry-After"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
setUserAgent
public HttpHeaders setUserAgent(java.lang.String userAgent)
Sets the"User-Agent"
header ornull
for 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 ornull
for none.- Since:
- 1.5
-
getAuthenticateAsList
public final java.util.List<java.lang.String> getAuthenticateAsList()
Returns all"WWW-Authenticate"
headers ornull
for none.- Since:
- 1.16
-
setAuthenticate
public HttpHeaders setAuthenticate(java.lang.String authenticate)
Sets the"WWW-Authenticate"
header ornull
for 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 ornull
for 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 ornull
for none.- Since:
- 1.28
-
getAge
public final java.lang.Long getAge()
Returns the first"Age"
header ornull
for none.- Since:
- 1.14
-
setAge
public HttpHeaders setAge(java.lang.Long age)
Sets the"Age"
header ornull
for 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 theauthorization
header 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 ornull
for nonecurlbuf
- log buffer for logging curl requests ornull
for nonelogger
- logger ornull
for none. Logger must be specified if log buffer is specifiedlowLevelHttpRequest
- low level HTTP request where HTTP headers will be serialized to ornull
for 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 anWriter
for Multi-part requests.- Parameters:
headers
- HTTP headerslogbuf
- log buffer ornull
for nonelogger
- logger ornull
for none. Logger must be specified if log buffer is specifiedwriter
- Writer where HTTP headers will be serialized to ornull
for 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 theLowLevelHttpResponse
into thisHttpHeaders
object.- Parameters:
response
- Response from which the headers are copiedlogger
-StringBuilder
to which logging output is added ornull
to 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
null
if 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 theHttpHeaders
object into thisHttpHeaders
object.- Parameters:
headers
-HttpHeaders
from 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)
-
-