@Override
    public int compare(OperationResourceInfo oper1, OperationResourceInfo oper2, Message message) {
        // getting all message context data
        final String httpMethod = (String) message.get(Message.HTTP_REQUEST_METHOD);
        final MediaType contentType = JAXRSUtils.toMediaType((String) message.get(Message.CONTENT_TYPE));
        final List<MediaType> acceptTypes = JAXRSUtils.parseMediaTypes((String) message.get(Message.ACCEPT_CONTENT_TYPE));

        LOG.debug("Message Method : " + httpMethod + ", ContentType : " + contentType + ", " + "Accept Types : " + acceptTypes);

        int result = compareProduceTypes(oper1, oper2, acceptTypes);

        String m1Name = oper1
                .getClassResourceInfo()
                .getServiceClass()
                .getName() + "#" + oper1
                .getMethodToInvoke()
                .getName();
        String m2Name = oper2
                .getClassResourceInfo()
                .getServiceClass()
                .getName() + "#" + oper2
                .getMethodToInvoke()
                .getName();

        if (result != 0) {
            String chosen = result == -1 ? m1Name : m2Name;
            LOG.debug("Between " + m1Name + " and " + m2Name + ", " + chosen + " is chosen for handling the current request");
        }

        return result;
    }
Compares the method to handle.
Gets the maximum priority match for both handlers,
and chooses the handler that has the maximum priority match.

@param oper1   the first resource handler info.
@param oper2   the second resource handler info.
@param message the message, for comparison context.
@return value based on chosen handler. Returns -1 if first, 1 if second and 0 if no decision.
tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/ProduceTypeResourceComparator.java