Package io.micronaut.http
Class CaseInsensitiveMutableHttpHeaders
- java.lang.Object
-
- io.micronaut.http.CaseInsensitiveMutableHttpHeaders
-
- All Implemented Interfaces:
io.micronaut.core.convert.value.ConvertibleMultiValues<java.lang.String>
,io.micronaut.core.convert.value.ConvertibleValues<java.util.List<java.lang.String>>
,io.micronaut.core.type.Headers
,io.micronaut.core.type.MutableHeaders
,io.micronaut.core.value.ValueResolver<java.lang.CharSequence>
,HttpHeaders
,MutableHttpHeaders
,java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.util.List<java.lang.String>>>
@Internal public final class CaseInsensitiveMutableHttpHeaders extends java.lang.Object implements MutableHttpHeaders
AMutableHttpHeaders
implementation that is case-insensitive.- Since:
- 4.0.0
-
-
Field Summary
-
Fields inherited from interface io.micronaut.http.HttpHeaders
ACCEPT, ACCEPT_CH, ACCEPT_CH_LIFETIME, ACCEPT_CHARSET, ACCEPT_ENCODING, ACCEPT_LANGUAGE, ACCEPT_PATCH, ACCEPT_RANGES, ACCESS_CONTROL_ALLOW_CREDENTIALS, ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_METHODS, ACCESS_CONTROL_ALLOW_ORIGIN, ACCESS_CONTROL_EXPOSE_HEADERS, ACCESS_CONTROL_MAX_AGE, ACCESS_CONTROL_REQUEST_HEADERS, ACCESS_CONTROL_REQUEST_METHOD, AGE, ALLOW, AUTHORIZATION, AUTHORIZATION_INFO, CACHE_CONTROL, CONNECTION, CONTENT_BASE, CONTENT_DISPOSITION, CONTENT_DPR, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_MD5, CONTENT_RANGE, CONTENT_TRANSFER_ENCODING, CONTENT_TYPE, COOKIE, CROSS_ORIGIN_RESOURCE_POLICY, DATE, DEVICE_MEMORY, DOWNLINK, DPR, ECT, ETAG, EXPECT, EXPIRES, FEATURE_POLICY, FORWARDED, FROM, HOST, IF_MATCH, IF_MODIFIED_SINCE, IF_NONE_MATCH, IF_RANGE, IF_UNMODIFIED_SINCE, LAST_MODIFIED, LINK, LOCATION, MAX_FORWARDS, ORIGIN, PRAGMA, PROXY_AUTHENTICATE, PROXY_AUTHORIZATION, RANGE, REFERER, REFERRER_POLICY, RETRY_AFTER, RTT, SAVE_DATA, SEC_WEBSOCKET_ACCEPT, SEC_WEBSOCKET_KEY, SEC_WEBSOCKET_KEY1, SEC_WEBSOCKET_KEY2, SEC_WEBSOCKET_LOCATION, SEC_WEBSOCKET_ORIGIN, SEC_WEBSOCKET_PROTOCOL, SEC_WEBSOCKET_VERSION, SERVER, SET_COOKIE, SET_COOKIE2, SOURCE_MAP, STANDARD_HEADERS, TE, TRAILER, TRANSFER_ENCODING, UPGRADE, USER_AGENT, VARY, VIA, VIEWPORT_WIDTH, WARNING, WEBSOCKET_LOCATION, WEBSOCKET_ORIGIN, WEBSOCKET_PROTOCOL, WIDTH, WWW_AUTHENTICATE, X_AUTH_TOKEN
-
Fields inherited from interface io.micronaut.http.MutableHttpHeaders
GMT
-
-
Constructor Summary
Constructors Constructor Description CaseInsensitiveMutableHttpHeaders(boolean validate, io.micronaut.core.convert.ConversionService<?> conversionService)
Create an empty CaseInsensitiveMutableHttpHeaders.CaseInsensitiveMutableHttpHeaders(boolean validate, java.util.Map<java.lang.String,java.util.List<java.lang.String>> defaults, io.micronaut.core.convert.ConversionService<?> conversionService)
Create a CaseInsensitiveMutableHttpHeaders populated by the entries in the provided Map<String,String>.CaseInsensitiveMutableHttpHeaders(io.micronaut.core.convert.ConversionService<?> conversionService)
Create an empty CaseInsensitiveMutableHttpHeaders.CaseInsensitiveMutableHttpHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> defaults, io.micronaut.core.convert.ConversionService<?> conversionService)
Create a CaseInsensitiveMutableHttpHeaders populated by the entries in the provided Map<String,String>.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MutableHttpHeaders
add(java.lang.CharSequence header, java.lang.CharSequence value)
Add a header for the given name and value.java.lang.String
get(java.lang.CharSequence name)
<T> java.util.Optional<T>
get(java.lang.CharSequence name, io.micronaut.core.convert.ArgumentConversionContext<T> conversionContext)
java.util.List<java.lang.String>
getAll(java.lang.CharSequence name)
java.util.Set<java.lang.String>
names()
MutableHttpHeaders
remove(java.lang.CharSequence header)
java.util.Collection<java.util.List<java.lang.String>>
values()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.micronaut.core.convert.value.ConvertibleMultiValues
forEach, forEachValue, getFirst, getFirst, getFirst, getFirst, getFirst, isEmpty, iterator
-
Methods inherited from interface io.micronaut.core.convert.value.ConvertibleValues
asMap, asMap, asProperties, contains, getValue, getValueType, subMap, subMap, subMap
-
Methods inherited from interface io.micronaut.http.HttpHeaders
accept, contentLength, contentType, findDate, findFirst, findInt, getAuthorization, getContentType, getDate, getInt, getOrigin, isKeepAlive
-
Methods inherited from interface io.micronaut.http.MutableHttpHeaders
add, add, allow, allow, allowGeneric, auth, auth, contentType, date, date, expires, expires, ifModifiedSince, ifModifiedSince, lastModified, lastModified, location, set
-
-
-
-
Constructor Detail
-
CaseInsensitiveMutableHttpHeaders
public CaseInsensitiveMutableHttpHeaders(io.micronaut.core.convert.ConversionService<?> conversionService)
Create an empty CaseInsensitiveMutableHttpHeaders.- Parameters:
conversionService
- The conversion service
-
CaseInsensitiveMutableHttpHeaders
public CaseInsensitiveMutableHttpHeaders(boolean validate, io.micronaut.core.convert.ConversionService<?> conversionService)
Create an empty CaseInsensitiveMutableHttpHeaders.- Parameters:
validate
- Whether to validate the headersconversionService
- The conversion service
-
CaseInsensitiveMutableHttpHeaders
public CaseInsensitiveMutableHttpHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> defaults, io.micronaut.core.convert.ConversionService<?> conversionService)
Create a CaseInsensitiveMutableHttpHeaders populated by the entries in the provided Map<String,String>.- Parameters:
defaults
- The defaultsconversionService
- The conversion service
-
CaseInsensitiveMutableHttpHeaders
public CaseInsensitiveMutableHttpHeaders(boolean validate, java.util.Map<java.lang.String,java.util.List<java.lang.String>> defaults, io.micronaut.core.convert.ConversionService<?> conversionService)
Create a CaseInsensitiveMutableHttpHeaders populated by the entries in the provided Map<String,String>.Warning! Setting
validate
tofalse
will not validate header names and values, and can leave your server implementation vulnerable to CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Response Splitting').- Parameters:
validate
- Whether to validate the headersdefaults
- The defaultsconversionService
- The conversion service
-
-
Method Detail
-
getAll
public java.util.List<java.lang.String> getAll(java.lang.CharSequence name)
- Specified by:
getAll
in interfaceio.micronaut.core.convert.value.ConvertibleMultiValues<java.lang.String>
-
get
@Nullable public java.lang.String get(java.lang.CharSequence name)
- Specified by:
get
in interfaceio.micronaut.core.convert.value.ConvertibleMultiValues<java.lang.String>
-
names
public java.util.Set<java.lang.String> names()
- Specified by:
names
in interfaceio.micronaut.core.convert.value.ConvertibleValues<java.util.List<java.lang.String>>
-
values
public java.util.Collection<java.util.List<java.lang.String>> values()
- Specified by:
values
in interfaceio.micronaut.core.convert.value.ConvertibleValues<java.util.List<java.lang.String>>
-
get
public <T> java.util.Optional<T> get(java.lang.CharSequence name, io.micronaut.core.convert.ArgumentConversionContext<T> conversionContext)
- Specified by:
get
in interfaceio.micronaut.core.value.ValueResolver<java.lang.CharSequence>
-
add
public MutableHttpHeaders add(java.lang.CharSequence header, java.lang.CharSequence value)
Description copied from interface:MutableHttpHeaders
Add a header for the given name and value.- Specified by:
add
in interfaceio.micronaut.core.type.MutableHeaders
- Specified by:
add
in interfaceMutableHttpHeaders
- Parameters:
header
- The header namevalue
- The value- Returns:
- This headers object
-
remove
public MutableHttpHeaders remove(java.lang.CharSequence header)
- Specified by:
remove
in interfaceio.micronaut.core.type.MutableHeaders
- Specified by:
remove
in interfaceMutableHttpHeaders
-
-