Apache CXF API

org.apache.cxf.jaxrs.utils
Class JAXRSUtils

java.lang.Object
  extended by org.apache.cxf.jaxrs.utils.JAXRSUtils

public final class JAXRSUtils
extends Object


Field Summary
static javax.ws.rs.core.MediaType ALL_TYPES
           
static String IGNORE_MESSAGE_WRITERS
           
static String ROOT_INSTANCE
           
static String ROOT_PROVIDER
           
static String ROOT_RESOURCE_CLASS
           
 
Method Summary
static int compareMediaTypes(javax.ws.rs.core.MediaType mt1, javax.ws.rs.core.MediaType mt2)
           
static int compareMediaTypesQualityFactors(javax.ws.rs.core.MediaType mt1, javax.ws.rs.core.MediaType mt2)
           
static int compareSortedMediaTypes(List<javax.ws.rs.core.MediaType> mts1, List<javax.ws.rs.core.MediaType> mts2)
           
static javax.ws.rs.core.Response convertFaultToResponse(Throwable ex, Message inMessage)
           
static QName convertStringToQName(String name)
           
static QName convertStringToQName(String name, String prefix)
           
static javax.ws.rs.ext.ContextResolver<?> createContextResolver(Type genericType, Message m)
           
static
<T> T
createContextValue(Message m, Type genericType, Class<T> clazz)
           
static Object createHttpParameterValue(Parameter parameter, Class<?> parameterClass, Type genericParam, Annotation[] paramAnns, Message message, javax.ws.rs.core.MultivaluedMap<String,String> values, OperationResourceInfo ori)
           
static Object createResourceValue(Message m, Type genericType, Class<?> clazz)
           
static javax.ws.rs.core.Response createResponse(ClassResourceInfo cri, Message msg, String responseMessage, int status, boolean addAllow)
           
static
<T> T
createServletResourceValue(Message m, Class<T> clazz)
           
static OperationResourceInfo findTargetMethod(ClassResourceInfo resource, Message message, String httpMethod, javax.ws.rs.core.MultivaluedMap<String,String> values, String requestContentType, List<javax.ws.rs.core.MediaType> acceptContentTypes, boolean logNow)
           
static QName getClassQName(Class<?> type)
           
static List<javax.ws.rs.core.MediaType> getConsumeTypes(javax.ws.rs.Consumes cm)
           
static javax.ws.rs.core.MultivaluedMap<String,String> getMatrixParams(String path, boolean decode)
           
static float getMediaTypeQualityFactor(String q)
           
static List<javax.ws.rs.core.MediaType> getMediaTypes(String[] values)
           
static List<javax.ws.rs.core.PathSegment> getPathSegments(String thePath, boolean decode)
           
static List<javax.ws.rs.core.PathSegment> getPathSegments(String thePath, boolean decode, boolean ignoreLastSlash)
           
static List<javax.ws.rs.core.MediaType> getProduceTypes(javax.ws.rs.Produces pm)
           
static List<javax.ws.rs.core.MediaType> getProviderConsumeTypes(javax.ws.rs.ext.MessageBodyReader provider)
           
static List<javax.ws.rs.core.MediaType> getProviderProduceTypes(javax.ws.rs.ext.MessageBodyWriter provider)
           
static void getStructuredParams(javax.ws.rs.core.MultivaluedMap<String,String> queries, String query, String sep, boolean decode, boolean decodePlus)
           
static javax.ws.rs.core.MultivaluedMap<String,String> getStructuredParams(String query, String sep, boolean decode, boolean decodePlus)
          Retrieve map of query parameters from the passed in message
static boolean headMethodPossible(String expectedMethod, String httpMethod)
           
static void injectParameters(OperationResourceInfo ori, Object requestObject, Message message)
           
static List<javax.ws.rs.core.MediaType> intersectMimeTypes(List<javax.ws.rs.core.MediaType> requiredMediaTypes, List<javax.ws.rs.core.MediaType> userMediaTypes, boolean addRequiredParamsIfPossible)
          intersect two mime types
static List<javax.ws.rs.core.MediaType> intersectMimeTypes(List<javax.ws.rs.core.MediaType> mimeTypesA, javax.ws.rs.core.MediaType mimeTypeB)
           
static List<javax.ws.rs.core.MediaType> intersectMimeTypes(String mimeTypesA, String mimeTypesB)
           
