public abstract class BaseTransformer extends Object implements ResponseTransformer
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
log |
protected int |
priority |
protected Set<MediaType> |
supportedTypes |
| Constructor and Description |
|---|
BaseTransformer() |
| Modifier and Type | Method and Description |
|---|---|
void |
addSupportedTypes(MediaType... type)
Adds one or more
MediaTypes |
boolean |
canTransform(Object response,
HttpRequest request,
MediaType mediaType,
HttpMethod method,
io.netty.channel.ChannelHandlerContext ctx)
Determines if, given the response object and the media types accepted by the client this
transformer can convert the response object into one of the accepted types
|
int |
compareTo(ResponseTransformer that) |
protected void |
determineErrorStatus(HttpResponse res,
Throwable response) |
protected boolean |
isError(Object response) |
boolean |
isStaticFileResponse(Object response)
Checks if a the given object is one of the types considered to be a static file response.
|
boolean |
mediaTypeMatches(HttpRequest request)
Checks if the this transformer supports the
MediaTypes supported by the
request. |
int |
priority() |
int |
setPriority(int value) |
protected void |
setResponseContent(HttpResponse res,
byte[] data) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinstance, transformprotected void setResponseContent(HttpResponse res, byte[] data)
protected void determineErrorStatus(HttpResponse res, Throwable response)
public int setPriority(int value)
setPriority in interface Sortable<ResponseTransformer>public int priority()
priority in interface Sortable<ResponseTransformer>public int compareTo(ResponseTransformer that)
compareTo in interface Comparable<ResponseTransformer>public boolean canTransform(Object response, HttpRequest request, MediaType mediaType, HttpMethod method, io.netty.channel.ChannelHandlerContext ctx)
ResponseTransformercanTransform in interface ResponseTransformerresponse - the response object that would need to be transformedrequest - the request which generated the responsemediaType - The media type which matched in the HttpMethod's produces AND in the client
set of accepted media types.public boolean mediaTypeMatches(HttpRequest request)
MediaTypes supported by the
request.request - the request to check against this transformer's supported typesprotected boolean isError(Object response)
public boolean isStaticFileResponse(Object response)
File|ResolvedFile|InputStream|Pathresponse - the response object to checkCopyright © 2012-2015. All Rights Reserved.