Package org.restlet.engine.application
Class Decoder
- java.lang.Object
-
- org.restlet.Restlet
-
- org.restlet.routing.Filter
-
- org.restlet.engine.application.Decoder
-
- All Implemented Interfaces:
Uniform
public class Decoder extends Filter
Filter uncompressing entities. Concurrency note: instances of this class or its subclasses can be invoked by several threads at the same time and therefore must be thread-safe. You should be especially careful when storing state in member variables.
-
-
Field Summary
Fields Modifier and Type Field Description private booleandecodingRequestIndicates if the request entity should be decoded.private booleandecodingResponseIndicates if the response entity should be decoded.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterHandle(Request request, Response response)Allows filtering after its handling by the target Restlet.intbeforeHandle(Request request, Response response)Allows filtering before its handling by the target Restlet.booleancanDecode(Representation representation)Indicates if a representation can be decoded.Representationdecode(Representation representation)Decodes a given representation if its encodings are supported by NRE.booleanisDecodingRequest()Indicates if the request entity should be decoded.booleanisDecodingResponse()Indicates if the response entity should be decoded.-
Methods inherited from class org.restlet.routing.Filter
doHandle, getNext, handle, hasNext, setNext, setNext, start, stop
-
Methods inherited from class org.restlet.Restlet
createFinder, finalize, getApplication, getAuthor, getContext, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setContext, setDescription, setFinderClass, setName, setOwner
-
-
-
-
Constructor Detail
-
Decoder
public Decoder(Context context)
Constructor to only decode request entities before handling.- Parameters:
context- The context.
-
Decoder
public Decoder(Context context, boolean decodingRequest, boolean decodingResponse)
Constructor.- Parameters:
context- The context.decodingRequest- Indicates if the request entity should be decoded.decodingResponse- Indicates if the response entity should be decoded.
-
-
Method Detail
-
afterHandle
public void afterHandle(Request request, Response response)
Allows filtering after its handling by the target Restlet. Does nothing by default.- Overrides:
afterHandlein classFilter- Parameters:
request- The request to filter.response- The response to filter.
-
beforeHandle
public int beforeHandle(Request request, Response response)
Allows filtering before its handling by the target Restlet. Does nothing by default.- Overrides:
beforeHandlein classFilter- Parameters:
request- The request to filter.response- The response to filter.- Returns:
- The continuation status.
-
canDecode
public boolean canDecode(Representation representation)
Indicates if a representation can be decoded.- Parameters:
representation- The representation to test.- Returns:
- True if the call can be decoded.
-
decode
public Representation decode(Representation representation)
Decodes a given representation if its encodings are supported by NRE.- Parameters:
representation- The representation to encode.- Returns:
- The decoded representation or the original one if the encoding isn't supported by NRE.
-
isDecodingRequest
public boolean isDecodingRequest()
Indicates if the request entity should be decoded.- Returns:
- True if the request entity should be decoded.
-
isDecodingResponse
public boolean isDecodingResponse()
Indicates if the response entity should be decoded.- Returns:
- True if the response entity should be decoded.
-
-