public interface ServerResponseHeaders extends ServerResponseElement
| Modifier and Type | Method and Description |
|---|---|
java.util.Optional<java.lang.String> |
getContentType()
Returns some Content-Type if present in response header, None otherwise
|
java.util.Optional<java.lang.String> |
getHeader(java.lang.String name)
Returns some value for the specified header name, or None if not present in the response headers.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getHeaders()
Returns all response headers
|
java.util.List<java.lang.String> |
getHeaders(java.lang.String name)
Returns the HTTP Response header values for the specified header name.
|
default <T> T |
match(java.util.function.Function<ServerResponseStatus,T> matchStatus,
java.util.function.Function<ServerResponseHeaders,T> matchHeaders,
java.util.function.Function<ServerResponseBodyPart,T> matchBodyPart,
java.util.function.Function<ServerResponse,T> matchServerResponse)
Apply a function on this instance, depending on its type.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()
java.util.Optional<java.lang.String> getContentType()
java.util.List<java.lang.String> getHeaders(java.lang.String name)
name - the header namejava.util.Optional<java.lang.String> getHeader(java.lang.String name)
name - header name to look up.default <T> T match(java.util.function.Function<ServerResponseStatus,T> matchStatus, java.util.function.Function<ServerResponseHeaders,T> matchHeaders, java.util.function.Function<ServerResponseBodyPart,T> matchBodyPart, java.util.function.Function<ServerResponse,T> matchServerResponse)
This uses a condensed form of the Visitor pattern.
match in interface ServerResponseElementT - the return type of all matcher functionsmatchStatus - the function to invoke when this instance is a ServerResponseStatusmatchHeaders - the function to invoke when this instance is a ServerResponseHeadersmatchBodyPart - the function to invoke when this instance is a ServerResponseBodyPartmatchServerResponse - the function to invoke when this instance is a ServerResponse