@Override public String toString() { return String.format("%s->%s:%s", consumes.getMediaType(), produces.getMediaType(), methodRouting); }
@Override public String toString() { return String.format("%s->%s:%s", consumes.getMediaType(), produces.getMediaType(), methodRouting); }
@Override public int compare(final ConsumesProducesAcceptor o1, final ConsumesProducesAcceptor o2) { // Make sure that annotated (@Consumes, @Produces) goes first. final ResourceMethod model1 = o1.methodRouting.method; final ResourceMethod model2 = o2.methodRouting.method; // @Consumes on method. int compared = compare(model1.getConsumedTypes(), model2.getConsumedTypes()); if (compared != 0) { return compared; } compared = compare(model1.getProducedTypes(), model2.getProducedTypes()); if (compared != 0) { return compared; } compared = MediaTypes.PARTIAL_ORDER_COMPARATOR.compare(o1.consumes.getMediaType(), o2.consumes.getMediaType()); if (compared != 0) { return compared; } return MediaTypes.PARTIAL_ORDER_COMPARATOR.compare(o1.produces.getMediaType(), o2.produces.getMediaType()); }
@Override public String toString() { return String.format("%s->%s:%s", consumes.getMediaType(), produces.getMediaType(), methodRouting); }
@Override public String toString() { return String.format("%s->%s:%s", consumes.getMediaType(), produces.getMediaType(), methodRouting); }
/** * Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}. * * @param requestContext The request to be tested. * @return True if the {@code request} can be processed by this router, false otherwise. */ boolean isConsumable(ContainerRequest requestContext) { MediaType contentType = requestContext.getMediaType(); return contentType == null || consumes.getMediaType().isCompatible(contentType); }
@Override public String toString() { return String.format("%s->%s:%s", consumes.getMediaType(), produces.getMediaType(), methodRouting); }
@Override public String toString() { return String.format("%s->%s:%s", consumes.getMediaType(), produces.getMediaType(), methodRouting); }
/** * Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}. * * @param requestContext The request to be tested. * @return True if the {@code request} can be processed by this router, false otherwise. */ boolean isConsumable(ContainerRequest requestContext) { MediaType contentType = requestContext.getMediaType(); return contentType == null || consumes.getMediaType().isCompatible(contentType); }
/** * Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}. * * @param requestContext The request to be tested. * @return True if the {@code request} can be processed by this router, false otherwise. */ boolean isConsumable(ContainerRequest requestContext) { MediaType contentType = requestContext.getMediaType(); return contentType == null || consumes.getMediaType().isCompatible(contentType); }
/** * Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}. * * @param requestContext The request to be tested. * @return True if the {@code request} can be processed by this router, false otherwise. */ boolean isConsumable(ContainerRequest requestContext) { MediaType contentType = requestContext.getMediaType(); return contentType == null || consumes.getMediaType().isCompatible(contentType); }
@Override public int compare(final ConsumesProducesAcceptor o1, final ConsumesProducesAcceptor o2) { // Make sure that annotated (@Consumes, @Produces) goes first. final ResourceMethod model1 = o1.methodRouting.method; final ResourceMethod model2 = o2.methodRouting.method; // @Consumes on method. int compared = compare(model1.getConsumedTypes(), model2.getConsumedTypes()); if (compared != 0) { return compared; } compared = compare(model1.getProducedTypes(), model2.getProducedTypes()); if (compared != 0) { return compared; } compared = MediaTypes.PARTIAL_ORDER_COMPARATOR.compare(o1.consumes.getMediaType(), o2.consumes.getMediaType()); if (compared != 0) { return compared; } return MediaTypes.PARTIAL_ORDER_COMPARATOR.compare(o1.produces.getMediaType(), o2.produces.getMediaType()); }
/** * Create combined client/server media type. * * if the two types are not compatible, {@link #NO_MATCH} is returned. * * @param clientType client-side media type. * @param serverType server-side media type. * @return combined client/server media type. */ static CombinedMediaType create(MediaType clientType, EffectiveMediaType serverType) { if (!clientType.isCompatible(serverType.getMediaType())) { return NO_MATCH; } final MediaType strippedClientType = MediaTypes.stripQualityParams(clientType); final MediaType strippedServerType = MediaTypes.stripQualityParams(serverType.getMediaType()); return new CombinedMediaType( MediaTypes.mostSpecific(strippedClientType, strippedServerType), MediaTypes.getQuality(clientType), QualitySourceMediaType.getQualitySource(serverType.getMediaType()), matchedWildcards(clientType, serverType)); }
/** * Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}. * * @param requestContext The request to be tested. * @return True if the {@code request} can be processed by this router, false otherwise. */ boolean isConsumable(ContainerRequest requestContext) { MediaType contentType = requestContext.getMediaType(); return contentType == null || consumes.getMediaType().isCompatible(contentType); }
@Override public String toString() { return String.format("%s->%s:%s", consumes.getMediaType(), produces.getMediaType(), methodRouting); }
/** * Create combined client/server media type. * * if the two types are not compatible, {@link #NO_MATCH} is returned. * * @param clientType client-side media type. * @param serverType server-side media type. * @return combined client/server media type. */ static CombinedMediaType create(MediaType clientType, EffectiveMediaType serverType) { if (!clientType.isCompatible(serverType.getMediaType())) { return NO_MATCH; } final MediaType strippedClientType = MediaTypes.stripQualityParams(clientType); final MediaType strippedServerType = MediaTypes.stripQualityParams(serverType.getMediaType()); return new CombinedMediaType( MediaTypes.mostSpecific(strippedClientType, strippedServerType), MediaTypes.getQuality(clientType), QualitySourceMediaType.getQualitySource(serverType.getMediaType()), matchedWildcards(clientType, serverType)); }
@Override public int compare(final ConsumesProducesAcceptor o1, final ConsumesProducesAcceptor o2) { // Make sure that annotated (@Consumes, @Produces) goes first. final ResourceMethod model1 = o1.methodRouting.method; final ResourceMethod model2 = o2.methodRouting.method; // @Consumes on method. int compared = compare(model1.getConsumedTypes(), model2.getConsumedTypes()); if (compared != 0) { return compared; } compared = compare(model1.getProducedTypes(), model2.getProducedTypes()); if (compared != 0) { return compared; } compared = MediaTypes.PARTIAL_ORDER_COMPARATOR.compare(o1.consumes.getMediaType(), o2.consumes.getMediaType()); if (compared != 0) { return compared; } return MediaTypes.PARTIAL_ORDER_COMPARATOR.compare(o1.produces.getMediaType(), o2.produces.getMediaType()); }
/** * Create combined client/server media type. * * if the two types are not compatible, {@link #NO_MATCH} is returned. * * @param clientType client-side media type. * @param serverType server-side media type. * @return combined client/server media type. */ static CombinedMediaType create(MediaType clientType, EffectiveMediaType serverType) { if (!clientType.isCompatible(serverType.getMediaType())) { return NO_MATCH; } final MediaType strippedClientType = MediaTypes.stripQualityParams(clientType); final MediaType strippedServerType = MediaTypes.stripQualityParams(serverType.getMediaType()); return new CombinedMediaType( MediaTypes.mostSpecific(strippedClientType, strippedServerType), MediaTypes.getQuality(clientType), QualitySourceMediaType.getQualitySource(serverType.getMediaType()), matchedWildcards(clientType, serverType)); }
/** * Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}. * * @param requestContext The request to be tested. * @return True if the {@code request} can be processed by this router, false otherwise. */ boolean isConsumable(ContainerRequest requestContext) { MediaType contentType = requestContext.getMediaType(); return contentType == null || consumes.getMediaType().isCompatible(contentType); }
/** * Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}. * * @param requestContext The request to be tested. * @return True if the {@code request} can be processed by this router, false otherwise. */ boolean isConsumable(ContainerRequest requestContext) { MediaType contentType = requestContext.getMediaType(); return contentType == null || consumes.getMediaType().isCompatible(contentType); }