org.restlet.engine.application
Class Conneg

java.lang.Object
  extended by org.restlet.engine.application.Conneg
Direct Known Subclasses:
StrictConneg

public abstract class Conneg
extends Object

Content negotiation algorithm.

Author:
Jerome Louvel

Constructor Summary
Conneg(Request request, MetadataService metadataService)
          Constructor.
 
Method Summary
 Variant getPreferredVariant(List<? extends Variant> variants)
          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.
 Request getRequest()
          Returns the request including client preferences.
abstract  float scoreVariant(Variant variant)
          Scores a variant relatively to enriched client preferences.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Conneg

public Conneg(Request request,
              MetadataService metadataService)
Constructor.

Parameters:
request - The request including client preferences.
metadataService - The metadata service used to get default metadata values.
Method Detail

getRequest

public Request getRequest()
Returns the request including client preferences.

Returns:
The request including client preferences.

getPreferredVariant

public Variant getPreferredVariant(List<? extends Variant> variants)
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.
Returns:
The preferred variant.
See Also:
Apache content negotiation algorithm

scoreVariant

public abstract float scoreVariant(Variant variant)
Scores a variant relatively to enriched client preferences.

Parameters:
variant - The variant to score.
Returns:
The enriched client preferences.


Copyright © 2005-2013 Restlet.