|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.engine.util.Conneg
public class Conneg
Content negotiation algorithm.
Constructor Summary | |
---|---|
Conneg(ClientInfo clientInfo,
MetadataService metadataService)
Constructor. |
Method Summary | ||
---|---|---|
protected List<Preference<CharacterSet>> |
getCharacterSetPrefs()
Returns the enriched list of character set preferences. |
|
protected ClientInfo |
getClientInfo()
Returns the client preferences. |
|
protected List<Preference<Encoding>> |
getEncodingPrefs()
Returns the enriched list of encoding preferences. |
|
protected
|
getEnrichedPreferences(List<Preference<T>> userPreferences,
T defaultValue,
T allValue)
Returns an enriched list of preferences. |
|
protected List<Preference<Language>> |
getLanguagePrefs()
Returns the enriched list of language preferences. |
|
protected List<Preference<MediaType>> |
getMediaTypePrefs()
Returns the enriched list of media type preferences. |
|
protected MetadataService |
getMetadataService()
Returns the metadata service. |
|
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. |
|
float |
scoreCharacterSet(CharacterSet characterSet)
Scores a character set relatively to enriched client preferences. |
|
float |
scoreEncodings(List<Encoding> encodings)
Scores encodings relatively to enriched client preferences. |
|
float |
scoreLanguages(List<Language> languages)
Scores languages relatively to enriched client preferences. |
|
float |
scoreMediaType(MediaType mediaType)
Scores a media type relatively to enriched client preferences. |
|
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 |
---|
public Conneg(ClientInfo clientInfo, MetadataService metadataService)
clientInfo
- metadataService
- Method Detail |
---|
protected List<Preference<CharacterSet>> getCharacterSetPrefs()
protected ClientInfo getClientInfo()
protected List<Preference<Encoding>> getEncodingPrefs()
protected <T extends Metadata> List<Preference<T>> getEnrichedPreferences(List<Preference<T>> userPreferences, T defaultValue, T allValue)
T
- userPreferences
- The user preferences to enrich.defaultValue
- The default value.allValue
- The ALL value.
protected List<Preference<Language>> getLanguagePrefs()
protected List<Preference<MediaType>> getMediaTypePrefs()
protected MetadataService getMetadataService()
public Variant getPreferredVariant(List<? extends Variant> variants)
variants
- The list of variants to compare.
public float scoreCharacterSet(CharacterSet characterSet)
characterSet
- The character set to score.
public float scoreEncodings(List<Encoding> encodings)
encodings
- The encodings to score.
public float scoreLanguages(List<Language> languages)
languages
- The languages to score.
public float scoreMediaType(MediaType mediaType)
mediaType
- The media type to score.
public float scoreVariant(Variant variant)
variant
- The variant to score.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |