Package ratpack.http
Interface Headers
-
- All Known Subinterfaces:
MutableHeaders
public interface HeadersAn immutable set of HTTP headers.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description MultiValueMap<java.lang.String,java.lang.String>asMultiValueMap()booleancontains(java.lang.CharSequence name)Checks whether a header has been specified for the given value.booleancontains(java.lang.String name)Checks whether a header has been specified for the given value.java.lang.Stringget(java.lang.CharSequence name)Returns the header value with the specified header name.java.lang.Stringget(java.lang.String name)Returns the header value with the specified header name.java.util.List<java.lang.String>getAll(java.lang.CharSequence name)Returns all of the header values with the specified header name.java.util.List<java.lang.String>getAll(java.lang.String name)Returns all of the header values with the specified header name.java.util.DategetDate(java.lang.CharSequence name)Returns the header value as a date with the specified header name.java.util.DategetDate(java.lang.String name)Returns the header value as a date with the specified header name.default java.time.InstantgetInstant(java.lang.CharSequence name)Returns the header value as an instant with the specified header name.java.util.Set<java.lang.String>getNames()All header names.io.netty.handler.codec.http.HttpHeadersgetNettyHeaders()Returns the headers in their Netty compliant form.
-
-
-
Method Detail
-
get
@Nullable java.lang.String get(java.lang.CharSequence name)
Returns the header value with the specified header name.If there is more than one header value for the specified header name, the first value is returned.
- Parameters:
name- The case insensitive name of the header to get retrieve the first value of- Returns:
- the header value or
nullif there is no such header
-
get
@Nullable java.lang.String get(java.lang.String name)
Returns the header value with the specified header name.If there is more than one header value for the specified header name, the first value is returned.
- Parameters:
name- The case insensitive name of the header to get retrieve the first value of- Returns:
- the header value or
nullif there is no such header
-
getDate
@Nullable java.util.Date getDate(java.lang.CharSequence name)
Returns the header value as a date with the specified header name.If there is more than one header value for the specified header name, the first value is returned.
- Parameters:
name- The case insensitive name of the header to get retrieve the first value of- Returns:
- the header value as a date or
nullif there is no such header or the header value is not a valid date format
-
getInstant
@Nullable default java.time.Instant getInstant(java.lang.CharSequence name)
Returns the header value as an instant with the specified header name.If there is more than one header value for the specified header name, the first value is returned.
- Parameters:
name- the case insensitive name of the header to get retrieve the first value of- Returns:
- the header value as an instant or
nullif there is no such header or the header value is not a valid date format - Since:
- 1.4
-
getDate
@Nullable java.util.Date getDate(java.lang.String name)
Returns the header value as a date with the specified header name.If there is more than one header value for the specified header name, the first value is returned.
- Parameters:
name- The case insensitive name of the header to get retrieve the first value of- Returns:
- the header value as a date or
nullif there is no such header or the header value is not a valid date format
-
getAll
java.util.List<java.lang.String> getAll(java.lang.CharSequence name)
Returns all of the header values with the specified header name.- Parameters:
name- The case insensitive name of the header to retrieve all of the values of- Returns:
- the
Listof header values, or an empty list if there is no such header
-
getAll
java.util.List<java.lang.String> getAll(java.lang.String name)
Returns all of the header values with the specified header name.- Parameters:
name- The case insensitive name of the header to retrieve all of the values of- Returns:
- the
Listof header values, or an empty list if there is no such header
-
contains
boolean contains(java.lang.CharSequence name)
Checks whether a header has been specified for the given value.- Parameters:
name- The name of the header to check the existence of- Returns:
- True if there is a header with the specified header name
-
contains
boolean contains(java.lang.String name)
Checks whether a header has been specified for the given value.- Parameters:
name- The name of the header to check the existence of- Returns:
- True if there is a header with the specified header name
-
getNames
java.util.Set<java.lang.String> getNames()
All header names.- Returns:
- The names of all headers that were sent
-
getNettyHeaders
io.netty.handler.codec.http.HttpHeaders getNettyHeaders()
Returns the headers in their Netty compliant form.Use of this method should be avoided, in favor of using the other methods of this interface.
- Returns:
- the headers in their Netty compliant form
-
asMultiValueMap
MultiValueMap<java.lang.String,java.lang.String> asMultiValueMap()
-
-