Package org.restlet.service
Class ConnegService
java.lang.Object
org.restlet.service.Service
org.restlet.service.ConnegService
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetPreferredVariant(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.booleanisStrict()Indicates if the conneg algorithm should strictly respect client preferences or be more flexible.voidsetStrict(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
-
Constructor Details
-
ConnegService
public ConnegService()Constructor. -
ConnegService
public ConnegService(boolean enabled) Constructor.- Parameters:
enabled- True if the service has been enabled.
-
-
Method Details
-
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:
-
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.
-