org.restlet.engine.application
Class Decoder

java.lang.Object
  extended by org.restlet.Restlet
      extended by org.restlet.routing.Filter
          extended by 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.

Author:
Jerome Louvel

Field Summary
 
Fields inherited from class org.restlet.routing.Filter
CONTINUE, SKIP, STOP
 
Constructor Summary
Decoder(Context context)
          Constructor to only decode request entities before handling.
Decoder(Context context, boolean decodingRequest, boolean decodingResponse)
          Constructor.
 
Method Summary
 void afterHandle(Request request, Response response)
          Allows filtering after its handling by the target Restlet.
 int beforeHandle(Request request, Response response)
          Allows filtering before its handling by the target Restlet.
 boolean canDecode(Representation representation)
          Indicates if a representation can be decoded.
 Representation decode(Representation representation)
          Decodes a given representation if its encodings are supported by NRE.
 boolean isDecodingRequest()
          Indicates if the request entity should be decoded.
 boolean isDecodingResponse()
          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
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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:
afterHandle in class Filter
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:
beforeHandle in class Filter
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.


Copyright © 2005-2013 Restlet.