Class ProduceTypeResourceComparator

  • All Implemented Interfaces:
    org.apache.cxf.jaxrs.ext.ResourceComparator

    public class ProduceTypeResourceComparator
    extends Object
    implements org.apache.cxf.jaxrs.ext.ResourceComparator
    Resource comparator based to produce type. In an ambiguous call, request handler will be chosen based on the type of data it returns.
    • Field Detail

      • PRIORITIZED_MEDIA_LIST

        public static final List<javax.ws.rs.core.MediaType> PRIORITIZED_MEDIA_LIST
        The prioritized MediaType list. The lower in list (higher index value), the higher priority it has. In case of no matching in this list, it will be treated as media type all.
    • Constructor Detail

      • ProduceTypeResourceComparator

        public ProduceTypeResourceComparator()
        Initiates the comparator. Currently, no op.
    • Method Detail

      • compare

        public int compare​(org.apache.cxf.jaxrs.model.ClassResourceInfo cri1,
                           org.apache.cxf.jaxrs.model.ClassResourceInfo cri2,
                           org.apache.cxf.message.Message message)
        Compares the class to handle. Nothing is handled here, and this is handed over to CXF default logic.
        Specified by:
        compare in interface org.apache.cxf.jaxrs.ext.ResourceComparator
        Parameters:
        cri1 - the first class resource info.
        cri2 - the second class resource info.
        message - the message, for comparison context.
        Returns:
        value based on chosen class. (Always 0 is returned)
      • compare

        public int compare​(org.apache.cxf.jaxrs.model.OperationResourceInfo oper1,
                           org.apache.cxf.jaxrs.model.OperationResourceInfo oper2,
                           org.apache.cxf.message.Message message)
        Compares the method to handle. Gets the maximum priority match for both handlers, and chooses the handler that has the maximum priority match.
        Specified by:
        compare in interface org.apache.cxf.jaxrs.ext.ResourceComparator
        Parameters:
        oper1 - the first resource handler info.
        oper2 - the second resource handler info.
        message - the message, for comparison context.
        Returns:
        value based on chosen handler. Returns -1 if first, 1 if second and 0 if no decision.