public class Encoder extends Filter
Representation
has an unknown size,
it will always be a candidate for encoding. Candidate representations need to
respect media type criteria by the lists of accepted and ignored media types.
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.Constructor and Description |
---|
Encoder(Context context,
boolean encodingRequest,
boolean encodingResponse,
EncoderService encoderService)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
Representation |
encode(ClientInfo client,
Representation representation)
Encodes a given representation if an encoding is supported by the client.
|
Encoding |
getBestEncoding(ClientInfo client)
Returns the best supported encoding for a given client.
|
EncoderService |
getEncoderService()
Returns the parent encoder service.
|
java.util.List<Encoding> |
getSupportedEncodings()
Returns the list of supported encodings.
|
boolean |
isEncodingRequest()
Indicates if the request entity should be encoded.
|
boolean |
isEncodingResponse()
Indicates if the response entity should be encoded.
|
doHandle, getNext, handle, hasNext, setNext, setNext, start, stop
createFinder, finalize, getApplication, getAuthor, getContext, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setContext, setDescription, setFinderClass, setName, setOwner
public Encoder(Context context, boolean encodingRequest, boolean encodingResponse, EncoderService encoderService)
context
- The context.encodingRequest
- Indicates if the request entities should be encoded.encodingResponse
- Indicates if the response entities should be encoded.encoderService
- The parent encoder service.public void afterHandle(Request request, Response response)
afterHandle
in class Filter
request
- The request to filter.response
- The response to filter.public int beforeHandle(Request request, Response response)
beforeHandle
in class Filter
request
- The request to filter.response
- The response to filter.public Representation encode(ClientInfo client, Representation representation)
client
- The client preferences to use.representation
- The representation to encode.public Encoding getBestEncoding(ClientInfo client)
client
- The client preferences to use.public EncoderService getEncoderService()
public java.util.List<Encoding> getSupportedEncodings()
EncodeRepresentation.getSupportedEncodings()
static method.public boolean isEncodingRequest()
public boolean isEncodingResponse()
Copyright © 2005-2024 Restlet.