org.restlet.engine.util
Class ConnegUtils

java.lang.Object
  extended by org.restlet.engine.util.ConnegUtils

public class ConnegUtils
extends Object

Content negotiation utilities.

Author:
Jerome Louvel

Method Summary
static
<T extends Metadata>
T
getPreferredMetadata(List<T> supported, List<Preference<T>> preferences)
          Returns the preferred metadata taking into account both metadata supported by the server and client preferences.
static Variant getPreferredVariant(ClientInfo clientInfo, List<? extends Variant> variants, 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPreferredMetadata

public static <T extends Metadata> T getPreferredMetadata(List<T> supported,
                                                          List<Preference<T>> preferences)
Returns the preferred metadata taking into account both metadata supported by the server and client preferences.

Parameters:
supported - The metadata supported by the server.
preferences - The client preferences.
Returns:
The preferred metadata.

getPreferredVariant

public static Variant getPreferredVariant(ClientInfo clientInfo,
                                          List<? extends Variant> variants,
                                          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:
clientInfo - The client preferences.
variants - The list of variants to compare.
metadataService - The metadata service.
Returns:
The preferred variant.
See Also:
Apache content negotiation algorithm


Copyright © 2005-2011 Noelios Technologies.