Class MediaTypeNegotiator

java.lang.Object
org.apache.pekko.http.scaladsl.server.MediaTypeNegotiator

public final class MediaTypeNegotiator extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    MediaTypeNegotiator(scala.collection.immutable.Seq<HttpHeader> requestHeaders)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    scala.collection.immutable.List<MediaRange>
    The media-ranges accepted by the client according to the given request headers, sorted by 1. increasing generality (i.e. most specific first) 2. decreasing q-value (only for ranges targeting a single MediaType) 3. order of appearance in the Accept header(s)
    boolean
    isAccepted(MediaType mediaType)
    Determines whether the given pekko.http.scaladsl.model.MediaType is accepted by the client.
    float
    qValueFor(MediaType mediaType)
    Returns the q-value that the client (implicitly or explicitly) attaches to the given media-type.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MediaTypeNegotiator

      public MediaTypeNegotiator(scala.collection.immutable.Seq<HttpHeader> requestHeaders)
  • Method Details

    • acceptedMediaRanges

      public scala.collection.immutable.List<MediaRange> acceptedMediaRanges()
      The media-ranges accepted by the client according to the given request headers, sorted by 1. increasing generality (i.e. most specific first) 2. decreasing q-value (only for ranges targeting a single MediaType) 3. order of appearance in the Accept header(s)
      Returns:
      (undocumented)
    • isAccepted

      public boolean isAccepted(MediaType mediaType)
      Determines whether the given pekko.http.scaladsl.model.MediaType is accepted by the client.
      Parameters:
      mediaType - (undocumented)
      Returns:
      (undocumented)
    • qValueFor

      public float qValueFor(MediaType mediaType)
      Returns the q-value that the client (implicitly or explicitly) attaches to the given media-type. See http://tools.ietf.org/html/rfc7231#section-5.3.1 for details.
      Parameters:
      mediaType - (undocumented)
      Returns:
      (undocumented)