Class Conneg

  • Direct Known Subclasses:
    StrictConneg

    public abstract class Conneg
    extends java.lang.Object
    Content negotiation algorithm.
    Author:
    Jerome Louvel
    • Constructor Summary

      Constructors 
      Constructor Description
      Conneg​(org.restlet.Request request, org.restlet.service.MetadataService metadataService)
      Constructor.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      org.restlet.representation.Variant getPreferredVariant​(java.util.List<? extends org.restlet.representation.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.
      org.restlet.Request getRequest()
      Returns the request including client preferences.
      abstract float scoreVariant​(org.restlet.representation.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​(org.restlet.Request request,
                      org.restlet.service.MetadataService metadataService)
        Constructor.
        Parameters:
        request - The request including client preferences.
        metadataService - The metadata service used to get default metadata values.
    • Method Detail

      • getRequest

        public org.restlet.Request getRequest()
        Returns the request including client preferences.
        Returns:
        The request including client preferences.
      • getPreferredVariant

        public org.restlet.representation.Variant getPreferredVariant​(java.util.List<? extends org.restlet.representation.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​(org.restlet.representation.Variant variant)
        Scores a variant relatively to enriched client preferences.
        Parameters:
        variant - The variant to score.
        Returns:
        The enriched client preferences.