static boolean matchConsumeTypes(javax.ws.rs.core.MediaType requestContentType, OperationResourceInfo ori)
           
static boolean matchMimeTypes(javax.ws.rs.core.MediaType requestContentType, javax.ws.rs.core.MediaType acceptContentType, OperationResourceInfo ori)
           
static boolean matchProduceTypes(javax.ws.rs.core.MediaType acceptContentType, OperationResourceInfo ori)
           
static boolean noResourceMethodForOptions(javax.ws.rs.core.Response exResponse, String httpMethod)
           
static List<javax.ws.rs.core.MediaType> parseMediaTypes(String types)
           
static List<Object> processParameters(OperationResourceInfo ori, javax.ws.rs.core.MultivaluedMap<String,String> values, Message message)
           
static boolean propogateException(Message m)
           
static String removeMediaTypeParameter(javax.ws.rs.core.MediaType mt, String paramName)
           
static ClassResourceInfo selectResourceClass(List<ClassResourceInfo> resources, String path, javax.ws.rs.core.MultivaluedMap<String,String> values, Message message)
           
static List<javax.ws.rs.core.MediaType> sortMediaTypes(List<javax.ws.rs.core.MediaType> types)
           
static List<javax.ws.rs.core.MediaType> sortMediaTypes(String mediaTypes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL_TYPES

public static final javax.ws.rs.core.MediaType ALL_TYPES

ROOT_RESOURCE_CLASS

public static final String ROOT_RESOURCE_CLASS
See Also:
Constant Field Values

IGNORE_MESSAGE_WRITERS

public static final String IGNORE_MESSAGE_WRITERS
See Also:
Constant Field Values

ROOT_INSTANCE

public static final String ROOT_INSTANCE
See Also:
Constant Field Values

ROOT_PROVIDER

public static final String ROOT_PROVIDER
See Also:
Constant Field Values
Method Detail

getPathSegments

public static List<javax.ws.rs.core.PathSegment> getPathSegments(String thePath,
                                                                 boolean decode)

getPathSegments

public static List<javax.ws.rs.core.PathSegment> getPathSegments(String thePath,
                                                                 boolean decode,
                                                                 boolean ignoreLastSlash)

getProviderConsumeTypes

public static List<javax.ws.rs.core.MediaType> getProviderConsumeTypes(javax.ws.rs.ext.MessageBodyReader provider)

getProviderProduceTypes

public static List<javax.ws.rs.core.MediaType> getProviderProduceTypes(javax.ws.rs.ext.MessageBodyWriter provider)

getMediaTypes

public static List<javax.ws.rs.core.MediaType> getMediaTypes(String[] values)

injectParameters

public static void injectParameters(OperationResourceInfo ori,
                                    Object requestObject,
                                    Message message)

selectResourceClass

public static ClassResourceInfo selectResourceClass(List<ClassResourceInfo> resources,
                                                    String path,
                                                    javax.ws.rs.core.MultivaluedMap<String,String> values,
                                                    Message message)

findTargetMethod

public static OperationResourceInfo findTargetMethod(ClassResourceInfo resource,
                                                     Message message,
                                                     String httpMethod,
                                                     javax.ws.rs.core.MultivaluedMap<String,String> values,
                                                     String requestContentType,
                                                     List<javax.ws.rs.core.MediaType> acceptContentTypes,
                                                     boolean logNow)

noResourceMethodForOptions

public static boolean noResourceMethodForOptions(javax.ws.rs.core.Response exResponse,
                                                 String httpMethod)

createResponse

public static javax.ws.rs.core.Response createResponse(ClassResourceInfo cri,
                                                       Message msg,
                                                       String responseMessage,
                                                       int status,
                                                       boolean addAllow)

headMethodPossible

public static boolean headMethodPossible(String expectedMethod,
                                         String httpMethod)

getConsumeTypes

public static List<javax.ws.rs.core.MediaType> getConsumeTypes(javax.ws.rs.Consumes cm)

getProduceTypes

public static List<javax.ws.rs.core.MediaType> getProduceTypes(javax.ws.rs.Produces pm)

compareSortedMediaTypes

public static int compareSortedMediaTypes(List<javax.ws.rs.core.MediaType> mts1,
                                          List<javax.ws.rs.core.MediaType> mts2)

compareMediaTypes

public static int compareMediaTypes(javax.ws.rs.core.MediaType mt1,
                                    javax.ws.rs.core.MediaType mt2)

compareMediaTypesQualityFactors

public static int compareMediaTypesQualityFactors(javax.ws.rs.core.MediaType mt1,
                                                  javax.ws.rs.core.MediaType mt2)

getMediaTypeQualityFactor

public static float getMediaTypeQualityFactor(String q)

processParameters

public static List<Object> processParameters(OperationResourceInfo ori,
                                             javax.ws.rs.core.MultivaluedMap<String,String> values,
                                             Message message)

createHttpParameterValue

public static Object createHttpParameterValue(Parameter parameter,
                                              Class<?> parameterClass,
                                              Type genericParam,
                                              Annotation[] paramAnns,
                                              Message message,
                                              javax.ws.rs.core.MultivaluedMap<String,String> values,
                                              OperationResourceInfo ori)

getMatrixParams

public static javax.ws.rs.core.MultivaluedMap<String,String> getMatrixParams(String path,
                                                                             boolean decode)

createContextValue

public static <T> T createContextValue(Message m,
                                       Type genericType,
                                       Class<T> clazz)

createContextResolver

public static javax.ws.rs.ext.ContextResolver<?> createContextResolver(Type genericType,
                                                                       Message m)

createResourceValue

public static Object createResourceValue(Message m,
                                         Type genericType,
                                         Class<?> clazz)

createServletResourceValue

public static <T> T createServletResourceValue(Message m,
                                               Class<T> clazz)

getStructuredParams

public static javax.ws.rs.core.MultivaluedMap<String,String> getStructuredParams(String query,
                                                                                 String sep,
                                                                                 boolean decode,
                                                                                 boolean decodePlus)
Retrieve map of query parameters from the passed in message

Parameters:
message -
Returns:
a Map of query parameters.

getStructuredParams

public static void getStructuredParams(javax.ws.rs.core.MultivaluedMap<String,String> queries,
                                       String query,
                                       String sep,
                                       boolean decode,
                                       boolean decodePlus)

matchConsumeTypes

public static boolean matchConsumeTypes(javax.ws.rs.core.MediaType requestContentType,
                                        OperationResourceInfo ori)

matchProduceTypes

public static boolean matchProduceTypes(javax.ws.rs.core.MediaType acceptContentType,
                                        OperationResourceInfo ori)

matchMimeTypes

public static boolean matchMimeTypes(javax.ws.rs.core.MediaType requestContentType,
                                     javax.ws.rs.core.MediaType acceptContentType,
                                     OperationResourceInfo ori)

parseMediaTypes

public static List<javax.ws.rs.core.MediaType> parseMediaTypes(String types)

intersectMimeTypes

public static List<javax.ws.rs.core.MediaType> intersectMimeTypes(List<javax.ws.rs.core.MediaType> requiredMediaTypes,
                                                                  List<javax.ws.rs.core.MediaType> userMediaTypes,
                                                                  boolean addRequiredParamsIfPossible)
intersect two mime types

Parameters:
mimeTypesA -
mimeTypesB -
Returns:
return a list of intersected mime types

intersectMimeTypes

public static List<javax.ws.rs.core.MediaType> intersectMimeTypes(List<javax.ws.rs.core.MediaType> mimeTypesA,
                                                                  javax.ws.rs.core.MediaType mimeTypeB)

intersectMimeTypes

public static List<javax.ws.rs.core.MediaType> intersectMimeTypes(String mimeTypesA,
                                                                  String mimeTypesB)

sortMediaTypes

public static List<javax.ws.rs.core.MediaType> sortMediaTypes(String mediaTypes)

sortMediaTypes

public static List<javax.ws.rs.core.MediaType> sortMediaTypes(List<javax.ws.rs.core.MediaType> types)

convertFaultToResponse

public static javax.ws.rs.core.Response convertFaultToResponse(Throwable ex,
                                                               Message inMessage)

removeMediaTypeParameter

public static String removeMediaTypeParameter(javax.ws.rs.core.MediaType mt,
                                              String paramName)

propogateException

public static boolean propogateException(Message m)

getClassQName

public static QName getClassQName(Class<?> type)

convertStringToQName

public static QName convertStringToQName(String name)

convertStringToQName

public static QName convertStringToQName(String name,
                                         String prefix)

Apache CXF API

Apache CXF