public interface ResponseTransformer extends Sortable<ResponseTransformer>
TreeSet of transformers. The first transformer returned is of the highest
priority according to the sorted set. That transformer can decide to try using another
transformer but the server will always use the first one returned by the queue (which is the last one added...).| Modifier and Type | Method and Description |
|---|---|
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
|
ResponseTransformer |
instance() |
void |
transform(Object response,
HttpRequest request,
HttpResponse httpResponse,
MediaType mediaType,
HttpMethod method,
io.netty.channel.ChannelHandlerContext ctx)
Given the response object transform it into one of the accepted media types
|
priority, setPrioritycompareToboolean canTransform(Object response, HttpRequest request, MediaType mediaType, HttpMethod method, io.netty.channel.ChannelHandlerContext ctx)
response - 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.void transform(Object response, HttpRequest request, HttpResponse httpResponse, MediaType mediaType, HttpMethod method, io.netty.channel.ChannelHandlerContext ctx)
response - the response object to be transformedrequest - the request which generated the responsehttpResponse - the HTTP response which will be returned to the clientmethod - The method which was invoked to produce the responsectx - the channel context, provided in the case where an unrecoverable error is
encountered an error response can be returned by by passing the normal response
route @return an HTTP response. If null is returned the server will return
406 Not Acceptable to the client...
(i.e. The requested resource is only capable of generating content not acceptable
according to the Accept headers sent in the request.)ResponseTransformer instance()
Copyright © 2012-2015. All Rights Reserved.