org.restlet.engine.util

## Class ConnegUtils

- java.lang.Object
- - org.restlet.engine.util.ConnegUtils

    public class ConnegUtils
    extends java.lang.Object

Content negotiation utilities.

Author:
  Jerome Louvel

### Method Summary

Methods
`static <T extends Metadata> T` `getPreferredMetadata(java.util.List<T> supported, java.util.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, java.util.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(java.util.List<T> supported,
                                              java.util.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,
                              java.util.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