Restlet Framework 2.2 Snapshot
OSGi Environments

org.restlet.service
Class EncoderService

java.lang.Object
  extended by org.restlet.service.Service
      extended by org.restlet.service.EncoderService

public class EncoderService
extends Service

Application service automatically encoding or compressing request entities.

Author:
Jerome Louvel

Field Summary
static int ANY_SIZE
          Indicates if the encoding should always occur, regardless of the size.
static int DEFAULT_MINIMUM_SIZE
          Indicates if the default minimum size for encoding to occur.
 
Constructor Summary
EncoderService()
          Constructor.
EncoderService(boolean enabled)
          Constructor.
 
Method Summary
 boolean canEncode(Representation representation)
          Indicates if a representation can be encoded.
 Filter createInboundFilter(Context context)
          Create the filter that should be invoked for incoming calls.
 Filter createOutboundFilter(Context context)
          Create the filter that should be invoked for outgoing calls.
 List<MediaType> getAcceptedMediaTypes()
          Returns the media types that should be encoded.
static List<MediaType> getDefaultAcceptedMediaTypes()
          Returns the list of default encoded media types.
static List<MediaType> getDefaultIgnoredMediaTypes()
          Returns the list of default ignored media types.
 List<MediaType> getIgnoredMediaTypes()
          Returns the media types that should be ignored.
 long getMinimumSize()
          Returns the minimum size a representation must have before compression is done.
 void setMinimumSize(long mininumSize)
          Sets the minimum size a representation must have before compression is done.
 
Methods inherited from class org.restlet.service.Service
getContext, isEnabled, isStarted, isStopped, setContext, setEnabled, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANY_SIZE

public static final int ANY_SIZE
Indicates if the encoding should always occur, regardless of the size.

See Also:
Constant Field Values

DEFAULT_MINIMUM_SIZE

public static final int DEFAULT_MINIMUM_SIZE
Indicates if the default minimum size for encoding to occur.

See Also:
Constant Field Values
Constructor Detail

EncoderService

public EncoderService()
Constructor.


EncoderService

public EncoderService(boolean enabled)
Constructor. The default minimum size

Parameters:
enabled - True if the service has been enabled.
Method Detail

getDefaultAcceptedMediaTypes

public static List<MediaType> getDefaultAcceptedMediaTypes()
Returns the list of default encoded media types. This can be overridden by subclasses. By default, all media types are encoded (except those explicitly ignored).

Returns:
The list of default encoded media types.

getDefaultIgnoredMediaTypes

public static List<MediaType> getDefaultIgnoredMediaTypes()
Returns the list of default ignored media types. This can be overridden by subclasses. By default, all archive, audio, image and video media types are ignored.

Returns:
The list of default ignored media types.

canEncode

public boolean canEncode(Representation representation)
Indicates if a representation can be encoded.

Parameters:
representation - The representation to test.
Returns:
True if the call can be encoded.

createInboundFilter

public Filter createInboundFilter(Context context)
Description copied from class: Service
Create the filter that should be invoked for incoming calls.

Overrides:
createInboundFilter in class Service
Parameters:
context - The current context.
Returns:
The new filter or null.

createOutboundFilter

public Filter createOutboundFilter(Context context)
Description copied from class: Service
Create the filter that should be invoked for outgoing calls.

Overrides:
createOutboundFilter in class Service
Parameters:
context - The current context.
Returns:
The new filter or null.
See Also:
Context.getClientDispatcher()

getAcceptedMediaTypes

public List<MediaType> getAcceptedMediaTypes()
Returns the media types that should be encoded.

Returns:
The media types that should be encoded.

getIgnoredMediaTypes

public List<MediaType> getIgnoredMediaTypes()
Returns the media types that should be ignored.

Returns:
The media types that should be ignored.

getMinimumSize

public long getMinimumSize()
Returns the minimum size a representation must have before compression is done.

Returns:
The minimum size a representation must have before compression is done.

setMinimumSize

public void setMinimumSize(long mininumSize)
Sets the minimum size a representation must have before compression is done.

Parameters:
mininumSize - The minimum size a representation must have before compression is done.

Restlet Framework 2.2 Snapshot
OSGi Environments

Copyright © 2005-2014 Restlet.