Package be.wegenenverkeer.rxhttpclient
Interface ServerResponseHeaders
-
- All Superinterfaces:
ServerResponseElement
- All Known Implementing Classes:
ServerResponse,ServerResponseHeadersImpl
public interface ServerResponseHeaders extends ServerResponseElement
The headers of an HTTP responseCreated by Karel Maesen, Geovise BVBA on 18/12/14.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.Optional<java.lang.String>getContentType()Returns some Content-Type if present in response header, None otherwisejava.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 headersjava.util.List<java.lang.String>getHeaders(java.lang.String name)Returns the HTTP Response header values for the specified header name.default <T> Tmatch(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.
-
-
-
Method Detail
-
getHeaders
java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()
Returns all response headers- Returns:
- all response headers
-
getContentType
java.util.Optional<java.lang.String> getContentType()
Returns some Content-Type if present in response header, None otherwise- Returns:
- some Content-Type if present in response header, None otherwise
-
getHeaders
java.util.List<java.lang.String> getHeaders(java.lang.String name)
Returns the HTTP Response header values for the specified header name.- Parameters:
name- the header name- Returns:
- the HTTP Response header values for the specified header name.
-
getHeader
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.- Parameters:
name- header name to look up.- Returns:
- some value for the specified header name, or None if not present in the response headers.
-
match
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.This uses a condensed form of the Visitor pattern.
- Specified by:
matchin interfaceServerResponseElement- Type Parameters:
T- the return type of all matcher functions- Parameters:
matchStatus- the function to invoke when this instance is aServerResponseStatusmatchHeaders- the function to invoke when this instance is aServerResponseHeadersmatchBodyPart- the function to invoke when this instance is aServerResponseBodyPartmatchServerResponse- the function to invoke when this instance is aServerResponse- Returns:
- the result of the matcher function that matches this instance type
-
-