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 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.routing.Filter

`CONTINUE, SKIP, STOP`

### Constructor Summary

Constructors
Constructor and Description
`Decoder(Context context)` Constructor to only decode request entities before handling.
`Decoder(Context context, boolean decodingRequest, boolean decodingResponse)` Constructor.

### Method Summary

Methods
`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()` Deprecated. Use `isDecodingRequest()` instead.
`boolean` `isDecodeResponse()` Deprecated. Use `isDecodingResponse()` instead.
`boolean` `isDecodingRequest()` Indicates if the request entity should be decoded.
`boolean` `isDecodingResponse()` Indicates if the response entity should be decoded.
`void` `setDecodeRequest(boolean decodingRequest)` Deprecated. Use `setDecodingRequest(boolean)` instead.
`void` `setDecodeResponse(boolean decodingResponse)` Deprecated. Use `setDecodingResponse(boolean)` instead.
`void` `setDecodingRequest(boolean decodingRequest)` Indicates if the request entity should be decoded.
`void` `setDecodingResponse(boolean decodingResponse)` 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

`finalize, getApplication, getAuthor, getContext, getDescription, getLogger, getName, getOwner, isStarted, isStopped, setAuthor, setContext, setDescription, 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.

#### isDecodeRequest

    @Deprecated
    public boolean isDecodeRequest()

Deprecated. Use `isDecodingRequest()` instead.
Indicates if the request entity should be decoded.

Returns:
  True if the request entity should be decoded.

#### isDecodeResponse

    @Deprecated
    public boolean isDecodeResponse()

Deprecated. Use `isDecodingResponse()` instead.
Indicates if the response entity should be decoded.

Returns:
  True if the response entity should be decoded.

#### 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.

#### setDecodeRequest

    @Deprecated
    public void setDecodeRequest(boolean decodingRequest)

Deprecated. Use `setDecodingRequest(boolean)` instead.
Indicates if the request entity should be decoded.

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

#### setDecodeResponse

    @Deprecated
    public void setDecodeResponse(boolean decodingResponse)

Deprecated. Use `setDecodingResponse(boolean)` instead.
Indicates if the response entity should be decoded.

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

#### setDecodingRequest

    public void setDecodingRequest(boolean decodingRequest)

Indicates if the request entity should be decoded.

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

#### setDecodingResponse

    public void setDecodingResponse(boolean decodingResponse)

Indicates if the response entity should be decoded.

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