Modifier and Type | Method and Description |
---|---|
List<ParameterizedHeaderWithValue> |
accept()
Gets the
Accept-Charset header value. |
List<ParameterizedHeaderWithValue> |
acceptCharset()
Gets the
Accept header value. |
List<ParameterizedHeaderWithValue> |
acceptEncoding()
Gets the
Accept-Encoding header value. |
List<ParameterizedHeaderWithValue> |
acceptLanguage()
Gets the
Accept-Language header value. |
Headers |
add(CharSequence name,
Iterable<?> values) |
Headers |
add(CharSequence name,
Object value) |
Headers |
add(Headers headers) |
Headers |
add(String name,
Iterable<?> values) |
Headers |
add(String name,
Object value) |
Headers |
addInt(CharSequence name,
int value) |
Headers |
addShort(CharSequence name,
short value)
Deprecated.
|
ParameterizedHeader |
cacheControl()
Gets the
Cache-Control header value. |
Headers |
clear() |
boolean |
contains(CharSequence name)
Returns true if the given parameter is specified with any value
|
boolean |
contains(CharSequence name,
CharSequence value,
boolean ignoreCase)
Checks if a header with the given name exists with the given value.
|
boolean |
contains(String name)
Returns true if the given parameter is specified with any value
|
boolean |
contains(String name,
String value,
boolean ignoreCase)
Checks if a header with the given name exists with the given value.
|
boolean |
containsValue(CharSequence name,
CharSequence value,
boolean ignoreCase)
Similar to
contains(String, String, boolean) but returns true even if a value occurs in a comma-separated
header list. |
javax.ws.rs.core.MediaType |
contentType()
Gets the parsed
Content-Type header value. |
List<Map.Entry<String,String>> |
entries() |
boolean |
equals(Object o) |
List<ForwardedHeader> |
forwarded()
Gets the
Forwarded header value. |
String |
get(CharSequence name)
Gets the value with the given name, or null if there is no parameter with that name.
|
String |
get(CharSequence name,
String defaultValue)
Gets the value with the given name, or the default value if there is no parameter with that name.
|
String |
get(String name)
Gets the value with the given name, or null if there is no parameter with that name.
|
List<String> |
getAll(CharSequence name)
Gets all the parameters with the given name, or an empty list if none are found.
|
List<String> |
getAll(String name)
Gets all the parameters with the given name, or an empty list if none are found.
|
List<String> |
getAllAsString(CharSequence name)
Deprecated.
|
String |
getAsString(CharSequence name)
Deprecated.
|
boolean |
getBoolean(String name)
Gets a parameter as a boolean, where values such as
true , on and yes as
considered true, and other values (or no parameter with the name) is considered false. |
double |
getDouble(String name,
double defaultValue)
Gets the parameter as a double, or returns the default value if it was not specified or was in an invalid format.
|
float |
getFloat(String name,
float defaultValue)
Gets the parameter as a float, or returns the default value if it was not specified or was in an invalid format.
|
Integer |
getInt(CharSequence name)
Deprecated.
|
int |
getInt(CharSequence name,
int defaultValue)
Gets the parameter as an integer, or returns the default value if it was not specified or was in an invalid format.
|
long |
getLong(String name,
long defaultValue)
Gets the parameter as a long, or returns the default value if it was not specified or was in an invalid format.
|
Short |
getShort(CharSequence name)
Deprecated.
|
short |
getShort(CharSequence name,
short defaultValue)
Deprecated.
|
Long |
getTimeMillis(CharSequence name) |
long |
getTimeMillis(CharSequence name,
long defaultValue) |
boolean |
hasBody()
Returns true if the headers suggest there is a message body by checking if there is a
HeaderNames.TRANSFER_ENCODING
header or the HeaderNames.CONTENT_LENGTH is greater than 0. |
int |
hashCode() |
static Headers |
http1Headers()
Creates new headers for HTTP1 requests
|
static Headers |
http2Headers()
Creates new headers for HTTP2 requests
|
boolean |
isEmpty() |
Iterator<Map.Entry<String,String>> |
iterator() |
Iterator<Map.Entry<String,String>> |
iteratorAsString()
Deprecated.
|
Set<String> |
names() |
Headers |
remove(CharSequence name) |
Headers |
remove(String name) |
Headers |
set(CharSequence name,
Iterable<?> values) |
Headers |
set(CharSequence name,
Object value) |
Headers |
set(Headers headers) |
Headers |
set(String name,
Iterable<?> values) |
Headers |
set(String name,
Object value) |
Headers |
setAll(Headers headers) |
Headers |
setInt(CharSequence name,
int value) |
Headers |
setShort(CharSequence name,
short value)
Deprecated.
|
int |
size() |
String |
toString() |
forEach, spliterator
String get(String name)
Gets the value with the given name, or null if there is no parameter with that name.
If there are multiple parameters with the same name, the first one is returned.
name
- The name of the parameter to getString get(CharSequence name)
Gets the value with the given name, or null if there is no parameter with that name.
If there are multiple parameters with the same name, the first one is returned.
name
- The name of the parameter to getString get(CharSequence name, String defaultValue)
Gets the value with the given name, or the default value if there is no parameter with that name.
If there are multiple parameters with the same name, the first one is returned.
name
- The name of the parameter to getdefaultValue
- The default value to use if there is no given value@Deprecated Integer getInt(CharSequence name)
int getInt(CharSequence name, int defaultValue)
name
- The name of the parameter.defaultValue
- The value to use if none was specified, or an invalid format was used.long getLong(String name, long defaultValue)
name
- The name of the parameter.defaultValue
- The value to use if none was specified, or an invalid format was used.float getFloat(String name, float defaultValue)
name
- The name of the parameter.defaultValue
- The value to use if none was specified, or an invalid format was used.double getDouble(String name, double defaultValue)
name
- The name of the parameter.defaultValue
- The value to use if none was specified, or an invalid format was used.boolean getBoolean(String name)
Gets a parameter as a boolean, where values such as true
, on
and yes
as
considered true, and other values (or no parameter with the name) is considered false.
This can be used to access checkbox values as booleans.
name
- The name of the parameter.@Deprecated Short getShort(CharSequence name)
@Deprecated short getShort(CharSequence name, short defaultValue)
Long getTimeMillis(CharSequence name)
long getTimeMillis(CharSequence name, long defaultValue)
List<String> getAll(String name)
name
- The parameter name to getList<String> getAll(CharSequence name)
name
- The parameter name to getboolean contains(String name)
name
- The name of the valueboolean contains(CharSequence name)
name
- The name of the valueboolean isEmpty()
int size()
Headers add(CharSequence name, Object value)
Headers add(CharSequence name, Iterable<?> values)
Headers addInt(CharSequence name, int value)
@Deprecated Headers addShort(CharSequence name, short value)
Headers set(CharSequence name, Object value)
Headers set(CharSequence name, Iterable<?> values)
Headers setInt(CharSequence name, int value)
@Deprecated Headers setShort(CharSequence name, short value)
Headers remove(CharSequence name)
Headers clear()
boolean contains(String name, String value, boolean ignoreCase)
name
- The case-insensitive header name to check.value
- The value to check for.ignoreCase
- If true, the case of the value is ignored.boolean contains(CharSequence name, CharSequence value, boolean ignoreCase)
name
- The case-insensitive header name to check.value
- The value to check for.ignoreCase
- If true, the case of the value is ignored.boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase)
contains(String, String, boolean)
but returns true even if a value occurs in a comma-separated
header list.name
- The case-insensitive header name to check.value
- The value to check for.ignoreCase
- If true, the case of the value is ignored.@Deprecated String getAsString(CharSequence name)
@Deprecated List<String> getAllAsString(CharSequence name)
@Deprecated Iterator<Map.Entry<String,String>> iteratorAsString()
boolean hasBody()
HeaderNames.TRANSFER_ENCODING
header or the HeaderNames.CONTENT_LENGTH
is greater than 0.List<ParameterizedHeaderWithValue> accept()
Gets the Accept-Charset
header value.
For example, if a client sends text/html,application/xml;q=0.9
then this would return a list of two values: text/html, and application/xml where application/xml
has a parameter q
of value 0.9
Accept
header, or an empty list if none specified.List<ParameterizedHeaderWithValue> acceptCharset()
Gets the Accept
header value.
For example, if a client sends iso-8859-5, unicode-1-1;q=0.8
then this would return a list of two values: iso-8859-5, and unicode-1-1 where unicode-1-1
has a parameter q
of value 0.8
Accept-Charset
header, or an empty list if none specified.List<ParameterizedHeaderWithValue> acceptEncoding()
Gets the Accept-Encoding
header value.
For example, if a client sends gzip, deflate
then this would return a list of two values: gzip and deflate
Accept-Encoding
header, or an empty list if none specified.List<ForwardedHeader> forwarded()
Gets the Forwarded
header value.
For example, if a client sends for=192.0.2.60;proto=http;by=203.0.113.43
then this would return a list of length one that has for, proto, and by values.
If there is no Forwarded header, however there are X-Forwarded-* headers, then those will be used to generate pseudo-forwarded headers.
Forwarded
header, or an empty list if none specified.List<ParameterizedHeaderWithValue> acceptLanguage()
Gets the Accept-Language
header value.
For example, if a client sends en-US,en;q=0.5
then this would return a list of two values: en-US and en where en has a q
value of 0.5
Accept-Language
header, or an empty list if none specified.ParameterizedHeader cacheControl()
Cache-Control
header value.javax.ws.rs.core.MediaType contentType()
Content-Type
header value.null
if not set.static Headers http1Headers()
static Headers http2Headers()
Copyright © 2017–2021. All rights reserved.