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.
Author:
Jerome Louvel
  • Constructor Details

    • 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 Details

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