Class VariantSelector


  • public final class VariantSelector
    extends Object
    Utility for selecting variant that best matches request from a list of variants.
    Author:
    Paul Sandoz, Marek Potociar
    • Method Detail

      • selectVariant

        public static jakarta.ws.rs.core.Variant selectVariant​(InboundMessageContext context,
                                                               List<jakarta.ws.rs.core.Variant> variants,
                                                               org.glassfish.jersey.internal.util.collection.Ref<String> varyHeaderValue)
        Select the representation variant that best matches the request. More explicit variants are chosen ahead of less explicit ones.
        Parameters:
        context - inbound message context.
        variants - list of possible variants.
        varyHeaderValue - an output reference of vary header value that should be put into the response Vary header.
        Returns:
        selected variant.
      • selectVariants

        public static List<jakarta.ws.rs.core.Variant> selectVariants​(InboundMessageContext context,
                                                                      List<jakarta.ws.rs.core.Variant> variants,
                                                                      org.glassfish.jersey.internal.util.collection.Ref<String> varyHeaderValue)
        Select possible representation variants in order in which they best matches the request.
        Parameters:
        context - inbound message context.
        variants - list of possible variants.
        varyHeaderValue - an output reference of vary header value that should be put into the response Vary header.
        Returns:
        possible variants.