public abstract class RequestTransformation<A,B> extends Object implements Request<B>
Request
<A>
into a Request
<B>
to allow parsing of the raw response to create a B
.
This is useful for extending standard request classes with a different response type.Constructor and Description |
---|
RequestTransformation(Request<A> a) |
Modifier and Type | Method and Description |
---|---|
String |
getBody()
Value of the request body.
|
Map<String,?> |
getBodyAsMap()
Value of the request body as a Map.
|
String |
getEndpoint()
Path and query parameters of a URL.
|
Map<String,String> |
getHeaders()
Map of request-specific HTTP headers. |
Http.Method |
getHttpMethod()
HTTP method.
|
abstract B |
getResponse(byte[] bytes,
int status,
Map<String,String> responseHeaders)
Response handler.
|
Http.Accept |
getResponseType()
HTTP Accept header.
|
boolean |
hasBody()
Whether or not the request has a body.
|
public Http.Method getHttpMethod()
Request
getHttpMethod
in interface Request<B>
public String getEndpoint()
Request
getEndpoint
in interface Request<B>
public boolean hasBody()
Request
public String getBody()
Request
public Map<String,?> getBodyAsMap()
Request
getBodyAsMap
in interface Request<B>
public Http.Accept getResponseType()
Request
getResponseType
in interface Request<B>
Http.Accept
public Map<String,String> getHeaders()
Request
Map
of request-specific HTTP headers.getHeaders
in interface Request<B>
public abstract B getResponse(byte[] bytes, int status, Map<String,String> responseHeaders)
Request
getResponse
in interface Request<B>
bytes
- Data returned from the request.status
- HTTP status code.T
as specified by an individual request.Copyright © 2017. All rights reserved.