Class CombinedMediaType

java.lang.Object
org.glassfish.jersey.server.internal.routing.CombinedMediaType

final class CombinedMediaType extends Object
Represents function S as defined in the Request Matching part of the spec.
  • Field Details

    • NO_MATCH

      static final CombinedMediaType NO_MATCH
      Constant combined type representing no match.
    • combinedType

      final javax.ws.rs.core.MediaType combinedType
      Combined client/server media type, stripped of q and qs parameters.
    • q

      final int q
      Client-specified media type quality.
    • qs

      final int qs
      Server-specified media type quality.
    • d

      final int d
      Distance of the combined media types.
      • 0 - if the type and subtype of both combined media types match exactly (i.e. ["m/n" + "m/n"]).
      • 1 - if one media type contains a wildcard type or subtype value that matches a concrete type or subtype value.
      • 2 - if one of the media types is a MediaType.WILDCARD_TYPE and the other one is a concrete media type.
    • COMPARATOR

      static final Comparator<CombinedMediaType> COMPARATOR
      Comparator used to compare CombinedMediaType. The comparator sorts the elements of list in the ascending order from the most appropriate to the least appropriate combined media type.
  • Constructor Details

    • CombinedMediaType

      private CombinedMediaType(javax.ws.rs.core.MediaType combinedType, int q, int qs, int d)
  • Method Details

    • matchedWildcards

      private static int matchedWildcards(javax.ws.rs.core.MediaType clientMt, CombinedMediaType.EffectiveMediaType serverMt)
    • b2i

      private static int b2i(boolean b)
    • create

      static CombinedMediaType create(javax.ws.rs.core.MediaType clientType, CombinedMediaType.EffectiveMediaType serverType)
      Create combined client/server media type. if the two types are not compatible, NO_MATCH is returned.
      Parameters:
      clientType - client-side media type.
      serverType - server-side media type.
      Returns:
      combined client/server media type.
    • toString

      public String toString()
      Overrides:
      toString in class Object