Package io.micronaut.http
Interface MutableHttpHeaders
-
- All Superinterfaces:
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
,HttpHeaders
,java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.util.List<java.lang.String>>>
,io.micronaut.core.type.MutableHeaders
,io.micronaut.core.value.ValueResolver<java.lang.CharSequence>
- All Known Implementing Classes:
CaseInsensitiveMutableHttpHeaders
,SimpleHttpHeaders
public interface MutableHttpHeaders extends io.micronaut.core.type.MutableHeaders, HttpHeaders
ExtendsHttpHeaders
add methods for mutation of headers.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.time.ZoneId
GMT
The default GMT zone for date values.-
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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default 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.default MutableHttpHeaders
add(java.lang.CharSequence header, java.lang.Integer value)
Add a header for the given name and value.default MutableHttpHeaders
add(java.lang.CharSequence header, java.time.ZonedDateTime value)
Add a header for the given name and value.default MutableHttpHeaders
allow(HttpMethod... methods)
Set the allowed HTTP methods.default MutableHttpHeaders
allow(java.util.Collection<HttpMethod> methods)
Set the allowed HTTP methods.default MutableHttpHeaders
allowGeneric(java.util.Collection<? extends java.lang.CharSequence> methods)
Set the allowed HTTP methods.default MutableHttpHeaders
auth(java.lang.String userInfo)
Used to configure BASIC authentication.default MutableHttpHeaders
auth(java.lang.String username, java.lang.String password)
Used to configure BASIC authentication.default MutableHttpHeaders
contentType(MediaType mediaType)
Sets theHttpHeaders.CONTENT_TYPE
header to the given media type.default MutableHttpHeaders
date(long timeInMillis)
Adds the DATE header for the givenLong
.default MutableHttpHeaders
date(java.time.LocalDateTime date)
Adds the date header for the givenLocalDateTime
.default MutableHttpHeaders
expires(long timeInMillis)
Adds the EXPIRES header for the givenLong
.default MutableHttpHeaders
expires(java.time.LocalDateTime date)
Adds the EXPIRES header for the givenLocalDateTime
.default MutableHttpHeaders
ifModifiedSince(long timeInMillis)
Adds the IF_MODIFIED_SINCE header for the givenLong
.default MutableHttpHeaders
ifModifiedSince(java.time.LocalDateTime date)
Adds the IF_MODIFIED_SINCE header for the givenZonedDateTime
.default MutableHttpHeaders
lastModified(long timeInMillis)
Adds the LAST_MODIFIED header for the givenLong
.default MutableHttpHeaders
lastModified(java.time.LocalDateTime date)
Adds the LAST_MODIFIED header for the givenLocalDateTime
.default MutableHttpHeaders
location(java.net.URI uri)
Sets the location header to the given URI.MutableHttpHeaders
remove(java.lang.CharSequence header)
default io.micronaut.core.type.MutableHeaders
set(java.lang.CharSequence header, java.lang.CharSequence value)
-
Methods inherited from interface io.micronaut.core.convert.value.ConvertibleMultiValues
forEach, forEachValue, get, getAll, getFirst, getFirst, getFirst, getFirst, getFirst, isEmpty, iterator
-
Methods inherited from interface io.micronaut.core.convert.value.ConvertibleValues
asMap, asMap, asProperties, contains, getValue, getValueType, names, subMap, subMap, subMap, values
-
Methods inherited from interface io.micronaut.http.HttpHeaders
accept, contentLength, contentType, findDate, findFirst, findInt, getAuthorization, getContentType, getDate, getInt, getOrigin, isKeepAlive
-
-
-
-
Method Detail
-
add
MutableHttpHeaders add(java.lang.CharSequence header, java.lang.CharSequence value)
Add a header for the given name and value.- Specified by:
add
in interfaceio.micronaut.core.type.MutableHeaders
- Parameters:
header
- The header namevalue
- The value- Returns:
- This headers object
-
remove
MutableHttpHeaders remove(java.lang.CharSequence header)
- Specified by:
remove
in interfaceio.micronaut.core.type.MutableHeaders
-
set
default io.micronaut.core.type.MutableHeaders set(java.lang.CharSequence header, java.lang.CharSequence value)
- Specified by:
set
in interfaceio.micronaut.core.type.MutableHeaders
-
allow
default MutableHttpHeaders allow(HttpMethod... methods)
Set the allowed HTTP methods.- Parameters:
methods
- The methods to specify in the Allowed HTTP header- Returns:
- This HTTP headers
-
date
default MutableHttpHeaders date(java.time.LocalDateTime date)
Adds the date header for the givenLocalDateTime
.- Parameters:
date
- The local date time (assumed to represent system's default time-zoneZoneId.systemDefault()
, will be converted to GMT) as perDateTimeFormatter.RFC_1123_DATE_TIME
- Returns:
- The
MutableHttpHeaders
- See Also:
to set date time with time-zone.
-
expires
default MutableHttpHeaders expires(java.time.LocalDateTime date)
Adds the EXPIRES header for the givenLocalDateTime
.- Parameters:
date
- The local date time (assumed to represent system's default time-zoneZoneId.systemDefault()
, will be converted to GMT) as perDateTimeFormatter.RFC_1123_DATE_TIME
- Returns:
- The
MutableHttpHeaders
- See Also:
to set date time with time-zone.
-
lastModified
default MutableHttpHeaders lastModified(java.time.LocalDateTime date)
Adds the LAST_MODIFIED header for the givenLocalDateTime
.- Parameters:
date
- The local date time (assumed to represent system's default time-zoneZoneId.systemDefault()
, will be converted to GMT) as perDateTimeFormatter.RFC_1123_DATE_TIME
- Returns:
- The
MutableHttpHeaders
- See Also:
to set date time with time-zone.
-
ifModifiedSince
default MutableHttpHeaders ifModifiedSince(java.time.LocalDateTime date)
Adds the IF_MODIFIED_SINCE header for the givenZonedDateTime
.- Parameters:
date
- The local date time (assumed to represent system's default time-zoneZoneId.systemDefault()
, will be converted to GMT) as perDateTimeFormatter.RFC_1123_DATE_TIME
- Returns:
- The
MutableHttpHeaders
- See Also:
to set date time with time-zone.
-
date
default MutableHttpHeaders date(long timeInMillis)
Adds the DATE header for the givenLong
.- Parameters:
timeInMillis
- The time in milli seconds since Epoch.- Returns:
- The
MutableHttpHeaders
-
expires
default MutableHttpHeaders expires(long timeInMillis)
Adds the EXPIRES header for the givenLong
.- Parameters:
timeInMillis
- The time in milli seconds since Epoch.- Returns:
- The
MutableHttpHeaders
-
lastModified
default MutableHttpHeaders lastModified(long timeInMillis)
Adds the LAST_MODIFIED header for the givenLong
.- Parameters:
timeInMillis
- The time in milli seconds since Epoch.- Returns:
- The
MutableHttpHeaders
-
ifModifiedSince
default MutableHttpHeaders ifModifiedSince(long timeInMillis)
Adds the IF_MODIFIED_SINCE header for the givenLong
.- Parameters:
timeInMillis
- The time in milli seconds since Epoch.- Returns:
- The
MutableHttpHeaders
-
auth
default MutableHttpHeaders auth(java.lang.String username, java.lang.String password)
Used to configure BASIC authentication.- Parameters:
username
- The usernamepassword
- The password- Returns:
- This HTTP headers
-
auth
default MutableHttpHeaders auth(java.lang.String userInfo)
Used to configure BASIC authentication.- Parameters:
userInfo
- The user info which is in the form "username:password"- Returns:
- This HTTP headers
-
allow
default MutableHttpHeaders allow(java.util.Collection<HttpMethod> methods)
Set the allowed HTTP methods.- Parameters:
methods
- The methods to specify in the Allowed HTTP header- Returns:
- This HTTP headers
-
allowGeneric
default MutableHttpHeaders allowGeneric(java.util.Collection<? extends java.lang.CharSequence> methods)
Set the allowed HTTP methods.- Parameters:
methods
- The methods to specify in the Allowed HTTP header- Returns:
- This HTTP headers
-
location
default MutableHttpHeaders location(java.net.URI uri)
Sets the location header to the given URI.- Parameters:
uri
- The URI- Returns:
- This HTTP headers
-
contentType
default MutableHttpHeaders contentType(MediaType mediaType)
Sets theHttpHeaders.CONTENT_TYPE
header to the given media type.- Parameters:
mediaType
- The media type- Returns:
- This HTTP headers
-
add
default MutableHttpHeaders add(java.lang.CharSequence header, java.time.ZonedDateTime value)
Add a header for the given name and value.- Parameters:
header
- The header namevalue
- The value- Returns:
- This headers object
-
add
default MutableHttpHeaders add(java.lang.CharSequence header, java.lang.Integer value)
Add a header for the given name and value.- Parameters:
header
- The header namevalue
- The value- Returns:
- This headers object
-
-