cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r673167 [4/6] - in /cxf/trunk: parent/ rt/frontend/jaxrs/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ rt/frontend...
Date Tue, 01 Jul 2008 18:41:29 GMT
Copied: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java (from r651969, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSUtils.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java?p2=cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java&p1=cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSUtils.java&r1=651969&r2=673167&rev=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java Tue Jul  1 11:41:24 2008
@@ -17,16 +17,15 @@
  * under the License.
  */
 
-package org.apache.cxf.jaxrs;
+package org.apache.cxf.jaxrs.utils;
 
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.net.URLDecoder;
 import java.util.ArrayList;
@@ -47,127 +46,58 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.ConsumeMime;
+import javax.ws.rs.CookieParam;
+import javax.ws.rs.DefaultValue;
 import javax.ws.rs.HeaderParam;
-import javax.ws.rs.HttpMethod;
 import javax.ws.rs.MatrixParam;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.ProduceMime;
 import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Cookie;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.PathSegment;
 import javax.ws.rs.core.Request;
+import javax.ws.rs.core.Response;
 import javax.ws.rs.core.SecurityContext;
 import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.MessageBodyWorkers;
 
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.common.util.PrimitiveUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.jaxrs.impl.HttpHeadersImpl;
+import org.apache.cxf.jaxrs.impl.MessageBodyWorkersImpl;
+import org.apache.cxf.jaxrs.impl.MetadataMap;
+import org.apache.cxf.jaxrs.impl.PathSegmentImpl;
+import org.apache.cxf.jaxrs.impl.RequestImpl;
+import org.apache.cxf.jaxrs.impl.SecurityContextImpl;
+import org.apache.cxf.jaxrs.impl.UriInfoImpl;
 import org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor;
 import org.apache.cxf.jaxrs.model.ClassResourceInfo;
 import org.apache.cxf.jaxrs.model.OperationResourceInfo;
+import org.apache.cxf.jaxrs.model.OperationResourceInfoComparator;
 import org.apache.cxf.jaxrs.model.URITemplate;
-import org.apache.cxf.jaxrs.provider.HttpHeadersImpl;
-import org.apache.cxf.jaxrs.provider.PathSegmentImpl;
 import org.apache.cxf.jaxrs.provider.ProviderFactory;
-import org.apache.cxf.jaxrs.provider.RequestImpl;
-import org.apache.cxf.jaxrs.provider.SecurityContextImpl;
-import org.apache.cxf.jaxrs.provider.UriInfoImpl;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.transport.http.AbstractHTTPDestination;
 
 public final class JAXRSUtils {
 
     public static final MediaType ALL_TYPES = new MediaType();
     private static final Logger LOG = LogUtils.getL7dLogger(JAXRSUtils.class);
+    //private static final ResourceBundle BUNDLE = BundleUtils.getBundle(JAXRSUtils.class);
 
     private JAXRSUtils() {        
     }
     
-    public static String getHttpMethodValue(Method m) {
-        for (Annotation a : m.getAnnotations()) {
-            HttpMethod httpM = a.annotationType().getAnnotation(HttpMethod.class);
-            if (httpM != null) {
-                return httpM.value();
-            }
-        }
-        // TODO : make it shorter
-        for (Class<?> i : m.getDeclaringClass().getInterfaces()) {
-            try {
-                Method interfaceMethod = i.getMethod(m.getName(), m.getParameterTypes());
-                if (interfaceMethod != null) {
-                    return getHttpMethodValue(interfaceMethod);
-                }
-            } catch (NoSuchMethodException ex) {
-                //ignore
-            }
-        }
-        Class<?> superC = m.getDeclaringClass().getSuperclass();
-        if (superC != null) {
-            try {
-                Method cMethod = superC.getMethod(m.getName(), m.getParameterTypes());
-                if (cMethod != null) {
-                    return getHttpMethodValue(cMethod);
-                }
-            } catch (NoSuchMethodException ex) {
-                //ignore
-            }
-        }
-        
-        return null;
-    }
-    
-    public static Annotation getMethodAnnotation(Method m,
-                                                 Class<? extends Annotation> aClass) {
-        Annotation a = m.getAnnotation(aClass);
-        if (a != null) {
-            return a;
-        }
-        
-        for (Class<?> i : m.getDeclaringClass().getInterfaces()) {
-            a = getClassMethodAnnotation(m, i, aClass);
-            if (a != null) {
-                return a;
-            }
-        }
-        Class<?> superC = m.getDeclaringClass().getSuperclass();
-        if (superC != null) {
-            return getClassMethodAnnotation(m, superC, aClass);
-        }
-        
-        return null;
-    }
-    
-    private static Annotation getClassMethodAnnotation(Method m,
-                                                       Class<?> c, 
-                                                       Class<? extends Annotation> aClass) {
-        try {
-            Method interfaceMethod = c.getMethod(m.getName(), m.getParameterTypes());
-            if (interfaceMethod != null) {
-                return getMethodAnnotation(interfaceMethod, aClass);
-            }
-        } catch (NoSuchMethodException ex) {
-            //ignore
-        }
-        return null;
-    }
-    
-    public static Annotation getClassAnnotation(Class<?> c, 
-                                                Class<? extends Annotation> aClass) {
-        if (c == null) {
-            return null;
-        }
-        Annotation p = c.getAnnotation(aClass);
-        if (p != null) {
-            return p;
-        }
-        return getClassAnnotation(c.getSuperclass(), aClass);
-    }
-    
     public static List<PathSegment> getPathSegments(String thePath, boolean decode) {
         String[] segments = thePath.split("/");
         List<PathSegment> theList = new ArrayList<PathSegment>();
@@ -182,7 +112,7 @@
     public static List<MediaType> getMediaTypes(String[] values) {
         List<MediaType> supportedMimeTypes = new ArrayList<MediaType>(values.length);
         for (int i = 0; i < values.length; i++) {
-            supportedMimeTypes.add(MediaType.parse(values[i]));    
+            supportedMimeTypes.add(MediaType.valueOf(values[i]));    
         }
         return supportedMimeTypes;
     }
@@ -190,33 +120,88 @@
     public static ClassResourceInfo findSubResourceClass(ClassResourceInfo resource,
                                                          Class subResourceClassType) {
         for (ClassResourceInfo subCri : resource.getSubClassResourceInfo()) {
-            if (subCri.getResourceClass() == subResourceClassType) {
+            if (subCri.getResourceClass().isAssignableFrom(subResourceClassType)) {
                 return subCri;
             }
         }
         return null;
     }
 
-    public static OperationResourceInfo findTargetResourceClass(List<ClassResourceInfo> resources,
-                                                                String path, 
-                                                                String httpMethod,
-                                                                MultivaluedMap<String, String> values,
-                                                                String requestContentType, 
-                                                                String acceptContentTypes) {
+    
+    @SuppressWarnings("unchecked")
+    public static void handleSetters(ClassResourceInfo cri,
+                                     Object requestObject,
+                                     Message message) {
+        InjectionUtils.injectContextMethods(requestObject, cri, message);
+        // Param methods
+        String relativePath = (String)message.get(JAXRSInInterceptor.RELATIVE_PATH);
+        MultivaluedMap<String, String> values = 
+            (MultivaluedMap<String, String>)message.get(URITemplate.TEMPLATE_PARAMETERS);
+        for (Method m : cri.getParameterMethods()) {
+            Object o = createHttpParameterValue(m.getAnnotations(), 
+                                                m.getParameterTypes()[0],
+                                                m.getGenericParameterTypes()[0],
+                                                message,
+                                                values,
+                                                relativePath,
+                                                cri);
+            if (o != null) { 
+                InjectionUtils.injectThroughMethod(requestObject, m, o);
+            }
+        }
+        // Param fields
+        for (Field f : cri.getParameterFields()) {
+            Object o = createHttpParameterValue(f.getAnnotations(), 
+                                                f.getType(),
+                                                f.getGenericType(),
+                                                message,
+                                                values,
+                                                relativePath,
+                                                cri);
+            if (o != null) { 
+                InjectionUtils.injectFieldValue(f, requestObject, o);
+            }
+        }
+        
+    }
+    
+    public static ClassResourceInfo selectResourceClass(List<ClassResourceInfo> resources,
+                                                 String path, 
+                                                 MultivaluedMap<String, String> values) {
+        
+        if (resources.size() == 1) { 
+            return resources.get(0).getURITemplate().match(path, values)
+                   ? resources.get(0) : null;
+        }
+        
+        SortedMap<ClassResourceInfo, MultivaluedMap<String, String>> candidateList = 
+            new TreeMap<ClassResourceInfo, MultivaluedMap<String, String>>(
+                new Comparator<ClassResourceInfo>() {
+
+                    public int compare(ClassResourceInfo cr1, ClassResourceInfo cr2) {
+                        int g1 = cr1.getURITemplate().getNumberOfGroups();
+                        int g2 = cr2.getURITemplate().getNumberOfGroups();
+                        // descending order 
+                        return g1 < g2 ? 1 : g1 > g2 ? -1 : 0;
+                    }
+                    
+                });
         
         for (ClassResourceInfo resource : resources) {
-            URITemplate uriTemplate = resource.getURITemplate();
             MultivaluedMap<String, String> map = new MetadataMap<String, String>();
-            if (uriTemplate.match(path, map)) {
-                String subResourcePath = map.getFirst(URITemplate.FINAL_MATCH_GROUP);
-                OperationResourceInfo ori = findTargetMethod(resource, subResourcePath, httpMethod, map,
-                                                             requestContentType, acceptContentTypes);
-                if (ori != null) {
-                    values.putAll(map);
-                    return ori;
-                }
+            if (resource.getURITemplate().match(path, map)) {
+                candidateList.put(resource, map);
             }
         }
+        
+        if (!candidateList.isEmpty()) {
+            Map.Entry<ClassResourceInfo, MultivaluedMap<String, String>> firstEntry = 
+                candidateList.entrySet().iterator().next();
+            values.putAll(firstEntry.getValue());
+            return firstEntry.getKey();
+        }
+        
+        
         return null;
     }
 
@@ -225,21 +210,19 @@
                                                          String httpMethod, 
                                                          MultivaluedMap<String, String> values, 
                                                          String requestContentType, 
-                                                         String acceptContentTypes) {
+                                                         List<MediaType> acceptContentTypes) {
         SortedMap<OperationResourceInfo, MultivaluedMap<String, String>> candidateList = 
             new TreeMap<OperationResourceInfo, MultivaluedMap<String, String>>(
                 new OperationResourceInfoComparator());
         MediaType requestType = requestContentType == null 
-                                ? ALL_TYPES : MediaType.parse(requestContentType);
-        List<MediaType> acceptTypes = JAXRSUtils.sortMediaTypes(acceptContentTypes);
-       
-        for (MediaType acceptType : acceptTypes) {
+                                ? ALL_TYPES : MediaType.valueOf(requestContentType);
+        for (MediaType acceptType : acceptContentTypes) {
             for (OperationResourceInfo ori : resource.getMethodDispatcher().getOperationResourceInfos()) {
                 
                 URITemplate uriTemplate = ori.getURITemplate();
                 MultivaluedMap<String, String> map = cloneMap(values);
                 if (uriTemplate != null && uriTemplate.match(path, map)) {
-                    if (ori.isSubResourceLocator() && matchMimeTypes(requestType, acceptType, ori)) {
+                    if (ori.isSubResourceLocator()) {
                         candidateList.put(ori, map);
                     } else if (ori.getHttpMethod().equalsIgnoreCase(httpMethod)
                                && matchMimeTypes(requestType, acceptType, ori)) {
@@ -273,40 +256,11 @@
                           : getMediaTypes(pm.value());
     }
     
-    private static class OperationResourceInfoComparator implements Comparator<OperationResourceInfo> {
-        public int compare(OperationResourceInfo e1, OperationResourceInfo e2) {
-            
-            List<MediaType> mimeType1 = 
-                getConsumeTypes(e1.getMethod().getAnnotation(ConsumeMime.class));
-            List<MediaType> mimeType2 = 
-                getConsumeTypes(e2.getMethod().getAnnotation(ConsumeMime.class));
-            
-            // TODO: we actually need to check all consume and produce types here ?
-            int result = JAXRSUtils.compareMediaTypes(mimeType1.get(0), 
-                                                      mimeType2.get(0));
-            if (result == 0) {
-                //use the media type of output data as the secondary key.
-                List<MediaType> mimeTypeP1 = 
-                    getProduceTypes(e1.getMethod().getAnnotation(ProduceMime.class));
-
-                List<MediaType> mimeTypeP2 = 
-                    getProduceTypes(e2.getMethod().getAnnotation(ProduceMime.class));    
-
-                return JAXRSUtils.compareMediaTypes(mimeTypeP1.get(0), 
-                                                    mimeTypeP2.get(0));
-            } else {
-                return result;
-            }
-
-        }
-        
-    }
-    
     public static int compareMediaTypes(MediaType mt1, MediaType mt2) {
         
         if (mt1.equals(mt2)) {
-            float q1 = getMediaTypeQualityFactor(mt1);
-            float q2 = getMediaTypeQualityFactor(mt2);
+            float q1 = getMediaTypeQualityFactor(mt1.getParameters().get("q"));
+            float q2 = getMediaTypeQualityFactor(mt2.getParameters().get("q"));
             int result = Float.compare(q1, q2);
             return result == 0 ? result : ~result;
         }
@@ -330,8 +284,7 @@
         
     }
 
-    private static float getMediaTypeQualityFactor(MediaType mt) {
-        String q = mt.getParameters().get("q");
+    public static float getMediaTypeQualityFactor(String q) {
         if (q == null) {
             return 1;
         }
@@ -352,7 +305,7 @@
                                                  Message message) {
         
         
-        Method method = ori.getMethod();
+        Method method = ori.getAnnotatedMethod();
         Class[] parameterTypes = method.getParameterTypes();
         Type[] genericParameterTypes = method.getGenericParameterTypes();
         Annotation[][] parameterAnnotations = method.getParameterAnnotations();
@@ -374,7 +327,7 @@
 
     private static Object processParameter(Class<?> parameterClass, 
                                            Type parameterType,
-                                           Annotation[] parameterAnnotations, 
+                                           Annotation[] parameterAnns, 
                                            MultivaluedMap<String, String> values,
                                            Message message,
                                            OperationResourceInfo ori) {
@@ -382,8 +335,9 @@
 
         String path = (String)message.get(JAXRSInInterceptor.RELATIVE_PATH);
         
-        if ((parameterAnnotations == null || parameterAnnotations.length == 0)
-            && ("PUT".equals(ori.getHttpMethod()) || "POST".equals(ori.getHttpMethod()))) {
+        if (parameterAnns == null || parameterAnns.length == 0) {
+            // we can't really limit it to just PUT and POST
+            
             String contentType = (String)message.get(Message.CONTENT_TYPE);
 
             if (contentType == null) {
@@ -392,48 +346,89 @@
             }
 
             return readFromMessageBody(parameterClass,
-                                         is, 
-                                         MediaType.parse(contentType),
-                                         ori.getConsumeTypes());
-        } else if (parameterAnnotations[0].annotationType() == Context.class
-                   && ori.getClassResourceInfo().isRoot()) {
-            return createHttpContextValue(message, parameterClass);
-        } else if (parameterAnnotations[0].annotationType() == PathParam.class) {
-            return readFromUriParam((PathParam)parameterAnnotations[0], parameterClass, parameterType,
-                                      parameterAnnotations, path, values);
-        }  
-        
-        Object result = null;
-
-        // TODO : deal with @DefaultValues
-        if (parameterAnnotations[0].annotationType() == QueryParam.class) {
-            result = readQueryString((QueryParam)parameterAnnotations[0], parameterClass, message, null);
-        } else if (parameterAnnotations[0].annotationType() == MatrixParam.class) {
-            result = processMatrixParam(message, ((MatrixParam)parameterAnnotations[0]).value(), 
-                                        parameterClass, null);
-        } else if (parameterAnnotations[0].annotationType() == HeaderParam.class) {
-            result = processHeaderParam(message, ((HeaderParam)parameterAnnotations[0]).value(),
-                                        parameterClass, null);
+                                       parameterType,
+                                       parameterAnns,
+                                       is, 
+                                       MediaType.valueOf(contentType),
+                                       ori.getConsumeTypes(),
+                                       message);
+        } else if (parameterAnns[0].annotationType() == Context.class) {
+            return createContextValue(message, parameterType, parameterClass);
+        } else {
+            
+            return createHttpParameterValue(parameterAnns,
+                                            parameterClass,
+                                            parameterType,
+                                            message,
+                                            values,
+                                            path,
+                                            ori.getClassResourceInfo());
+        }
+    }
+    
+    private static Object createHttpParameterValue(Annotation[] anns, 
+                                            Class<?> parameterClass, 
+                                            Type genericParam,
+                                            Message message,
+                                            MultivaluedMap<String, String> values,
+                                            String path,
+                                            ClassResourceInfo cri) {
+       
+        boolean isEncoded = AnnotationUtils.isEncoded(anns, cri);
+        
+        PathParam pathParam = AnnotationUtils.getAnnotation(anns, PathParam.class);
+        if (pathParam != null) {
+            return readFromUriParam(pathParam, parameterClass, genericParam, path, 
+                                    values, !isEncoded);
+        } 
+        
+        DefaultValue defaultAnn = AnnotationUtils.getAnnotation(anns, DefaultValue.class);
+        String defaultValue = defaultAnn != null ? defaultAnn.value() : null;
+        
+        QueryParam qp = AnnotationUtils.getAnnotation(anns, QueryParam.class);
+        if (qp != null) {
+            return readQueryString(qp, parameterClass, genericParam, message, 
+                                   defaultValue, !isEncoded);
+        }
+        
+        MatrixParam mp = AnnotationUtils.getAnnotation(anns, MatrixParam.class);
+        if (mp != null) {
+            return processMatrixParam(message, mp.value(), parameterClass, genericParam, 
+                                      defaultValue, !isEncoded);
+        }
+        
+        CookieParam cookie = AnnotationUtils.getAnnotation(anns, CookieParam.class);
+        if (cookie != null) {
+            return processCookieParam(message, cookie.value(), parameterClass, genericParam, defaultValue);
+        } 
+        
+        HeaderParam hp = AnnotationUtils.getAnnotation(anns, HeaderParam.class);
+        if (hp != null) {
+            return processHeaderParam(message, hp.value(), parameterClass, genericParam, defaultValue);
         } 
 
-        return result;
+        return null;
     }
     
     private static Object processMatrixParam(Message m, String key, 
-                                             Class<?> pClass, String defaultValue) {
+                                             Class<?> pClass, Type genericType,
+                                             String defaultValue,
+                                             boolean decode) {
         List<PathSegment> segments = JAXRSUtils.getPathSegments(
-                                      (String)m.get(Message.PATH_INFO), true);
-        String value = null;
+                                      (String)m.get(Message.PATH_INFO), decode);
         if (segments.size() > 0) {
             MultivaluedMap<String, String> params = 
                 segments.get(segments.size() - 1).getMatrixParameters();
             List<String> values = params.get(key);
-            if (values != null && values.size() > 0) {
-                value = values.get(0);
-            }
+            return InjectionUtils.createParameterObject(values, 
+                                                        pClass, 
+                                                        genericType,
+                                                        defaultValue,
+                                                        false,
+                                                        false);
         }
         
-        return value == null ? defaultValue : handleParameter(value, pClass);
+        return null;
     }
     
     public static MultivaluedMap<String, String> getMatrixParams(String path, boolean decode) {
@@ -444,7 +439,7 @@
     
     @SuppressWarnings("unchecked")
     private static Object processHeaderParam(Message m, String header, 
-                                             Class<?> pClass, String defaultValue) {
+                                             Class<?> pClass, Type genericType, String defaultValue) {
         Map<String, List<String>> headers = (Map<String, List<String>>)m.get(Message.PROTOCOL_HEADERS);
         List<String> values = headers.get(header);
         StringBuilder sb = new StringBuilder();
@@ -456,32 +451,70 @@
                 }
             }
         }
-        return sb.length() > 0 ? handleParameter(sb.toString(), pClass) : defaultValue;
+        return sb.length() > 0 ? InjectionUtils.handleParameter(sb.toString(), pClass) : defaultValue;
     }
     
     @SuppressWarnings("unchecked")
-    public static Object createHttpContextValue(Message m, Class<?> clazz) {
-                
-        if (UriInfo.class.isAssignableFrom(clazz)) {
-            MultivaluedMap<String, String> templateParams =
-                (MultivaluedMap<String, String>)m.get(URITemplate.TEMPLATE_PARAMETERS);
-            return new UriInfoImpl(m, templateParams);
+    private static Object processCookieParam(Message m, String cookieName, 
+                              Class<?> pClass, Type genericType, String defaultValue) {
+        Map<String, List<String>> headers = 
+            (Map<String, List<String>>)m.get(Message.PROTOCOL_HEADERS);
+        // get the cookie with this name...
+        List<String> values = headers.get("Cookie");
+        String value = "";
+        if (values != null && values.get(0).contains(cookieName + '=')) {
+            value = values.get(0);
         }
-        if (HttpHeaders.class.isAssignableFrom(clazz)) {
-            return new HttpHeadersImpl(m);
+        if (pClass.isAssignableFrom(Cookie.class)) {
+            return Cookie.valueOf(value.length() == 0 ? defaultValue : value);
         }
-        if (Request.class.isAssignableFrom(clazz)) {
-            return new RequestImpl(m);
-        }
-        if (SecurityContext.class.isAssignableFrom(clazz)) {
-            return new SecurityContextImpl(m);
+        return value.length() > 0 ? InjectionUtils.handleParameter(value, pClass) : defaultValue;
+    }
+    
+    @SuppressWarnings("unchecked")
+    public static Object createContextValue(Message m, Type genericType, Class<?> clazz) {
+ 
+        Object o = null;
+        if (UriInfo.class.isAssignableFrom(clazz)) {
+            o = createUriInfo(m);
+        } else if (HttpHeaders.class.isAssignableFrom(clazz)) {
+            o = new HttpHeadersImpl(m);
+        } else if (Request.class.isAssignableFrom(clazz)) {
+            o = new RequestImpl(m);
+        } else if (SecurityContext.class.isAssignableFrom(clazz)) {
+            o = new SecurityContextImpl(m);
+        } else if (MessageBodyWorkers.class.isAssignableFrom(clazz)) {
+            o = new MessageBodyWorkersImpl(m);
+        } else if (ContextResolver.class.isAssignableFrom(clazz)) {
+            o = createContextResolver(genericType, m);
         }
         
+        return o == null ? createServletResourceValue(m, clazz) : o;
+    }
+    
+    @SuppressWarnings("unchecked")
+    private static UriInfo createUriInfo(Message m) {
+        MultivaluedMap<String, String> templateParams =
+            (MultivaluedMap<String, String>)m.get(URITemplate.TEMPLATE_PARAMETERS);
+        return new UriInfoImpl(m, templateParams);
+    }
+    
+    public static ContextResolver<?> createContextResolver(Type genericType, Message m) {
+        if (genericType instanceof ParameterizedType) {
+            return ProviderFactory.getInstance().createContextResolver(
+                      ((ParameterizedType)genericType).getActualTypeArguments()[0], m);
+        }
         return null;
     }
 
-    public static Object createServletResourceValue(Message m, Class<?> clazz) {
+    public static Object createResourceValue(Message m, Class<?> clazz) {
                 
+        // lets assume we're aware of servlet types only that can be @Resource-annotated
+        return createServletResourceValue(m, clazz);
+    }
+    
+    private static Object createServletResourceValue(Message m, Class<?> clazz) {
+        
         if (HttpServletRequest.class.isAssignableFrom(clazz)) {
             return (HttpServletRequest) m.get(AbstractHTTPDestination.HTTP_REQUEST);
         }
@@ -496,68 +529,56 @@
     }
 
     private static Object readFromUriParam(PathParam uriParamAnnotation,
-                                           Class<?> parameter,
-                                           Type parameterType,
-                                           Annotation[] parameterAnnotations,
+                                           Class<?> paramType,
+                                           Type genericType,
                                            String path,
-                                           MultivaluedMap<String, String> values) {
+                                           MultivaluedMap<String, String> values,
+                                           boolean  decoded) {
         String parameterName = uriParamAnnotation.value();
-        if (parameterName == null || parameterName.length() == 0) {
-            // Invalid URI parameter name
-            return null;
-        }
-
-        String result = null;
-        List<String> results = values.get(parameterName);
-        if (values != null && values.size() > 0) {
-            result = results.get(results.size() - 1);
-        }
-        if (result != null) {
-            return handleParameter(result, parameter);
+        if ("".equals(parameterName)) {
+            return InjectionUtils.handleBean(paramType, values);
+        } else {
+            List<String> results = values.get(parameterName);
+            return InjectionUtils.createParameterObject(results, 
+                                                        paramType, 
+                                                        genericType,
+                                                        null,
+                                                        true,
+                                                        decoded);
         }
-        return result;
     }
     
-    private static Object handleParameter(String value, Class<?> pClass) {
-        if (pClass.isPrimitive()) {
-            return PrimitiveUtils.read(value, pClass);
-        }
-        // check constructors accepting a single String value
-        try {
-            Constructor<?> c = pClass.getConstructor(new Class<?>[]{String.class});
-            if (c !=  null) {
-                return c.newInstance(new Object[]{value});
-            }
-        } catch (Exception ex) {
-            // try valueOf
-        }
-        // check for valueOf(String) static methods
-        try {
-            Method m = pClass.getMethod("valueOf", new Class<?>[]{String.class});
-            if (m != null && Modifier.isStatic(m.getModifiers())) {
-                return m.invoke(null, new Object[]{value});
-            }
-        } catch (Exception ex) {
-            // no luck
-        }
-        return null;
-    }
+    
     
     //TODO : multiple query string parsing, do it once
-    private static Object readQueryString(QueryParam queryParam, Class<?> parameter,
-                                          Message m, String defaultValue) {
+    @SuppressWarnings("unchecked")
+    private static Object readQueryString(QueryParam queryParam,
+                                          Class<?> paramType,
+                                          Type genericType,
+                                          Message m, 
+                                          String defaultValue,
+                                          boolean decode) {
         String queryName = queryParam.value();
 
-        String result = getStructuredParams((String)m.get(Message.QUERY_STRING),
-                                   "&",
-                                   true).getFirst(queryName);
-
-        if (result != null) {
-            return handleParameter(result, parameter);
+        if ("".equals(queryName)) {
+            return InjectionUtils.handleBean(paramType, new UriInfoImpl(m, null).getQueryParameters());
+        } else {
+            List<String> results = getStructuredParams((String)m.get(Message.QUERY_STRING),
+                                       "&",
+                                       decode).get(queryName);
+    
+            return InjectionUtils.createParameterObject(results, 
+                                                        paramType, 
+                                                        genericType,
+                                                        defaultValue,
+                                                        false,
+                                                        false);
+             
         }
-        return result;  
     }
 
+    
+    
     /**
      * Retrieve map of query parameters from the passed in message
      * @param message
@@ -590,8 +611,13 @@
     }
 
     @SuppressWarnings("unchecked")
-    private static <T> Object readFromMessageBody(Class<T> targetTypeClass, InputStream is, 
-                                                  MediaType contentType, List<MediaType> consumeTypes) {
+    private static <T> Object readFromMessageBody(Class<T> targetTypeClass,
+                                                  Type parameterType,
+                                                  Annotation[] parameterAnnotations,
+                                                  InputStream is, 
+                                                  MediaType contentType, 
+                                                  List<MediaType> consumeTypes,
+                                                  Message m) {
         
         List<MediaType> types = JAXRSUtils.intersectMimeTypes(consumeTypes, contentType);
         
@@ -599,11 +625,18 @@
         
         for (MediaType type : types) { 
             provider = ProviderFactory.getInstance()
-                .createMessageBodyReader(targetTypeClass, type);
+                .createMessageBodyReader(targetTypeClass,
+                                         parameterType,
+                                         parameterAnnotations,
+                                         type,
+                                         m);
             // TODO : make the exceptions
             if (provider != null) {
                 try {
-                    return provider.readFrom(targetTypeClass, contentType, null, is);
+                    HttpHeaders headers = new HttpHeadersImpl(m);
+                    return provider.readFrom(
+                              targetTypeClass, parameterType, parameterAnnotations, contentType,
+                              headers.getRequestHeaders(), is);
                 } catch (IOException e) {
                     e.printStackTrace();
                     throw new RuntimeException("Error deserializing input stream into target class "
@@ -646,7 +679,7 @@
                 } else {
                     types = "";
                 }
-                acceptValues.add(MediaType.parse(tp));
+                acceptValues.add(MediaType.valueOf(tp));
             }
         } else {
             acceptValues.add(ALL_TYPES);
@@ -662,19 +695,26 @@
      * @param mimeTypesB 
      * @return return a list of intersected mime types
      */   
-    public static List<MediaType> intersectMimeTypes(List<MediaType> mimeTypesA, 
-                                                     List<MediaType> mimeTypesB) {
+    private static List<MediaType> doIntersectMimeTypes(List<MediaType> requiredMediaTypes, 
+                                                     List<MediaType> userMediaTypes) {
         Set<MediaType> supportedMimeTypeList = new LinkedHashSet<MediaType>();
 
-        for (MediaType mimeTypeA : mimeTypesA) {
-            for (MediaType mimeTypeB : mimeTypesB) {
-                if (mimeTypeB.isCompatible(mimeTypeA) || mimeTypeA.isCompatible(mimeTypeB)) {
+        for (MediaType requiredType : requiredMediaTypes) {
+            for (MediaType userType : userMediaTypes) {
+                if (requiredType.isCompatible(userType) || userType.isCompatible(requiredType)) {
                     
-                    String type = mimeTypeA.getType().equals(MediaType.MEDIA_TYPE_WILDCARD) 
-                                      ? mimeTypeB.getType() : mimeTypeA.getType();
-                    String subtype = mimeTypeA.getSubtype().equals(MediaType.MEDIA_TYPE_WILDCARD) 
-                                      ? mimeTypeB.getSubtype() : mimeTypeA.getSubtype();                  
-                    supportedMimeTypeList.add(new MediaType(type, subtype));
+                    for (Map.Entry<String, String> entry : requiredType.getParameters().entrySet()) {
+                        String value = userType.getParameters().get(entry.getKey());
+                        if (value != null && !value.equals(entry.getValue())) {
+                            continue;
+                        }
+                    }
+                    
+                    String type = requiredType.getType().equals(MediaType.MEDIA_TYPE_WILDCARD) 
+                                      ? userType.getType() : requiredType.getType();
+                    String subtype = requiredType.getSubtype().equals(MediaType.MEDIA_TYPE_WILDCARD) 
+                                      ? userType.getSubtype() : requiredType.getSubtype();                  
+                    supportedMimeTypeList.add(new MediaType(type, subtype, requiredType.getParameters()));
                 }
             }
         }
@@ -683,6 +723,18 @@
         
     }
     
+    public static List<MediaType> intersectMimeTypes(List<MediaType> requiredMediaTypes, 
+                                                     List<MediaType> userMediaTypes,
+                                                     boolean userTypes) {
+        return userTypes ? doIntersectMimeTypes(userMediaTypes, requiredMediaTypes)
+                         : doIntersectMimeTypes(requiredMediaTypes, userMediaTypes);
+    }
+    
+    public static List<MediaType> intersectMimeTypes(List<MediaType> requiredMediaTypes, 
+                                                     List<MediaType> userMediaTypes) {
+        return intersectMimeTypes(requiredMediaTypes, userMediaTypes, false);
+    }
+    
     public static List<MediaType> intersectMimeTypes(List<MediaType> mimeTypesA, 
                                                      MediaType mimeTypeB) {
         return intersectMimeTypes(mimeTypesA, 
@@ -696,7 +748,10 @@
     }
     
     public static List<MediaType> sortMediaTypes(String mediaTypes) {
-        List<MediaType> types = JAXRSUtils.parseMediaTypes(mediaTypes);
+        return sortMediaTypes(JAXRSUtils.parseMediaTypes(mediaTypes));
+    }
+    
+    public static List<MediaType> sortMediaTypes(List<MediaType> types) {
         if (types.size() > 1) {
             Collections.sort(types, new Comparator<MediaType>() {
 
@@ -709,36 +764,7 @@
         return types;
     }
     
-    public static void injectHttpContextValues(Object o,
-                                               OperationResourceInfo ori,
-                                               Message m) {
-        
-        for (Field f : ori.getClassResourceInfo().getHttpContexts()) {
-            Object value = createHttpContextValue(m, f.getType());
-            f.setAccessible(true);
-            try {
-                f.set(o, value);
-            } catch (IllegalAccessException ex) {
-                // ignore
-            }
-        }
-    }
     
-    public static void injectServletResourceValues(Object o,
-                                               OperationResourceInfo ori,
-                                               Message m) {
-        
-        for (Field f : ori.getClassResourceInfo().getResources()) {
-            Object value = createServletResourceValue(m, f.getType());
-            f.setAccessible(true);
-            try {
-                f.set(o, value);
-            } catch (IllegalAccessException ex) {
-                // ignore
-            }
-        }
-    }
-
     private static <K, V> MultivaluedMap<K, V> cloneMap(MultivaluedMap<K, V> map1) {
         
         MultivaluedMap<K, V> map2 = new MetadataMap<K, V>();
@@ -748,4 +774,25 @@
         return map2;
         
     }
+    
+    @SuppressWarnings("unchecked")
+    public static Response convertFaultToResponse(Throwable ex) {
+        
+        ExceptionMapper mapper = 
+            ProviderFactory.getInstance().createExceptionMapper(ex.getClass(),
+                                                                new MessageImpl());
+        if (mapper != null) {
+            Response excResponse = mapper.toResponse(ex);
+            if (excResponse != null) {
+                return excResponse;
+            }
+        } else if (ex instanceof WebApplicationException) {
+            WebApplicationException wex = (WebApplicationException)ex;
+            return wex.getResponse();
+        }
+        
+        return null;
+        
+    }
+        
 }

Added: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/Messages.properties?rev=673167&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/Messages.properties (added)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/Messages.properties Tue Jul  1 11:41:24 2008
@@ -0,0 +1,24 @@
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. The ASF licenses this file
+#    to you under the Apache License, Version 2.0 (the
+#    "License"); you may not use this file except in compliance
+#    with the License. You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing,
+#    software distributed under the License is distributed on an
+#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#    KIND, either express or implied. See the License for the
+#    specific language governing permissions and limitations
+#    under the License.
+#
+#
+NO_CONTENT_TYPE_SPECIFIED=No Content-Type specified for HTTP {0}
+METHOD_INJECTION_FAILURE=Method {0} injection failure
+FIELD_INJECTION_FAILURE=Field {0} injection failure
+CLASS_INSTANCIATION_FAILURE=Class {0} can not be instanciated

Propchange: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/Messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/resources/META-INF/services/javax.ws.rs.ext.RuntimeDelegate
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/resources/META-INF/services/javax.ws.rs.ext.RuntimeDelegate?rev=673167&r1=673166&r2=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/resources/META-INF/services/javax.ws.rs.ext.RuntimeDelegate (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/resources/META-INF/services/javax.ws.rs.ext.RuntimeDelegate Tue Jul  1 11:41:24 2008
@@ -1 +1 @@
-org.apache.cxf.jaxrs.provider.RuntimeDelegateImpl
\ No newline at end of file
+org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl
\ No newline at end of file

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/resources/schemas/jaxrs.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/resources/schemas/jaxrs.xsd?rev=673167&r1=673166&r2=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/resources/schemas/jaxrs.xsd (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/resources/schemas/jaxrs.xsd Tue Jul  1 11:41:24 2008
@@ -45,7 +45,9 @@
             <xsd:element name="properties" type="beans:mapType" minOccurs="0"/>
             <xsd:element name="serviceBeans" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="serviceFactory" type="xsd:anyType" minOccurs="0"/>
-            <xsd:element name="entityProviders" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="providers" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="extensionMappings" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="languageMappings" type="xsd:anyType" minOccurs="0"/>
           </xsd:all>
           <xsd:attributeGroup ref="cxf-beans:beanAttributes"/>
           <xsd:attribute name="address" type="xsd:string" />

Added: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java?rev=673167&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java (added)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java Tue Jul  1 11:41:24 2008
@@ -0,0 +1,222 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.jaxrs;
+
+import javax.annotation.Resource;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.ConsumeMime;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.MatrixParam;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.ProduceMime;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.SecurityContext;
+import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.MessageBodyWorkers;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.cxf.jaxrs.impl.PathSegmentImpl;
+
+public class Customer {
+    
+    @XmlRootElement(name = "CustomerBean")
+    public static class CustomerBean {
+        private String a;
+        private Long b;
+        public void setA(String aString) {
+            this.a = aString;
+        }
+        public void setB(Long bLong) {
+            this.b = bLong;
+        }
+        public String getA() {
+            return a;
+        }
+        public Long getB() {
+            return b;
+        }
+        
+    }
+    
+    @Context private ContextResolver<JAXBContext> cr;
+    private UriInfo uriInfo;
+    @Context private HttpHeaders headers;
+    @Context private Request request;
+    @Context private SecurityContext sContext;
+    @Context private MessageBodyWorkers bodyWorkers;
+    
+    @Resource private HttpServletRequest servletRequest;
+    @Resource private HttpServletResponse servletResponse;
+    @Resource private ServletContext servletContext;
+    @Context private HttpServletRequest servletRequest2;
+    @Context private HttpServletResponse servletResponse2;
+    @Context private ServletContext servletContext2;
+    
+    @Context private UriInfo uriInfo2;
+    private String queryParam;
+    
+    @QueryParam("b")
+    private String b;
+    
+    public String getB() {
+        return b;
+    }
+    
+    public void testQueryBean(@QueryParam("") CustomerBean cb) {
+        
+    }
+    public void testPathBean(@PathParam("") CustomerBean cb) {
+        
+    }
+    
+    public UriInfo getUriInfo() {
+        return uriInfo;
+    }
+    public UriInfo getUriInfo2() {
+        return uriInfo2;
+    }
+    
+    @Context
+    public void setUriInfo(UriInfo ui) {
+        uriInfo = ui;
+    }
+    
+    @QueryParam("a")
+    public void setA(String a) {
+        queryParam = a;
+    }
+    
+    public String getQueryParam() {
+        return queryParam;
+    }
+    
+    public HttpHeaders getHeaders() {
+        return headers;
+    }
+    
+    public Request getRequest() {
+        return request;
+    }
+    
+    public MessageBodyWorkers getBodyWorkers() {
+        return bodyWorkers;
+    }
+    
+    public SecurityContext getSecurityContext() {
+        return sContext;
+    }
+    
+    public HttpServletRequest getServletRequest() {
+        return servletRequest2;
+    }
+    
+    public HttpServletResponse getServletResponse() {
+        return servletResponse2;
+    }
+    
+    public ServletContext getServletContext() {
+        return servletContext2;
+    }
+    
+    public HttpServletRequest getServletRequestResource() {
+        return servletRequest;
+    }
+    
+    public HttpServletResponse getServletResponseResource() {
+        return servletResponse;
+    }
+    
+    public ServletContext getServletContextResource() {
+        return servletContext;
+    }
+    
+    public ContextResolver getContextResolver() {
+        return cr;
+    }
+
+    @ProduceMime("text/xml")
+    @ConsumeMime("text/xml")
+    public void test() {
+        // complete
+    }
+    
+    @ProduceMime("text/xml")   
+    public void getItAsXML() {
+        // complete
+    }
+    @ProduceMime("text/plain")   
+    public void getItPlain() {
+        // complete
+    }
+    
+    @ProduceMime("text/xml")   
+    public void testQuery(@QueryParam("query") String queryString, 
+                          @QueryParam("query") int queryInt) {
+        // complete
+    }
+    
+    @ProduceMime("text/xml")   
+    public void testMultipleQuery(@QueryParam("query")  String queryString, 
+                                  @QueryParam("query2") String queryString2,
+                                  @QueryParam("query3") Long queryString3,
+                                  @QueryParam("query4") boolean queryBoolean4,
+                                  @QueryParam("query5") String queryString4) {
+        // complete
+    }
+    
+    @ProduceMime("text/xml")   
+    public void testMatrixParam(@MatrixParam("p1")  String queryString, 
+                                @MatrixParam("p2") String queryString2) {
+        // complete
+    }
+    
+    public void testParams(@Context UriInfo info,
+                           @Context HttpHeaders hs,
+                           @Context Request r,
+                           @Context SecurityContext s,
+                           @Context MessageBodyWorkers workers,
+                           @HeaderParam("Foo") String h) {
+        // complete
+    }
+    
+    public void testServletParams(@Context HttpServletRequest req,
+                                  @Context HttpServletResponse res,
+                                  @Context ServletContext context) {
+        // complete
+    }
+    
+    @Path("{id1}/{id2}")
+    public void testConversion(@PathParam("id1") PathSegmentImpl id1,
+                               @PathParam("id2") SimpleFactory f) {
+        // complete
+    }
+    
+    public void testContextResolvers(@Context ContextResolver<JAXBContext> resolver) {
+        // complete
+    }
+};

Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/Customer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXBContextProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXBContextProvider.java?rev=673167&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXBContextProvider.java (added)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXBContextProvider.java Tue Jul  1 11:41:24 2008
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ 
+package org.apache.cxf.jaxrs;
+
+import javax.ws.rs.ext.ContextResolver;
+import javax.xml.bind.JAXBContext;
+
+public class JAXBContextProvider implements ContextResolver<JAXBContext> {
+
+    public JAXBContext getContext(Class type) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBeanTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBeanTest.java?rev=673167&r1=673166&r2=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBeanTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBeanTest.java Tue Jul  1 11:41:24 2008
@@ -23,6 +23,7 @@
 
 import javax.ws.rs.core.MultivaluedMap;
 
+import org.apache.cxf.jaxrs.impl.MetadataMap;
 import org.apache.cxf.jaxrs.model.ClassResourceInfo;
 import org.apache.cxf.jaxrs.model.MethodDispatcher;
 import org.apache.cxf.jaxrs.model.OperationResourceInfo;
@@ -83,43 +84,47 @@
         assertTrue(template.match("/bookstore/books/123", values));     
         assertTrue(rootCri.hasSubResources());   
         MethodDispatcher md = rootCri.getMethodDispatcher();
-        assertEquals(6, md.getOperationResourceInfos().size());  
+        assertEquals(7, md.getOperationResourceInfos().size());  
         for (OperationResourceInfo ori : md.getOperationResourceInfos()) {
-            if ("getDescription".equals(ori.getMethod().getName())) {
+            if ("getDescription".equals(ori.getMethodToInvoke().getName())) {
                 assertEquals("GET", ori.getHttpMethod());
                 assertEquals("/path", ori.getURITemplate().getValue());
                 assertEquals("text/bar", ori.getProduceTypes().get(0).toString());
                 assertEquals("text/foo", ori.getConsumeTypes().get(0).toString());
                 assertFalse(ori.isSubResourceLocator());
-            } else if ("getAuthor".equals(ori.getMethod().getName())) {
+            } else if ("getAuthor".equals(ori.getMethodToInvoke().getName())) {
                 assertEquals("GET", ori.getHttpMethod());
                 assertEquals("/path2", ori.getURITemplate().getValue());
                 assertEquals("text/bar2", ori.getProduceTypes().get(0).toString());
                 assertEquals("text/foo2", ori.getConsumeTypes().get(0).toString());
                 assertFalse(ori.isSubResourceLocator());
-            } else if ("getBook".equals(ori.getMethod().getName())) {
+            } else if ("getBook".equals(ori.getMethodToInvoke().getName())) {
+                assertNull(ori.getHttpMethod());
+                assertNotNull(ori.getURITemplate());
+                assertTrue(ori.isSubResourceLocator());
+            }  else if ("getNewBook".equals(ori.getMethodToInvoke().getName())) {
                 assertNull(ori.getHttpMethod());
                 assertNotNull(ori.getURITemplate());
                 assertTrue(ori.isSubResourceLocator());
-            } else if ("addBook".equals(ori.getMethod().getName())) {
+            }  else if ("addBook".equals(ori.getMethodToInvoke().getName())) {
                 assertEquals("POST", ori.getHttpMethod());
                 assertNotNull(ori.getURITemplate());
                 assertFalse(ori.isSubResourceLocator());
-            } else if ("updateBook".equals(ori.getMethod().getName())) {
+            } else if ("updateBook".equals(ori.getMethodToInvoke().getName())) {
                 assertEquals("PUT", ori.getHttpMethod());
                 assertNotNull(ori.getURITemplate());
                 assertFalse(ori.isSubResourceLocator());
-            } else if ("deleteBook".equals(ori.getMethod().getName())) {
+            } else if ("deleteBook".equals(ori.getMethodToInvoke().getName())) {
                 assertEquals("DELETE", ori.getHttpMethod());
                 assertNotNull(ori.getURITemplate());
                 assertFalse(ori.isSubResourceLocator());
             } else {
-                fail("unexpected OperationResourceInfo" + ori.getMethod().getName());
+                fail("unexpected OperationResourceInfo" + ori.getMethodToInvoke().getName());
             }
         }
         
         // Verify sub-resource ClassResourceInfo: Book
-        assertEquals(1, rootCri.getSubClassResourceInfo().size());
+        assertEquals(2, rootCri.getSubClassResourceInfo().size());
         ClassResourceInfo subCri = rootCri.getSubClassResourceInfo().get(0);        
         assertNull(subCri.getURITemplate());
         assertEquals(org.apache.cxf.jaxrs.resources.Book.class, subCri.getResourceClass());
@@ -141,7 +146,7 @@
                              String httpMethod, 
                              boolean isSubresource) {
         for (OperationResourceInfo ori : ops) {
-            if (opName.equals(ori.getMethod().getName())) {
+            if (opName.equals(ori.getMethodToInvoke().getName())) {
                 assertEquals(httpMethod, ori.getHttpMethod());
                 assertNotNull(ori.getURITemplate());
                 assertEquals(isSubresource, ori.isSubResourceLocator());

Added: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/SelectMethodCandidatesTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/SelectMethodCandidatesTest.java?rev=673167&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/SelectMethodCandidatesTest.java (added)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/SelectMethodCandidatesTest.java Tue Jul  1 11:41:24 2008
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.jaxrs;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.cxf.jaxrs.impl.MetadataMap;
+import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.model.OperationResourceInfo;
+import org.apache.cxf.jaxrs.model.URITemplate;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SelectMethodCandidatesTest extends Assert {
+    
+    @Test
+    public void testFindTargetResourceClassWithTemplates() throws Exception {
+        JAXRSServiceFactoryBean sf = new JAXRSServiceFactoryBean();
+        sf.setResourceClasses(org.apache.cxf.jaxrs.resources.TestResource.class);
+        sf.create();        
+        List<ClassResourceInfo> resources = ((JAXRSServiceImpl)sf.getService()).getClassResourceInfos();
+
+        String contentTypes = "*/*";
+        String acceptContentTypes = "*/*";
+
+        //If acceptContentTypes does not specify a specific Mime type, the  
+        //method is declared with a most specific ProduceMime type is selected.
+        MetadataMap<String, String> values = new MetadataMap<String, String>();
+        ClassResourceInfo resource = JAXRSUtils.selectResourceClass(resources, "/1/2/3/d/", values);
+        OperationResourceInfo ori = JAXRSUtils.findTargetMethod(resource, 
+                                    values.getFirst(URITemplate.FINAL_MATCH_GROUP), 
+                                    "GET", values, contentTypes, 
+                                    Collections.singletonList(MediaType.valueOf(acceptContentTypes)));
+        assertNotNull(ori);
+        assertEquals("listMethod needs to be selected", "listMethod", 
+                     ori.getMethodToInvoke().getName());
+        
+    }
+}

Copied: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProviderTest.java (from r651969, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/CacheControlHeaderProviderTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProviderTest.java?p2=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProviderTest.java&p1=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/CacheControlHeaderProviderTest.java&r1=651969&r2=673167&rev=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/CacheControlHeaderProviderTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/CacheControlHeaderProviderTest.java Tue Jul  1 11:41:24 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.jaxrs.provider;
+package org.apache.cxf.jaxrs.impl;
 
 import javax.ws.rs.core.CacheControl;
 
@@ -30,7 +30,7 @@
         
     @Test
     public void testFromSimpleString() {
-        CacheControl c = CacheControl.parse(
+        CacheControl c = CacheControl.valueOf(
             "public;must-revalidate");
         assertTrue(c.isPublic() && !c.isPrivate() && !c.isNoStore()
                    && c.isMustRevalidate() && !c.isProxyRevalidate());
@@ -41,7 +41,7 @@
     
     @Test
     public void testFromComplexString() {
-        CacheControl c = CacheControl.parse(
+        CacheControl c = CacheControl.valueOf(
             "private=\"foo\";no-cache=\"bar\";no-store;no-transform;"
             + "must-revalidate;proxy-revalidate;max-age=2;s-maxage=3");
         assertTrue(!c.isPublic() && c.isPrivate() && c.isNoStore()
@@ -58,7 +58,7 @@
     public void testToString() {
         String s = "private=\"foo\";no-cache=\"bar\";no-store;no-transform;"
             + "must-revalidate;proxy-revalidate;max-age=2;s-maxage=3";
-        String parsed = CacheControl.parse(s).toString();
+        String parsed = CacheControl.valueOf(s).toString();
         assertEquals(s, parsed);       
     }
 }

Copied: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/CookieHeaderProviderTest.java (from r651969, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/CookieHeaderProviderTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/CookieHeaderProviderTest.java?p2=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/CookieHeaderProviderTest.java&p1=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/CookieHeaderProviderTest.java&r1=651969&r2=673167&rev=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/CookieHeaderProviderTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/CookieHeaderProviderTest.java Tue Jul  1 11:41:24 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.jaxrs.provider;
+package org.apache.cxf.jaxrs.impl;
 
 import javax.ws.rs.core.Cookie;
 
@@ -29,21 +29,21 @@
         
     @Test
     public void testFromSimpleString() {
-        Cookie c = Cookie.parse("foo=bar");
+        Cookie c = Cookie.valueOf("foo=bar");
         assertTrue("bar".equals(c.getValue())
                    && "foo".equals(c.getName()));
     }
     
     @Test
     public void testNoValue() {
-        Cookie c = Cookie.parse("foo=");
+        Cookie c = Cookie.valueOf("foo=");
         assertTrue("".equals(c.getValue())
                    && "foo".equals(c.getName()));
     }
     
     @Test
     public void testFromComplexString() {
-        Cookie c = Cookie.parse("$Version=2;foo=bar;$Path=path;$Domain=domain");
+        Cookie c = Cookie.valueOf("$Version=2;foo=bar;$Path=path;$Domain=domain");
         assertTrue("bar".equals(c.getValue())
                    && "foo".equals(c.getName())
                    && 2 == c.getVersion()

Copied: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/EntityTagHeaderProviderTest.java (from r651969, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/EntityTagHeaderProviderTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/EntityTagHeaderProviderTest.java?p2=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/EntityTagHeaderProviderTest.java&p1=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/EntityTagHeaderProviderTest.java&r1=651969&r2=673167&rev=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/EntityTagHeaderProviderTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/EntityTagHeaderProviderTest.java Tue Jul  1 11:41:24 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.jaxrs.provider;
+package org.apache.cxf.jaxrs.impl;
 
 import javax.ws.rs.core.EntityTag;
 
@@ -29,13 +29,13 @@
       
     @Test
     public void testFromString() {
-        EntityTag tag = EntityTag.parse("\"\"");
+        EntityTag tag = EntityTag.valueOf("\"\"");
         assertTrue(!tag.isWeak() && "".equals(tag.getValue()));
-        tag = EntityTag.parse("W/");
+        tag = EntityTag.valueOf("W/");
         assertTrue(tag.isWeak() && "".equals(tag.getValue()));
-        tag = EntityTag.parse("W/\"12345\"");
+        tag = EntityTag.valueOf("W/\"12345\"");
         assertTrue(tag.isWeak() && "12345".equals(tag.getValue()));
-        tag = EntityTag.parse("\"12345\"");
+        tag = EntityTag.valueOf("\"12345\"");
         assertTrue(!tag.isWeak() && "12345".equals(tag.getValue()));
     }
     

Copied: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java (from r651969, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/HttpHeadersImplTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java?p2=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java&p1=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/HttpHeadersImplTest.java&r1=651969&r2=673167&rev=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/HttpHeadersImplTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java Tue Jul  1 11:41:24 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.jaxrs.provider;
+package org.apache.cxf.jaxrs.impl;
 
 import java.util.List;
 import java.util.Map;
@@ -25,7 +25,6 @@
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MultivaluedMap;
 
-import org.apache.cxf.jaxrs.MetadataMap;
 import org.apache.cxf.message.Message;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;

Copied: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProviderTest.java (from r651969, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/MediaTypeHeaderProviderTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProviderTest.java?p2=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProviderTest.java&p1=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/MediaTypeHeaderProviderTest.java&r1=651969&r2=673167&rev=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/MediaTypeHeaderProviderTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProviderTest.java Tue Jul  1 11:41:24 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.jaxrs.provider;
+package org.apache.cxf.jaxrs.impl;
 
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -32,23 +32,23 @@
     
     @Test
     public void testSimpleType() {
-        MediaType m = MediaType.parse("text/html");
+        MediaType m = MediaType.valueOf("text/html");
         assertEquals("Media type was not parsed correctly", 
                      m, new MediaType("text", "html"));
         assertEquals("Media type was not parsed correctly", 
-                     MediaType.parse("text/html "), new MediaType("text", "html"));
+                     MediaType.valueOf("text/html "), new MediaType("text", "html"));
     }
     
     @Test
     public void testShortWildcard() {
-        MediaType m = MediaType.parse("*");
+        MediaType m = MediaType.valueOf("*");
         assertEquals("Media type was not parsed correctly", 
                      m, new MediaType("*", "*"));
     }
     
     @Test
     public void testShortWildcardWithParameters() {
-        MediaType m = MediaType.parse("*;q=0.2");
+        MediaType m = MediaType.valueOf("*;q=0.2");
         assertEquals("Media type was not parsed correctly", 
                      m, new MediaType("*", "*"));
     }
@@ -76,7 +76,7 @@
     
     @Test
     public void testTypeWithParameters() {
-        MediaType m = MediaType.parse("text/html;q=1234;b=4321");
+        MediaType m = MediaType.valueOf("text/html;q=1234;b=4321");
         
         Map<String, String> params = new HashMap<String, String>();
         params.put("q", "1234");

Copied: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MetadataMapTest.java (from r651969, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/MetadataMapTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MetadataMapTest.java?p2=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MetadataMapTest.java&p1=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/MetadataMapTest.java&r1=651969&r2=673167&rev=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/MetadataMapTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MetadataMapTest.java Tue Jul  1 11:41:24 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.jaxrs;
+package org.apache.cxf.jaxrs.impl;
 
 import java.util.ArrayList;
 import java.util.List;

Copied: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProviderTest.java (from r651969, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/NewCookieHeaderProviderTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProviderTest.java?p2=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProviderTest.java&p1=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/NewCookieHeaderProviderTest.java&r1=651969&r2=673167&rev=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/NewCookieHeaderProviderTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/NewCookieHeaderProviderTest.java Tue Jul  1 11:41:24 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.jaxrs.provider;
+package org.apache.cxf.jaxrs.impl;
 
 import javax.ws.rs.core.NewCookie;
 
@@ -29,7 +29,7 @@
         
     @Test
     public void testFromSimpleString() {
-        NewCookie c = NewCookie.parse("foo=bar");
+        NewCookie c = NewCookie.valueOf("foo=bar");
         assertTrue("bar".equals(c.getValue())
                    && "foo".equals(c.getName()));
     }
@@ -37,8 +37,8 @@
         
     @Test
     public void testFromComplexString() {
-        NewCookie c = 
-            NewCookie.parse("foo=bar;Comment=comment;Path=path;Max-Age=10;Domain=domain;Secure;Version=1");
+        NewCookie c = NewCookie.valueOf(
+                      "foo=bar;Comment=comment;Path=path;Max-Age=10;Domain=domain;Secure;Version=1");
         assertTrue("bar".equals(c.getValue())
                    && "foo".equals(c.getName())
                    && 1 == c.getVersion()

Copied: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RequestImplTest.java (from r651969, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/RequestImplTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RequestImplTest.java?p2=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RequestImplTest.java&p1=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/RequestImplTest.java&r1=651969&r2=673167&rev=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/RequestImplTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RequestImplTest.java Tue Jul  1 11:41:24 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.jaxrs.provider;
+package org.apache.cxf.jaxrs.impl;
 
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -27,7 +27,6 @@
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.ResponseBuilder;
 
-import org.apache.cxf.jaxrs.MetadataMap;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.junit.After;

Copied: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImplTest.java (from r651969, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ResponseBuilderImplTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImplTest.java?p2=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImplTest.java&p1=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ResponseBuilderImplTest.java&r1=651969&r2=673167&rev=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ResponseBuilderImplTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseBuilderImplTest.java Tue Jul  1 11:41:24 2008
@@ -17,13 +17,12 @@
  * under the License.
  */
 
-package org.apache.cxf.jaxrs.provider;
+package org.apache.cxf.jaxrs.impl;
 
 import java.net.URI;
 
 import javax.ws.rs.core.Response;
 
-import org.apache.cxf.jaxrs.MetadataMap;
 import org.junit.Assert;
 import org.junit.Test;
 

Copied: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseImplTest.java (from r651969, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ResponseImplTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseImplTest.java?p2=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseImplTest.java&p1=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ResponseImplTest.java&r1=651969&r2=673167&rev=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ResponseImplTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/ResponseImplTest.java Tue Jul  1 11:41:24 2008
@@ -17,9 +17,8 @@
  * under the License.
  */
 
-package org.apache.cxf.jaxrs.provider;
+package org.apache.cxf.jaxrs.impl;
 
-import org.apache.cxf.jaxrs.MetadataMap;
 import org.junit.Assert;
 import org.junit.Test;
 

Copied: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RuntimeDelegateImplTest.java (from r651969, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/RuntimeDelegateImplTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RuntimeDelegateImplTest.java?p2=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RuntimeDelegateImplTest.java&p1=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/RuntimeDelegateImplTest.java&r1=651969&r2=673167&rev=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/RuntimeDelegateImplTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/RuntimeDelegateImplTest.java Tue Jul  1 11:41:24 2008
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.jaxrs.provider;
+package org.apache.cxf.jaxrs.impl;
 
 import javax.ws.rs.core.CacheControl;
 import javax.ws.rs.core.Cookie;

Copied: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java (from r651969, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/UriBuilderImplTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java?p2=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java&p1=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/UriBuilderImplTest.java&r1=651969&r2=673167&rev=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/UriBuilderImplTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java Tue Jul  1 11:41:24 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.jaxrs.provider;
+package org.apache.cxf.jaxrs.impl;
 
 import java.net.URI;
 

Copied: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriInfoImplTest.java (from r651969, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/UriInfoImplTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriInfoImplTest.java?p2=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriInfoImplTest.java&p1=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/UriInfoImplTest.java&r1=651969&r2=673167&rev=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/UriInfoImplTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriInfoImplTest.java Tue Jul  1 11:41:24 2008
@@ -17,12 +17,11 @@
  * under the License.
  */
 
-package org.apache.cxf.jaxrs.provider;
+package org.apache.cxf.jaxrs.impl;
 
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.UriInfo;
 
-import org.apache.cxf.jaxrs.MetadataMap;
 import org.apache.cxf.jaxrs.model.URITemplate;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
@@ -100,14 +99,14 @@
         
         UriInfoImpl u = new UriInfoImpl(mockMessage("http://localhost:8080/baz", "/bar"),
                                         values);
-        assertEquals("unexpected templates", 0, u.getTemplateParameters().size());
+        assertEquals("unexpected templates", 0, u.getPathParameters().size());
         
         values.clear();
         new URITemplate("/{id}").match("/bar%201", values);
         u = new UriInfoImpl(mockMessage("http://localhost:8080/baz", "/bar%201"),
                                         values);
         
-        MultivaluedMap<String, String> tps = u.getTemplateParameters(false);
+        MultivaluedMap<String, String> tps = u.getPathParameters(false);
         assertEquals("Number of templates is wrong", 1, tps.size());
         assertEquals("Wrong template value", tps.getFirst("id"), "bar%201");
         
@@ -116,7 +115,7 @@
         u = new UriInfoImpl(mockMessage("http://localhost:8080/baz", "/1%202/bar"),
                             values);
 
-        tps = u.getTemplateParameters();
+        tps = u.getPathParameters();
         assertEquals("Number of templates is wrong", 2, tps.size());
         assertEquals("Wrong template value", tps.getFirst("id"), "1 2");
         assertEquals("Wrong template value", tps.getFirst("baz"), "bar");
@@ -127,7 +126,7 @@
         
         u = new UriInfoImpl(mockMessage("http://localhost:8080/baz", "/bar"),
                                         values);
-        assertEquals("unexpected templates", 0, u.getTemplateParameters().size());
+        assertEquals("unexpected templates", 0, u.getPathParameters().size());
     }
     
     @Test

Copied: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/VariantListBuilderImplTest.java (from r651969, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/VariantListBuilderImplTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/VariantListBuilderImplTest.java?p2=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/VariantListBuilderImplTest.java&p1=cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/VariantListBuilderImplTest.java&r1=651969&r2=673167&rev=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/VariantListBuilderImplTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/VariantListBuilderImplTest.java Tue Jul  1 11:41:24 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.cxf.jaxrs.provider;
+package org.apache.cxf.jaxrs.impl;
 
 import java.util.List;
 

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/ClassResourceInfoTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/ClassResourceInfoTest.java?rev=673167&r1=673166&r2=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/ClassResourceInfoTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/ClassResourceInfoTest.java Tue Jul  1 11:41:24 2008
@@ -62,11 +62,11 @@
     @Test
     public void testGetHttpContexts() {
         ClassResourceInfo c = new ClassResourceInfo(TestClass.class);
-        List<Field> fields = c.getHttpContexts();
+        List<Field> fields = c.getContextFields();
         assertEquals("Only root classes should check these fields", 0, fields.size());
         
         c = new ClassResourceInfo(TestClass.class, true);
-        fields = c.getHttpContexts();
+        fields = c.getContextFields();
         assertEquals("2 http context fields available", 2, fields.size());
         assertTrue("Wrong fields selected", 
                    (fields.get(0).getType() == UriInfo.class
@@ -78,10 +78,10 @@
     @Test
     public void testGetResources() {
         ClassResourceInfo c = new ClassResourceInfo(TestClass.class);
-        List<Field> fields = c.getResources();
+        List<Field> fields = c.getResourceFields();
         assertEquals("Only root classes should check these fields", 0, fields.size());
         c = new ClassResourceInfo(TestClass.class, true);
-        fields = c.getResources();
+        fields = c.getResourceFields();
         
         Set<Class<?>> clses = new HashSet<Class<?>>(); 
         for (Field f : fields) {

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/URITemplateTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/URITemplateTest.java?rev=673167&r1=673166&r2=673167&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/URITemplateTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/URITemplateTest.java Tue Jul  1 11:41:24 2008
@@ -21,7 +21,7 @@
 
 import javax.ws.rs.core.MultivaluedMap;
 
-import org.apache.cxf.jaxrs.MetadataMap;
+import org.apache.cxf.jaxrs.impl.MetadataMap;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;



Mime
View raw message