Package org.apache.tika.server.core
Class ProduceTypeResourceComparator
java.lang.Object
org.apache.tika.server.core.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 Summary
Modifier and TypeFieldDescriptionstatic final List<javax.ws.rs.core.MediaType>
The prioritized MediaType list. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
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.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.
-
Field Details
-
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 Details
-
ProduceTypeResourceComparator
public ProduceTypeResourceComparator()Initiates the comparator. Currently, no op.
-
-
Method Details
-
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 interfaceorg.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 interfaceorg.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.
-