Class CombinedMediaType
java.lang.Object
org.glassfish.jersey.server.internal.routing.CombinedMediaType
Represents function S as defined in the Request Matching part of the spec.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classMedia typeextended by flag indicating whether media type was obtained from user annotationsConsumesorProducesor has no annotation and therefore was derived fromMessageBodyWorkers. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final javax.ws.rs.core.MediaTypeCombined client/server media type, stripped of q and qs parameters.(package private) static final Comparator<CombinedMediaType> Comparator used to compareCombinedMediaType.(package private) final intDistance of the combined media types.(package private) static final CombinedMediaTypeConstant combined type representing no match.(package private) final intClient-specified media type quality.(package private) final intServer-specified media type quality. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateCombinedMediaType(javax.ws.rs.core.MediaType combinedType, int q, int qs, int d) -
Method Summary
Modifier and TypeMethodDescriptionprivate static intb2i(boolean b) (package private) static CombinedMediaTypecreate(javax.ws.rs.core.MediaType clientType, CombinedMediaType.EffectiveMediaType serverType) Create combined client/server media type.private static intmatchedWildcards(javax.ws.rs.core.MediaType clientMt, CombinedMediaType.EffectiveMediaType serverMt) toString()
-
Field Details
-
NO_MATCH
Constant combined type representing no match. -
combinedType
final javax.ws.rs.core.MediaType combinedTypeCombined client/server media type, stripped of q and qs parameters. -
q
final int qClient-specified media type quality. -
qs
final int qsServer-specified media type quality. -
d
final int dDistance 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_TYPEand the other one is a concrete media type.
-
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.
-
-
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_MATCHis returned.- Parameters:
clientType- client-side media type.serverType- server-side media type.- Returns:
- combined client/server media type.
-
toString
-