com.noelios.restlet.application
Class Decoder

java.lang.Object
  extended by org.restlet.Uniform
      extended by org.restlet.Restlet
          extended by org.restlet.Filter
              extended by com.noelios.restlet.application.Decoder

public class Decoder
extends Filter

Filter decompressing 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.Filter
CONTINUE, SKIP, STOP
 
Constructor Summary
Decoder(Context context)
          Constructor to only decode request entities before handling.
Decoder(Context context, boolean decodeRequest, boolean decodeResponse)
          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 isDecodeRequest()
          Indicates if the request entity should be decoded.
 boolean isDecodeResponse()
          Indicates if the response entity should be decoded.
 void setDecodeRequest(boolean decodeRequest)
          Indicates if the request entity should be decoded.
 void setDecodeResponse(boolean decodeResponse)
          Indicates if the response entity should be decoded.
 
Methods inherited from class org.restlet.Filter
doHandle, getNext, handle, hasNext, setNext, setNext
 
Methods inherited from class org.restlet.Restlet
getApplication, getContext, getLogger, init, isStarted, isStopped, setContext, start, stop
 
Methods inherited from class org.restlet.Uniform
delete, delete, get, get, handle, head, head, options, options, post, post, put, put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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 decodeRequest,
               boolean decodeResponse)
Constructor.

Parameters:
context - The context.
decodeRequest - Indicates if the request entity should be decoded.
decodeResponse - 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.

isDecodeRequest

public boolean isDecodeRequest()
Indicates if the request entity should be decoded.

Returns:
True if the request entity should be decoded.

isDecodeResponse

public boolean isDecodeResponse()
Indicates if the response entity should be decoded.

Returns:
True if the response entity should be decoded.

setDecodeRequest

public void setDecodeRequest(boolean decodeRequest)
Indicates if the request entity should be decoded.

Parameters:
decodeRequest - True if the request entity should be decoded.

setDecodeResponse

public void setDecodeResponse(boolean decodeResponse)
Indicates if the response entity should be decoded.

Parameters:
decodeResponse - True if the response entity should be decoded.


Copyright © 2005-2008 Noelios Technologies.