Class CombinedMediaType
- java.lang.Object
-
- org.glassfish.jersey.server.internal.routing.CombinedMediaType
-
final class CombinedMediaType extends java.lang.Object
Represents function S as defined in the Request Matching part of the spec.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
CombinedMediaType.EffectiveMediaType
Media type
extended by flag indicating whether media type was obtained from user annotationsConsumes
orProduces
or has no annotation and therefore was derived fromMessageBodyWorkers
.
-
Field Summary
Fields Modifier and Type Field Description (package private) javax.ws.rs.core.MediaType
combinedType
Combined client/server media type, stripped of q and qs parameters.(package private) static java.util.Comparator<CombinedMediaType>
COMPARATOR
Comparator used to compareCombinedMediaType
.(package private) int
d
Distance of the combined media types.(package private) static CombinedMediaType
NO_MATCH
Constant combined type representing no match.(package private) int
q
Client-specified media type quality.(package private) int
qs
Server-specified media type quality.
-
Constructor Summary
Constructors Modifier Constructor Description private
CombinedMediaType(javax.ws.rs.core.MediaType combinedType, int q, int qs, int d)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static int
b2i(boolean b)
(package private) static CombinedMediaType
create(javax.ws.rs.core.MediaType clientType, CombinedMediaType.EffectiveMediaType serverType)
Create combined client/server media type.private static int
matchedWildcards(javax.ws.rs.core.MediaType clientMt, CombinedMediaType.EffectiveMediaType serverMt)
java.lang.String
toString()
-
-
-
Field Detail
-
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 java.util.Comparator<CombinedMediaType> COMPARATOR
Comparator used to compareCombinedMediaType
. The comparator sorts the elements of list in the ascending order from the most appropriate to the least appropriate combined media type.
-
-
Method Detail
-
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 java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-