org.restlet.service
Class ConnegService

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

public class ConnegService
extends Service

Application service negotiating the preferred resource variants. This service is leveraged by server-side and client-side content negotiation, annotated method dispatching, and so on.

Author:
Jerome Louvel

Constructor Summary
ConnegService()
          Constructor.
ConnegService(boolean enabled)
          Constructor.
 
Method Summary
 Variant getPreferredVariant(List<? extends Variant> variants, Request request, MetadataService metadataService)
          Returns the best variant representation for a given resource according the the client preferences.
A default language is provided in case the variants don't match the client preferences.
 boolean isStrict()
          Indicates if the conneg algorithm should strictly respect client preferences or be more flexible.
 void setStrict(boolean strict)
          Indicates if the conneg algorithm should strictly respect client preferences or be more flexible.
 
Methods inherited from class org.restlet.service.Service
createInboundFilter, createOutboundFilter, 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
 

Constructor Detail

ConnegService

public ConnegService()
Constructor.


ConnegService

public ConnegService(boolean enabled)
Constructor.

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

getPreferredVariant

public Variant getPreferredVariant(List<? extends Variant> variants,
                                   Request request,
                                   MetadataService metadataService)
Returns the best variant representation for a given resource according the the client preferences.
A default language is provided in case the variants don't match the client preferences.

Parameters:
variants - The list of variants to compare.
request - The request including client preferences.
metadataService - The metadata service used to get default metadata values.
Returns:
The preferred variant.
See Also:
Apache content negotiation algorithm

isStrict

public boolean isStrict()
Indicates if the conneg algorithm should strictly respect client preferences or be more flexible. Value is false by default.

Returns:
True if the conneg algorithm should strictly respect client preferences.

setStrict

public void setStrict(boolean strict)
Indicates if the conneg algorithm should strictly respect client preferences or be more flexible.

Parameters:
strict - True if the conneg algorithm should strictly respect client preferences.


Copyright © 2005-2013 Restlet.