cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmo...@apache.org
Subject svn commit: r979862 [6/19] - in /cxf/sandbox/oauth_1.0a: ./ api/ api/src/main/java/org/apache/cxf/ api/src/main/java/org/apache/cxf/endpoint/ api/src/main/java/org/apache/cxf/phase/ api/src/main/java/org/apache/cxf/ws/addressing/ api/src/main/java/org/...
Date Tue, 27 Jul 2010 20:47:12 GMT
Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java Tue Jul 27 20:46:55 2010
@@ -168,7 +168,7 @@ public class JAXBElementProvider extends
                 response = ((CollectionWrapper)response).getCollectionOrArray(theType, type); 
             }
             
-            response = checkAdapter(response, anns, false);
+            response = checkAdapter(response, type, anns, false);
             return response;
             
         } catch (JAXBException e) {
@@ -229,11 +229,12 @@ public class JAXBElementProvider extends
         MediaType m, MultivaluedMap<String, Object> headers, OutputStream os) 
         throws IOException {
         try {
-            Object actualObject = checkAdapter(obj, anns, true);
+            Object actualObject = checkAdapter(obj, cls, anns, true);
             Class<?> actualClass = obj != actualObject ? actualObject.getClass() : cls;
             String encoding = HttpUtils.getSetEncoding(m, headers, null);
             if (InjectionUtils.isSupportedCollectionOrArray(actualClass)) {
                 actualClass = InjectionUtils.getActualType(genericType);
+                actualClass = getActualType(actualClass, genericType, anns);
                 marshalCollection(cls, actualObject, actualClass, genericType, encoding, os, m);
             } else {
                 marshal(actualObject, actualClass, genericType, encoding, os, m);
@@ -319,7 +320,7 @@ public class JAXBElementProvider extends
     }
     
     protected void addAttachmentMarshaller(Marshaller ms) {
-        Collection<Attachment> attachments = getAttachments();
+        Collection<Attachment> attachments = getAttachments(true);
         if (attachments != null) {
             Object value = getContext().getContextualProperty(Message.MTOM_THRESHOLD);
             Integer threshold = value != null ? Integer.valueOf(value.toString()) : 0;
@@ -329,17 +330,19 @@ public class JAXBElementProvider extends
     }
     
     protected void addAttachmentUnmarshaller(Unmarshaller um) {
-        Collection<Attachment> attachments = getAttachments();
+        Collection<Attachment> attachments = getAttachments(false);
         if (attachments != null) {
             um.setAttachmentUnmarshaller(new JAXBAttachmentUnmarshaller(
                 attachments));
         }
     }
     
-    private Collection<Attachment> getAttachments() {
+    private Collection<Attachment> getAttachments(boolean write) {
         MessageContext mc = getContext();
         if (mc != null) {
-            return CastUtils.cast((Collection<?>)mc.get(Message.ATTACHMENTS));
+            // TODO: there has to be a better fix
+            String propertyName = write ? "WRITE-" + Message.ATTACHMENTS : Message.ATTACHMENTS;
+            return CastUtils.cast((Collection<?>)mc.get(propertyName));
         } else {
             return null;
         }

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java Tue Jul 27 20:46:55 2010
@@ -172,7 +172,7 @@ public class JSONProvider extends Abstra
             if (response instanceof JAXBElement && !JAXBElement.class.isAssignableFrom(type)) {
                 response = ((JAXBElement)response).getValue();    
             }
-            response = checkAdapter(response, anns, false);
+            response = checkAdapter(response, type, anns, false);
             return response;
             
         } catch (JAXBException e) {
@@ -254,7 +254,7 @@ public class JSONProvider extends Abstra
         throws IOException {
         try {
             
-            Object actualObject = checkAdapter(obj, anns, true);
+            Object actualObject = checkAdapter(obj, cls, anns, true);
             Class<?> actualClass = obj != actualObject ? actualObject.getClass() : cls;
             if (cls == genericType) {
                 genericType = actualClass;
@@ -263,6 +263,7 @@ public class JSONProvider extends Abstra
             
             if (InjectionUtils.isSupportedCollectionOrArray(actualClass)) {
                 actualClass = InjectionUtils.getActualType(genericType);
+                actualClass = getActualType(actualClass, genericType, anns);
                 marshalCollection(cls, actualObject, actualClass, genericType, encoding, os, m);
             } else {
                 marshal(actualObject, actualClass, genericType, encoding, os);

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java Tue Jul 27 20:46:55 2010
@@ -448,7 +448,7 @@ public final class ProviderFactory {
         List<MediaType> supportedMediaTypes = JAXRSUtils.getProviderConsumeTypes(ep);
         
         List<MediaType> availableMimeTypes = 
-            JAXRSUtils.intersectMimeTypes(Collections.singletonList(mediaType), supportedMediaTypes);
+            JAXRSUtils.intersectMimeTypes(Collections.singletonList(mediaType), supportedMediaTypes, false);
 
         if (availableMimeTypes.size() == 0) {
             return false;
@@ -501,7 +501,7 @@ public final class ProviderFactory {
         
         List<MediaType> availableMimeTypes = 
             JAXRSUtils.intersectMimeTypes(Collections.singletonList(mediaType),
-                                          supportedMediaTypes);
+                                          supportedMediaTypes, false);
 
         if (availableMimeTypes.size() == 0) {
             return false;

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java Tue Jul 27 20:46:55 2010
@@ -206,7 +206,6 @@ public class RequestDispatcherProvider e
         private String path;
         private String servletPath;
         
-        @SuppressWarnings("unchecked")
         public HttpServletRequestFilter(HttpServletRequest request, String path, String servletPath) {
             super(request);
             this.path = path;
@@ -247,7 +246,7 @@ public class RequestDispatcherProvider e
         }
         
         @Override
-        public Map getParameterMap() {
+        public Map<String, String[]> getParameterMap() {
             return params;
         }
         

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java Tue Jul 27 20:46:55 2010
@@ -33,19 +33,17 @@ import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyReader;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
 import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
 import org.w3c.dom.Document;
 
 import org.apache.cxf.jaxrs.ext.xml.XMLSource;
+import org.apache.cxf.staxutils.StaxUtils;
 
 @Provider
 @Produces({"application/xml", "application/*+xml", "text/xml" })
@@ -69,20 +67,21 @@ public class SourceProvider implements 
         if (DOMSource.class.isAssignableFrom(source) || Document.class.isAssignableFrom(source)) {
             
             boolean docRequired = Document.class.isAssignableFrom(source);
-            
-            Document doc = null;
-            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-            DocumentBuilder builder;
+            XMLStreamReader reader = StaxUtils.createXMLStreamReader(is);
             try {
-                builder = factory.newDocumentBuilder();
-                doc = builder.parse(is);
+                Document doc = StaxUtils.read(reader);
+                return docRequired ? doc : new DOMSource(doc);
             } catch (Exception e) {
                 IOException ioex = new IOException("Problem creating a Source object");
                 ioex.setStackTrace(e.getStackTrace());
                 throw ioex;
+            } finally {
+                try {
+                    reader.close();
+                } catch (XMLStreamException e) {
+                    //ignore
+                }
             }
-    
-            return docRequired ? doc : new DOMSource(doc);
         } else if (StreamSource.class.isAssignableFrom(source)
                    || Source.class.isAssignableFrom(source)) {
             return new StreamSource(is);
@@ -96,14 +95,26 @@ public class SourceProvider implements 
     public void writeTo(Source source, Class<?> clazz, Type genericType, Annotation[] annotations,  
         MediaType m, MultivaluedMap<String, Object> headers, OutputStream os)
         throws IOException {
-        StreamResult result = new StreamResult(os);
-        TransformerFactory tf = TransformerFactory.newInstance();
+        
+        String encoding = "utf-8"; //FIXME
+        
+        XMLStreamReader reader = StaxUtils.createXMLStreamReader(source);
+        XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(os, encoding);
         try {
-            Transformer t = tf.newTransformer();
-            t.transform(source, result);
-        } catch (TransformerException te) {
-            te.printStackTrace();
-            throw new WebApplicationException(te);
+            StaxUtils.copy(reader, writer);
+        } catch (XMLStreamException e) {
+            throw new WebApplicationException(e);
+        } finally {
+            try {
+                reader.close();
+            } catch (XMLStreamException e) {
+                //ignore
+            }
+            try {
+                writer.flush();
+            } catch (XMLStreamException e) {
+                //ignore
+            }
         }
     }
     

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XMLBeansJSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XMLBeansJSONProvider.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XMLBeansJSONProvider.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XMLBeansJSONProvider.java Tue Jul 27 20:46:55 2010
@@ -90,7 +90,7 @@ public class XMLBeansJSONProvider extend
             Map<String, String> nstojns = new HashMap<String, String>();
             XMLOutputFactory factory = new MappedXMLOutputFactory(nstojns);
             XMLStreamWriter xsw = factory.createXMLStreamWriter(os);
-
+            xsw.writeStartDocument();
             if (obj instanceof XmlObject) {
 
                 XmlObject xObj = (XmlObject)obj;

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java Tue Jul 27 20:46:55 2010
@@ -70,7 +70,7 @@ public class CXFNonSpringJaxrsServlet ex
         
         String applicationClass = servletConfig.getInitParameter(JAXRS_APPLICATION_PARAM);
         if (applicationClass != null) {
-            createServerFromApplication(applicationClass);
+            createServerFromApplication(applicationClass, servletConfig);
             return;
         }
         
@@ -255,7 +255,8 @@ public class CXFNonSpringJaxrsServlet ex
         
     }
     
-    protected void createServerFromApplication(String cName) throws ServletException {
+    protected void createServerFromApplication(String cName, ServletConfig servletConfig) 
+        throws ServletException {
         Class<?> appClass = loadClass(cName, "Application");
         Application app = null;
         try {
@@ -303,6 +304,10 @@ public class CXFNonSpringJaxrsServlet ex
         for (Map.Entry<Class, ResourceProvider> entry : map.entrySet()) {
             bean.setResourceProvider(entry.getKey(), entry.getValue());
         }
+        setSchemasLocations(bean, servletConfig);
+        setInterceptors(bean, servletConfig, OUT_INTERCEPTORS_PARAM);
+        setInterceptors(bean, servletConfig, IN_INTERCEPTORS_PARAM);
+        
         bean.create();
     }
     

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java Tue Jul 27 20:46:55 2010
@@ -29,6 +29,7 @@ import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 
 import org.apache.cxf.common.util.StringUtils;
@@ -59,16 +60,21 @@ public final class FormUtils {
         }
     }
     
-    public static String readBody(InputStream is) {
+    public static String readBody(InputStream is, MediaType mt) {
         try {
             ByteArrayOutputStream bos = new ByteArrayOutputStream();
             IOUtils.copy(is, bos, 1024);
-            return new String(bos.toByteArray(), "UTF-8");
+            return new String(bos.toByteArray(), getCharset(mt));
         } catch (Exception ex) {
             throw new WebApplicationException(ex);
         }
     }
     
+    private static String getCharset(MediaType mt) {
+        String charset = mt.getParameters().get("charset");
+        return charset == null ? "UTF-8" : charset;
+    }
+    
     public static void populateMapFromString(MultivaluedMap<String, String> params, 
                                              String postBody, boolean decode,
                                              HttpServletRequest request) {

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java Tue Jul 27 20:46:55 2010
@@ -822,7 +822,13 @@ public final class InjectionUtils {
         for (Method m : bean.getClass().getMethods()) {
             if (m.getName().startsWith("get") && m.getParameterTypes().length == 0 
                 && m.getName().length() > 3) {
-                String propertyName = m.getName().substring(3).toLowerCase();
+                String propertyName = m.getName().substring(3);
+                if (propertyName.length() == 1) {
+                    propertyName = propertyName.toLowerCase();
+                } else {
+                    propertyName = propertyName.substring(0, 1).toLowerCase()
+                                   + propertyName.substring(1);
+                }
                 if (baseName.contains(propertyName) || "class".equals(propertyName)) {
                     continue;
                 }
@@ -860,7 +866,7 @@ public final class InjectionUtils {
             if (m.getName().startsWith("get") && m.getParameterTypes().length == 0 
                 && m.getName().length() > 3) {
                 String propertyName = m.getName().substring(3).toLowerCase();
-                if ("class".equals(propertyName) 
+                if (m.getReturnType() == Class.class
                     || checkIgnorable && canPropertyBeIgnored(m, propertyName)) {
                     continue;
                 }

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java Tue Jul 27 20:46:55 2010
@@ -362,8 +362,21 @@ public final class JAXRSUtils {
             return ori;
         }
         
-        int status = pathMatched == 0 ? 404 : methodMatched == 0 ? 405 
-                     : consumeMatched == 0 ? 415 : produceMatched == 0 ? 406 : 404;
+        int status;
+        
+        if (pathMatched == 0) {
+            status = 404;
+        } else if (methodMatched == 0) {
+            status = 405;
+        } else if (consumeMatched == 0) {
+            status = 415;
+        } else if (produceMatched == 0) {
+            status = 406;
+        } else {
+            // this branch should not even be executed 
+            status = 404;
+        }
+        
         String name = resource.isRoot() ? "NO_OP_EXC" : "NO_SUBRESOURCE_METHOD_FOUND";
         org.apache.cxf.common.i18n.Message errorMsg = 
             new org.apache.cxf.common.i18n.Message(name, 
@@ -681,7 +694,7 @@ public final class JAXRSUtils {
             if (mt == null || mt.isCompatible(MediaType.APPLICATION_FORM_URLENCODED_TYPE)) {
                 String body = (String)m.get("org.apache.cxf.jaxrs.provider.form.body");
                 if (body == null) {
-                    body = FormUtils.readBody(m.getContent(InputStream.class));
+                    body = FormUtils.readBody(m.getContent(InputStream.class), mt);
                     m.put("org.apache.cxf.jaxrs.provider.form.body", body);
                 }
                 HttpServletRequest request = (HttpServletRequest)m.get(AbstractHTTPDestination.HTTP_REQUEST);
@@ -1039,7 +1052,8 @@ public final class JAXRSUtils {
      * @return return a list of intersected mime types
      */   
     public static List<MediaType> intersectMimeTypes(List<MediaType> requiredMediaTypes, 
-                                                     List<MediaType> userMediaTypes) {
+                                                     List<MediaType> userMediaTypes,
+                                                     boolean addRequiredParamsIfPossible) {
         Set<MediaType> supportedMimeTypeList = new LinkedHashSet<MediaType>();
 
         for (MediaType requiredType : requiredMediaTypes) {
@@ -1072,8 +1086,17 @@ public final class JAXRSUtils {
                     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, userType.getParameters()));
+                                      ? userType.getSubtype() : requiredType.getSubtype();
+                    Map<String, String> parameters = userType.getParameters();
+                    if (addRequiredParamsIfPossible) {
+                        parameters = new LinkedHashMap<String, String>(parameters);
+                        for (Map.Entry<String, String> entry : requiredType.getParameters().entrySet()) {
+                            if (!parameters.containsKey(entry.getKey())) {
+                                parameters.put(entry.getKey(), entry.getValue());
+                            }
+                        }
+                    }
+                    supportedMimeTypeList.add(new MediaType(type, subtype, parameters));
                 }
             }
         }
@@ -1085,13 +1108,14 @@ public final class JAXRSUtils {
     public static List<MediaType> intersectMimeTypes(List<MediaType> mimeTypesA, 
                                                      MediaType mimeTypeB) {
         return intersectMimeTypes(mimeTypesA, 
-                                  Collections.singletonList(mimeTypeB));
+                                  Collections.singletonList(mimeTypeB), false);
     }
     
     public static List<MediaType> intersectMimeTypes(String mimeTypesA, 
                                                      String mimeTypesB) {
         return intersectMimeTypes(parseMediaTypes(mimeTypesA),
-                                  parseMediaTypes(mimeTypesB));
+                                  parseMediaTypes(mimeTypesB),
+                                  false);
     }
     
     public static List<MediaType> sortMediaTypes(String mediaTypes) {

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProviderTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProviderTest.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProviderTest.java Tue Jul 27 20:46:55 2010
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.jaxrs.impl;
 
-import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
@@ -81,15 +80,14 @@ public class MediaTypeHeaderProviderTest
     
     @Test
     public void testTypeWithParameters() {
-        MediaType m = MediaType.valueOf("text/html;q=1234;b=4321");
+        MediaType mt = MediaType.valueOf("text/html;q=1234;b=4321");
         
-        Map<String, String> params = new HashMap<String, String>();
-        params.put("q", "1234");
-        params.put("b", "4321");
-        
-        MediaType expected = new MediaType("text", "html", params);
-        
-        assertEquals("Media type was not parsed correctly", expected, m);
+        assertEquals("text", mt.getType());
+        assertEquals("html", mt.getSubtype());
+        Map<String, String> params2 = mt.getParameters();
+        assertEquals(2, params2.size());
+        assertEquals("1234", params2.get("q"));
+        assertEquals("4321", params2.get("b"));
     }
     
     @Test
@@ -102,6 +100,23 @@ public class MediaTypeHeaderProviderTest
     }
     
     @Test
+    public void testHeaderFileName() {
+
+        String fileName = "version_2006&#65288;3&#65289;.pdf";
+        String header = "application/octet-stream; name=\"%s\"";
+        String value = String.format(header, fileName);
+        
+        MediaTypeHeaderProvider provider = new MediaTypeHeaderProvider();
+        MediaType mt = provider.fromString(value);
+        assertEquals("application", mt.getType());
+        assertEquals("octet-stream", mt.getSubtype());
+        Map<String, String> params = mt.getParameters();
+        assertEquals(1, params.size());
+        assertEquals("\"version_2006&#65288;3&#65289;.pdf\"", params.get("name"));
+        
+    }
+    
+    @Test
     public void testComplexToString() {
         MediaTypeHeaderProvider provider = 
             new MediaTypeHeaderProvider();

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java Tue Jul 27 20:46:55 2010
@@ -34,6 +34,7 @@ import org.apache.cxf.jaxrs.resources.Ur
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class UriBuilderImplTest extends Assert {
@@ -126,6 +127,18 @@ public class UriBuilderImplTest extends 
         assertEquals("URI is not built correctly", "http://bar/", newUri.toString());
     }
     
+    @Test(expected = IllegalArgumentException.class)
+    public void testNullPathWithBuildEncoded() throws Exception {
+        URI uri = new URI("http://bar");
+        new UriBuilderImpl(uri).path("{bar}").buildFromEncoded((Object[])null);
+    }
+    
+    @Test(expected = IllegalArgumentException.class)
+    public void testNullPathWithBuildEncoded2() throws Exception {
+        URI uri = new URI("http://bar");
+        new UriBuilderImpl(uri).path("{bar}").buildFromEncoded(new Object[] {null});
+    }
+    
     @Test
     public void testPathTrailingSlash2() throws Exception {
         URI uri = new URI("http://bar");
@@ -718,4 +731,193 @@ public class UriBuilderImplTest extends 
             JAXRSUtils.getStructuredParams(uri2.getRawQuery(), "&", false);
         assertEquals("Unexpected queries", queries1, queries2);
     }
+    
+    
+    @Test
+    public void testTck1() {
+        String value = "test1#test2";
+        String expected = "test1%23test2";
+        String path = "{arg1}";
+        URI uri = UriBuilder.fromPath(path).build(value);
+        assertEquals(expected, uri.toString());        
+    }
+    @Test
+    public void testNullValue() {
+        String value = null;
+        String path = "{arg1}";
+        try {
+            UriBuilder.fromPath(path).build(value);
+            fail("Should be IllegalArgumentException");
+        } catch (IllegalArgumentException ex) {
+            //expected
+        }
+    }
+    @Test
+    public void testFragment() {
+        String expected = "test#abc";
+        String path = "test";
+        URI uri = UriBuilder.fromPath(path).fragment("abc").build();
+        assertEquals(expected, uri.toString());        
+    }
+    @Test
+    @Ignore
+    public void testFragmentTemplate() {
+        String expected = "abc#xyz";
+        URI uri = UriBuilder
+            .fromPath("{arg1}")
+            .fragment("{arg2}")
+            .build("abc", "xyx");
+        assertEquals(expected, uri.toString());        
+    }
+    @Test
+    @Ignore
+    public void testSegments() {
+        String path1 = "ab";
+        String[] path2 = {"a1", "x/y", "3b "};
+        String expected = "ab/a1/x%2Fy/3b%20";
+
+        URI uri = UriBuilder.fromPath(path1).segment(path2).build();
+        assertEquals(expected, uri.toString());        
+    }
+    @Test
+    @Ignore
+    public void testSegments2() {
+        String path1 = "";
+        String[] path2 = {"a1", "/", "3b "};
+        String expected = "a1/%2F/3b%20";
+
+        URI uri = UriBuilder.fromPath(path1).segment(path2).build();
+        assertEquals(expected, uri.toString());        
+    }
+    @Test
+    @Ignore
+    public void testReplaceQuery3() {
+        String expected = "http://localhost:8080?name1=xyz";
+
+        URI uri = UriBuilder.fromPath("http://localhost:8080")
+            .queryParam("name", "x=", "y?", "x y", "&").replaceQuery("name1=xyz").build();
+        assertEquals(expected, uri.toString());        
+    }
+    
+    @Test
+    public void testNullSegment() {
+        try {
+            UriBuilder.fromPath("/").segment((String)null).build();
+            fail("Should be IllegalArgumentException");
+        } catch (IllegalArgumentException ex) {
+            //expected
+        }
+    }
+    @Test
+    public void testNullQueryParam() {
+        try {
+            UriBuilder.fromPath("http://localhost:8080").queryParam("hello", (String)null);
+            fail("Should be IllegalArgumentException");
+        } catch (IllegalArgumentException ex) {
+            //expected
+        }
+    }
+
+    @Test
+    @Ignore
+    public void testReplaceQuery4() {
+        String expected = "http://localhost:8080";
+
+        URI uri = UriBuilder.fromPath("http://localhost:8080")
+            .queryParam("name", "x=", "y?", "x y", "&").replaceQuery(null).build();
+        assertEquals(expected, uri.toString());        
+    }
+    @Test
+    @Ignore
+    public void testReplaceQuery5() {
+        String expected = "http://localhost:8080?name1=x&name2=%20&name3=x+y&name4=23&name5=x%20y";
+
+        URI uri = UriBuilder.fromPath("http://localhost:8080")
+            .queryParam("name", "x=", "y?", "x y", "&")
+            .replaceQuery("name1=x&name2=%20&name3=x+y&name4=23&name5=x y").build();
+        assertEquals(expected, uri.toString());        
+    }
+    @Test
+    @Ignore
+    public void testQueryParam() {
+        String expected = "http://localhost:8080?name=x%3D&name=y?&name=x+y&name=%26";
+
+        URI uri =  UriBuilder.fromPath("http://localhost:8080")
+            .queryParam("name", "x=", "y?", "x y", "&").build();
+        assertEquals(expected, uri.toString());        
+    }
+    @Test
+    public void testInvalidPort() {
+        try {
+            UriBuilder.fromUri("http://localhost:8080/some/path?name=foo").port(-10).build();
+            fail("Should be IllegalArgumentException");
+        } catch (IllegalArgumentException ex) {
+            //expected
+        }
+    }
+    @Test
+    public void testInvalidHost() {
+        try {
+            UriBuilder.fromUri("http://localhost:8080/some/path?name=foo").host("").build();
+            fail("Should be IllegalArgumentException");
+        } catch (IllegalArgumentException ex) {
+            //expected
+        }
+    }
+    @Test
+    @Ignore
+    public void testFromEncoded() {
+        String expected = "http://localhost:8080/a/%25/=/%25G0/%25/=";
+
+        URI uri = UriBuilder.fromPath("http://localhost:8080")
+            .path("/{v}/{w}/{x}/{y}/{z}/{x}")
+            .buildFromEncoded("a", "%25", "=", "%G0", "%", "23"); 
+        assertEquals(expected, uri.toString());        
+
+        expected = "http://localhost:8080/xy/%20/%25/xy";
+        uri = UriBuilder.fromPath("http://localhost:8080")
+            .path("/{x}/{y}/{z}/{x}")
+            .buildFromEncoded("xy", " ", "%");
+        assertEquals(expected, uri.toString());        
+    }
+    @Test
+    @Ignore
+    public void testNullMapValue() {
+        try {
+            Map<String, String> maps = new HashMap<String, String>();
+            maps.put("x", null);
+            maps.put("y", "/path-absolute/test1");
+            maps.put("z", "fred@example.com");
+            maps.put("w", "path-rootless/test2");
+            maps.put("u", "extra");
+
+            URI uri = UriBuilder.fromPath("")
+                .path("{w}/{x}/{y}/{z}/{x}")
+                .buildFromMap(maps);
+            
+            fail("Should be IllegalArgumentException.  Not return " + uri.toString());
+        } catch (IllegalArgumentException ex) {
+            //expected
+        }
+    }
+    @Test
+    @Ignore
+    public void testMissingMapValue() {
+        try {
+            Map<String, String> maps = new HashMap<String, String>();
+            maps.put("x", null);
+            maps.put("y", "/path-absolute/test1");
+            maps.put("z", "fred@example.com");
+            maps.put("w", "path-rootless/test2");
+            maps.put("u", "extra");
+
+            URI uri = UriBuilder.fromPath("")
+                .path("{w}/{v}/{x}/{y}/{z}/{x}")
+                .buildFromMap(maps);
+            
+            fail("Should be IllegalArgumentException.  Not return " + uri.toString());
+        } catch (IllegalArgumentException ex) {
+            //expected
+        }
+    }
 }

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/URITemplateTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/URITemplateTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/URITemplateTest.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/URITemplateTest.java Tue Jul 27 20:46:55 2010
@@ -26,6 +26,8 @@ import java.util.Map;
 import javax.ws.rs.core.MultivaluedMap;
 
 import org.apache.cxf.jaxrs.impl.MetadataMap;
+import org.apache.cxf.jaxrs.model.URITemplate.CurlyBraceTokenizer;
+
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java Tue Jul 27 20:46:55 2010
@@ -31,6 +31,7 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Response;
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.cxf.aegis.type.java5.IgnoreProperty;
@@ -102,6 +103,13 @@ public class BookStore {
         return new Chapter(1);
     }
     
+    @GET
+    @Path("chapter2")
+    @WadlElement(response = Chapter.class)
+    public Response getChaper2() {
+        return Response.ok().entity(new Chapter(1)).build();
+    }
+    
     @Path("form")
     public FormInterface getForm() {
         return new Book(1);
@@ -137,6 +145,10 @@ public class BookStore {
             return bean;
         }
         
+        public TestEnum getE() {
+            return TestEnum.A;
+        }
+        
     }
     
     public static class QueryBean2 {
@@ -171,4 +183,8 @@ public class BookStore {
             return b;
         }
     }
+    
+    public static enum TestEnum {
+        A;        
+    }
 }

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java Tue Jul 27 20:46:55 2010
@@ -329,14 +329,15 @@ public class WadlGeneratorTest extends A
         
         List<Element> resourceEls = DOMUtils.getChildrenWithName(resource, 
                                          WadlGenerator.WADL_NS, "resource");
-        assertEquals(7, resourceEls.size());        
+        assertEquals(8, resourceEls.size());        
         assertEquals("/book2", resourceEls.get(0).getAttribute("path"));
         assertEquals("/books/{bookid}", resourceEls.get(1).getAttribute("path"));
         assertEquals("/chapter", resourceEls.get(2).getAttribute("path"));
-        assertEquals("/books/{bookid}", resourceEls.get(3).getAttribute("path"));
-        assertEquals("/booksubresource", resourceEls.get(4).getAttribute("path"));
-        assertEquals("/form", resourceEls.get(5).getAttribute("path"));
-        assertEquals("/itself", resourceEls.get(6).getAttribute("path"));
+        assertEquals("/chapter2", resourceEls.get(3).getAttribute("path"));
+        assertEquals("/books/{bookid}", resourceEls.get(4).getAttribute("path"));
+        assertEquals("/booksubresource", resourceEls.get(5).getAttribute("path"));
+        assertEquals("/form", resourceEls.get(6).getAttribute("path"));
+        assertEquals("/itself", resourceEls.get(7).getAttribute("path"));
         
         // verify root resource starting with "/"
         // must have a single template parameter
@@ -419,17 +420,19 @@ public class WadlGeneratorTest extends A
         
         // verify resource starting with /chapter
         verifyGetResourceMethod(resourceEls.get(2), chapterEl);
+     // verify resource starting with /chapter2
+        verifyGetResourceMethod(resourceEls.get(3), chapterEl);
         
         // verify resource starting from /booksubresource
         // should have 2 parameters
-        paramsEls = DOMUtils.getChildrenWithName(resourceEls.get(4), 
+        paramsEls = DOMUtils.getChildrenWithName(resourceEls.get(5), 
                          WadlGenerator.WADL_NS, "param");
         assertEquals(2, paramsEls.size());
         checkParameter(paramsEls.get(0), "id", "template", "xs:int");
         checkParameter(paramsEls.get(1), "mid", "matrix", "xs:int");
         
         // should have 4 child resources
-        List<Element> subResourceEls = DOMUtils.getChildrenWithName(resourceEls.get(4), 
+        List<Element> subResourceEls = DOMUtils.getChildrenWithName(resourceEls.get(5), 
                                          WadlGenerator.WADL_NS, "resource");
         assertEquals(4, subResourceEls.size());        
         assertEquals("/book", subResourceEls.get(0).getAttribute("path"));

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java Tue Jul 27 20:46:55 2010
@@ -204,6 +204,29 @@ public class FormEncodingProviderTest ex
         assertEquals("Wrong entry for boo", "far", mvMap.getFirst("boo"));
 
     }
+    
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testReadFromISO() throws Exception {
+        
+        String eWithAcute = "\u00E9";
+        String helloStringUTF16 = "name=F" + eWithAcute + "lix";
+        
+        byte[] iso88591bytes = helloStringUTF16.getBytes("ISO-8859-1");
+        String helloStringISO88591 = new String(iso88591bytes, "ISO-8859-1");
+        
+        System.out.println(helloStringISO88591);
+        
+        MultivaluedMap<String, String> mvMap = 
+            (MultivaluedMap<String, String>)ferp.readFrom((Class)MultivaluedMap.class, null,
+                new Annotation[]{}, 
+                MediaType.valueOf(MediaType.APPLICATION_FORM_URLENCODED + ";charset=ISO-8859-1"), null, 
+                new ByteArrayInputStream(iso88591bytes));
+        String value = mvMap.getFirst("name");
+
+        System.out.println(value);
+
+    }
 
     @Test
     public void testReadable() {

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java Tue Jul 27 20:46:55 2010
@@ -383,7 +383,7 @@ public class JAXRSUtilsTest extends Asse
         List<MediaType> providerMimeTypes = 
             JAXRSUtils.parseMediaTypes("application/mytype, application/xml, application/json");
 
-        candidateList = JAXRSUtils.intersectMimeTypes(acceptedMimeTypes, providerMimeTypes);
+        candidateList = JAXRSUtils.intersectMimeTypes(acceptedMimeTypes, providerMimeTypes, false);
 
         assertEquals(3, candidateList.size());
         for (MediaType type : candidateList) {
@@ -779,11 +779,15 @@ public class JAXRSUtilsTest extends Asse
         Method m = Customer.class.getMethod("testFormBean", argType);
         MessageImpl messageImpl = new MessageImpl();
         messageImpl.put(Message.REQUEST_URI, "/bar");
+        MultivaluedMap<String, String> headers = new MetadataMap<String, String>();
+        headers.putSingle("Content-Type", MediaType.APPLICATION_FORM_URLENCODED);
+        messageImpl.put(Message.PROTOCOL_HEADERS, headers);
         String body = "a=aValue&b=123";
         messageImpl.setContent(InputStream.class, new ByteArrayInputStream(body.getBytes()));
 
         MessageImpl complexMessageImpl = new MessageImpl();
         complexMessageImpl.put(Message.REQUEST_URI, "/bar");
+        complexMessageImpl.put(Message.PROTOCOL_HEADERS, headers);
         body = "c=1&a=A&b=123&c=2&c=3&"
                                 + "d.c=4&d.a=B&d.b=456&d.c=5&d.c=6&"
                                 + "e.c=41&e.a=B1&e.b=457&e.c=51&e.c=61&"
@@ -961,6 +965,9 @@ public class JAXRSUtilsTest extends Asse
         MessageImpl messageImpl = new MessageImpl();
         String body = "p1=1&p2=2&p2=3";
         messageImpl.put(Message.REQUEST_URI, "/foo");
+        MultivaluedMap<String, String> headers = new MetadataMap<String, String>();
+        headers.putSingle("Content-Type", MediaType.APPLICATION_FORM_URLENCODED);
+        messageImpl.put(Message.PROTOCOL_HEADERS, headers);
         messageImpl.setContent(InputStream.class, new ByteArrayInputStream(body.getBytes()));
         List<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m, null), 
                                                            null, messageImpl);

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/pom.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/pom.xml (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/pom.xml Tue Jul 27 20:46:55 2010
@@ -32,6 +32,9 @@
         <relativePath>../../../parent/pom.xml</relativePath>
     </parent>
 
+    <properties>
+        <spi-dir>spi-2.1</spi-dir>
+    </properties>
     <dependencies>
         <dependency>
             <groupId>junit</groupId>
@@ -131,11 +134,10 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-servlet_2.5_spec</artifactId>
+            <groupId>${servlet-api.group}</groupId>
+            <artifactId>${servlet-api.artifact}</artifactId>
             <scope>provided</scope>
         </dependency>        
-
     </dependencies>
 
     <build>
@@ -156,6 +158,21 @@
                             </sources>
                         </configuration>
                     </execution>
+                    <execution>
+                         <id>add-spi</id>
+                         <phase>generate-resources</phase>
+                         <goals>
+                             <goal>add-resource</goal>
+                         </goals>
+                         <configuration>
+                             <resources>
+                                 <resource>
+                                     <directory>${basedir}/src/main/${spi-dir}</directory>
+                                 </resource>
+                             </resources>
+                         </configuration>
+                     </execution>
+
                 </executions>
             </plugin>
         </plugins>
@@ -164,6 +181,77 @@
 
     <profiles>
         <profile>
+            <id>jaxws22</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.geronimo.specs</groupId>
+                    <artifactId>geronimo-jaxws_2.2_spec</artifactId>
+                    <version>1.0</version>
+                </dependency>
+            </dependencies>
+            <properties>
+                <spi-dir>spi-2.2</spi-dir>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>build-helper-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>add-jaxws22-source</id>
+                                <phase>generate-sources</phase>
+                                <goals>
+                                    <goal>add-source</goal>
+                                </goals>
+                                <configuration>
+                                    <sources>
+                                        <source>${basedir}/src/main/jaxws22</source>
+                                    </sources>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-dependency-plugin</artifactId>
+                        <executions>
+                             <execution>
+                                 <id>create-endorsed-dir</id>
+                                 <phase>validate</phase>
+                                 <goals>
+                                     <goal>copy</goal>
+                                 </goals>
+                                 <configuration>
+                                     <artifactItems>
+                                         <artifactItem>
+                                             <groupId>org.apache.geronimo.specs</groupId>
+                                             <artifactId>geronimo-jaxws_2.2_spec</artifactId>
+                                             <version>1.0</version>
+                                             <outputDirectory>${basedir}/target/endorsed</outputDirectory>
+                                         </artifactItem>
+                                     </artifactItems>
+                                 </configuration>
+                             </execution>
+                         </executions>
+                    </plugin>
+                </plugins>
+                <pluginManagement>
+                    <plugins>
+                        <plugin>
+                            <groupId>org.apache.maven.plugins</groupId>
+                            <artifactId>maven-compiler-plugin</artifactId>
+                            <configuration>
+                                <compilerArguments>
+                                    <endorseddirs>${basedir}/target/endorsed</endorseddirs>
+                                </compilerArguments>
+                            </configuration>
+                        </plugin>
+                    </plugins>
+                </pluginManagement>
+            </build>
+        </profile>
+        <profile>
             <id>ibmjdk</id>
             <activation>
                 <property>
@@ -183,6 +271,9 @@
             <activation>
                 <jdk>1.5</jdk>
             </activation>
+            <properties>
+                <spi-dir>spi-2.2</spi-dir>
+            </properties>
             <dependencies>
                 <dependency>
                     <groupId>org.apache.geronimo.specs</groupId>
@@ -202,7 +293,7 @@
                 </dependency>
                 <dependency>
                      <groupId>org.apache.geronimo.specs</groupId>
-                     <artifactId>geronimo-jaxws_2.1_spec</artifactId>
+                     <artifactId>geronimo-jaxws_2.2_spec</artifactId>
                  </dependency>
                  <dependency>
                      <groupId>org.apache.geronimo.specs</groupId>
@@ -213,6 +304,28 @@
                      <artifactId>${saaj.impl.artifactId}</artifactId>
                  </dependency>
             </dependencies>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>build-helper-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>add-jaxws22-source</id>
+                                <phase>generate-sources</phase>
+                                <goals>
+                                    <goal>add-source</goal>
+                                </goals>
+                                <configuration>
+                                    <sources>
+                                        <source>${basedir}/src/main/jaxws22</source>
+                                    </sources>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
         </profile>
     </profiles>
 

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java Tue Jul 27 20:46:55 2010
@@ -19,7 +19,9 @@
 
 package org.apache.cxf.jaxws;
 
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.StringWriter;
 import java.net.HttpURLConnection;
 import java.util.Map;
 import java.util.concurrent.Future;
@@ -28,9 +30,13 @@ import java.util.logging.Logger;
 import javax.activation.DataSource;
 import javax.xml.bind.JAXBContext;
 import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPFault;
 import javax.xml.soap.SOAPMessage;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
 import javax.xml.ws.AsyncHandler;
 import javax.xml.ws.Binding;
 import javax.xml.ws.BindingProvider;
@@ -46,19 +52,27 @@ import javax.xml.ws.http.HTTPException;
 import javax.xml.ws.soap.SOAPBinding;
 import javax.xml.ws.soap.SOAPFaultException;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
+import org.apache.cxf.binding.soap.model.SoapOperationInfo;
 import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
 import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ClientCallback;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.interceptor.AttachmentOutInterceptor;
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
 import org.apache.cxf.jaxws.interceptors.MessageModeInInterceptor;
 import org.apache.cxf.jaxws.interceptors.MessageModeOutInterceptor;
+import org.apache.cxf.jaxws.support.JaxWsClientEndpointImpl;
 import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
@@ -67,6 +81,10 @@ import org.apache.cxf.service.model.Mess
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.staxutils.DepthXMLStreamReader;
+import org.apache.cxf.staxutils.StaxSource;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.addressing.WSAddressingFeature;
 
 public class DispatchImpl<T> implements Dispatch<T>, BindingProvider {
     private static final Logger LOG = LogUtils.getL7dLogger(DispatchImpl.class);
@@ -81,12 +99,14 @@ public class DispatchImpl<T> implements 
     private final Class<T> cl;
     private final JAXBContext context;
     private Message error;
+    private Service.Mode mode;
     
     DispatchImpl(Client client, Service.Mode m, JAXBContext ctx, Class<T> clazz) {
         this.binding = ((JaxWsEndpointImpl)client.getEndpoint()).getJaxwsBinding();
         this.builder = new EndpointReferenceBuilder((JaxWsEndpointImpl)client.getEndpoint());
 
         this.client = client;
+        this.mode = m;
         context = ctx;
         cl = clazz;
         setupEndpointAddressContext(client.getEndpoint());
@@ -247,7 +267,8 @@ public class DispatchImpl<T> implements 
     
     @SuppressWarnings("unchecked")
     public T invoke(T obj, boolean isOneWay) {
-        checkError();
+        StaxSource createdSource = null;
+        checkError();        
         try {
             if (obj instanceof SOAPMessage) {
                 SOAPMessage msg = (SOAPMessage)obj;
@@ -256,12 +277,56 @@ public class DispatchImpl<T> implements 
                 }
             }
             QName opName = (QName)getRequestContext().get(MessageContext.WSDL_OPERATION);
+                       
             if (opName == null) {
                 opName = new QName(DISPATCH_NS,
                                    isOneWay ? INVOKE_ONEWAY_NAME : INVOKE_NAME);
             }
+            
+            //CXF-2836 : find the operation for the dispatched object 
+            boolean wsaEnabled = false;
+            for (AbstractFeature feature : ((JaxWsClientEndpointImpl)client.getEndpoint()).getFeatures()) {
+                if (feature instanceof WSAddressingFeature) {
+                    wsaEnabled = true; 
+                }
+            }
+            Map<String, QName> payloadOPMap = 
+                createPayloadEleOpNameMap(client.getEndpoint().getBinding().getBindingInfo());
+            if (wsaEnabled && !payloadOPMap.isEmpty()) {
+                String payloadElementName = null;              
+                if (obj instanceof javax.xml.transform.Source) {
+                    try {
+                        XMLStreamReader reader = StaxUtils
+                            .createXMLStreamReader((javax.xml.transform.Source)obj);
+                        Document document = StaxUtils.read(reader);
+                        createdSource = new StaxSource(StaxUtils.createXMLStreamReader(document));
+                        payloadElementName = getPayloadElementName(document.getDocumentElement());
+                    } catch (Exception e) {                        
+                        // ignore, we are tring to get the operation name
+                    }
+                }
+                if (obj instanceof SOAPMessage) {
+                    payloadElementName = getPayloadElementName((SOAPMessage)obj);
+
+                }
+
+                if (this.context != null) {
+                    payloadElementName = getPayloadElementName(obj);
+                }
+
+                if (payloadElementName != null) {
+                    QName dispatchedOpName = payloadOPMap.get(payloadElementName);
+                    BindingOperationInfo bop = client.getEndpoint().getBinding().getBindingInfo()
+                        .getOperation(opName);
+                    if (bop != null) {
+                        bop.setProperty("dispatchToOperation", dispatchedOpName);
+                    }
+                }
+            } 
+            
+            
             Object ret[] = client.invokeWrapped(opName,
-                                                obj);
+                                                createdSource == null ? obj : createdSource);
             if (isOneWay || ret == null || ret.length == 0) {
                 return null;
             }
@@ -307,4 +372,90 @@ public class DispatchImpl<T> implements 
     public Client getClient() {
         return client;
     }
+    
+    private String getPayloadElementName(Element ele) {
+        XMLStreamReader xmlreader = StaxUtils.createXMLStreamReader(ele);
+        DepthXMLStreamReader reader = new DepthXMLStreamReader(xmlreader);
+        try {
+            if (this.mode == Service.Mode.PAYLOAD) {
+
+                StaxUtils.skipToStartOfElement(reader);
+
+                return reader.getName().toString();
+            }
+            if (this.mode == Service.Mode.MESSAGE) {
+                StaxUtils.skipToStartOfElement(reader);
+                StaxUtils.toNextTag(reader,
+                                    new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
+                reader.nextTag();
+                return reader.getName().toString();
+            }
+        } catch (XMLStreamException e) {
+            // ignore
+        }
+        return null;
+        
+    }
+    
+    
+    private String getPayloadElementName(SOAPMessage soapMessage) {
+        try {            
+            SOAPElement element  = (SOAPElement)soapMessage.getSOAPBody().getChildElements().next();
+            return new QName(element.getNamespaceURI(), element.getLocalName()).toString();
+        } catch (Exception e) {
+            //ignore
+        }
+        return null;
+        
+    }
+    
+    private String getPayloadElementName(Object object) {
+        JAXBDataBinding dataBinding = new JAXBDataBinding();
+        dataBinding.setContext(context);
+        DataWriter<XMLStreamWriter> dbwriter = dataBinding.createWriter(XMLStreamWriter.class);
+        StringWriter stringWriter = new StringWriter();
+        XMLStreamWriter resultWriter = StaxUtils.createXMLStreamWriter(stringWriter);
+        try {
+            dbwriter.write(object, resultWriter);
+            resultWriter.flush();
+            if (!StringUtils.isEmpty(stringWriter.toString())) {
+                ByteArrayInputStream binput = new ByteArrayInputStream(stringWriter.getBuffer().toString()
+                    .getBytes());
+                XMLStreamReader xmlreader = StaxUtils.createXMLStreamReader(binput);
+                DepthXMLStreamReader reader = new DepthXMLStreamReader(xmlreader);
+
+                StaxUtils.skipToStartOfElement(reader);
+
+                return reader.getName().toString();
+
+            }
+        } catch (XMLStreamException e) {
+            // ignore
+        }
+        return null;
+    }
+    
+    private Map<String, QName> createPayloadEleOpNameMap(BindingInfo bindingInfo) {
+        Map<String, QName> payloadElementMap = new java.util.HashMap<String, QName>();
+        for (BindingOperationInfo bop : bindingInfo.getOperations()) {
+            SoapOperationInfo soi = (SoapOperationInfo)bop.getExtensor(SoapOperationInfo.class);
+            if (soi != null) {
+                if ("document".equals(soi.getStyle())) {
+                    // if doc
+                    if (bop.getOperationInfo().getInput() != null
+                        && !bop.getOperationInfo().getInput().getMessageParts().isEmpty()) {
+                        QName qn = bop.getOperationInfo().getInput().getMessagePartByIndex(0)
+                            .getElementQName();
+                        payloadElementMap.put(qn.toString(), bop.getOperationInfo().getName());
+                    }
+                } else if ("rpc".equals(soi.getStyle())) {
+                    // if rpc
+                    payloadElementMap.put(bop.getOperationInfo().getName().toString(), bop.getOperationInfo()
+                        .getName());
+                }
+            }
+        }
+        return payloadElementMap;
+    }
+    
 }

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java Tue Jul 27 20:46:55 2010
@@ -268,6 +268,14 @@ public class EndpointImpl extends javax.
         return endpointName.toString() + ".jaxws-endpoint";
     }
 
+    protected JaxWsServerFactoryBean getServerFactory() {
+        return serverFactory;
+    }
+    
+    protected void setServerFactory(JaxWsServerFactoryBean bean) {
+        this.serverFactory = bean;
+    }
+    
     protected void checkProperties() {
         if (properties != null) {
             if (properties.containsKey("javax.xml.ws.wsdl.description")) {
@@ -428,6 +436,9 @@ public class EndpointImpl extends javax.
             if (serviceName == null) {
                 setServiceName(serverFactory.getServiceFactory().getServiceQName());
             }
+            if (endpointName == null) {
+                endpointName = endpoint.getEndpointInfo().getName();
+            }
 
         }
         return (ServerImpl) server;
@@ -764,11 +775,5 @@ public class EndpointImpl extends javax.
                 .getName()).toString());
         }
     }
-    
-    /*
-    //new in 2.2, but introduces a new class not found in 2.1
-    public void setEndpointContext(EndpointContext ctxt) {
-        //TODO - JAXWS 2.2
-    }
-    */
+
 }

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointReferenceBuilder.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointReferenceBuilder.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointReferenceBuilder.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointReferenceBuilder.java Tue Jul 27 20:46:55 2010
@@ -19,16 +19,27 @@
 
 package org.apache.cxf.jaxws;
 
+import java.util.Iterator;
+import java.util.List;
 import java.util.logging.Logger;
+
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.xml.namespace.QName;
+import javax.xml.transform.dom.DOMSource;
 import javax.xml.ws.EndpointReference;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
 import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
 
+import org.w3c.dom.Element;
+
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.jaxws.binding.soap.SOAPBindingImpl;
 import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
+import org.apache.cxf.ws.addressing.Names;
 
 public class EndpointReferenceBuilder {
     private static final Logger LOG = LogUtils.getL7dLogger(EndpointReferenceBuilder.class);
@@ -38,6 +49,35 @@ public class EndpointReferenceBuilder {
         this.endpoint = e;
     }
     public EndpointReference getEndpointReference() {
+        
+        //if there is epr in wsdl, direct return this EPR
+        List<ExtensibilityElement> portExtensors = endpoint.getEndpointInfo()
+            .getExtensors(ExtensibilityElement.class);
+        if (portExtensors != null) {
+            Iterator<ExtensibilityElement> extensionElements = portExtensors.iterator();
+            QName wsaEpr = new QName(Names.WSA_NAMESPACE_NAME, "EndpointReference");
+            while (extensionElements.hasNext()) {
+                ExtensibilityElement ext = (ExtensibilityElement)extensionElements.next();
+                if (ext instanceof UnknownExtensibilityElement && wsaEpr.equals(ext.getElementType())) {
+                    Element eprEle = ((UnknownExtensibilityElement)ext).getElement();
+                    List<Element> addressElements = DOMUtils.getChildrenWithName(eprEle,
+                                                                                 Names.WSA_NAMESPACE_NAME,
+                                                                                 Names.WSA_ADDRESS_NAME);
+                    if (!addressElements.isEmpty()) {
+                        /*
+                         * [WSA-WSDL Binding] : in a SOAP 1.1 port described using WSDL 1.1, the location
+                         * attribute of a soap11:address element (if present) would have the same value as the
+                         * wsa:Address child element of the wsa:EndpointReference element.
+                         */
+                        addressElements.get(0).setTextContent(this.endpoint.getEndpointInfo().getAddress());
+                    }
+                    return W3CEndpointReference.readFrom(new DOMSource(eprEle));
+                }
+
+            }
+        }
+        
+        
         String bindingId = endpoint.getJaxwsBinding().getBindingID();   
         
         if (!SOAPBindingImpl.isSoapBinding(bindingId)) {
@@ -45,16 +85,17 @@ public class EndpointReferenceBuilder {
                                                                 LOG, bindingId).toString());
         }
         
-        W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
-        
+        W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();      
         builder.address(this.endpoint.getEndpointInfo().getAddress());
+        
         builder.serviceName(this.endpoint.getService().getName());
         builder.endpointName(this.endpoint.getEndpointInfo().getName());
-        if (this.endpoint.getEndpointInfo().getService()
-                .getDescription() != null) {
-            builder.wsdlDocumentLocation(this.endpoint.getEndpointInfo().getService()
-                                         .getDescription().getBaseURI());
+
+        if (this.endpoint.getEndpointInfo().getService().getDescription() != null) {
+            builder.wsdlDocumentLocation(this.endpoint.getEndpointInfo().getService().getDescription()
+                .getBaseURI());
         }
+        
         return builder.build();
     }
 

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointUtils.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointUtils.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointUtils.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointUtils.java Tue Jul 27 20:46:55 2010
@@ -52,16 +52,26 @@ public final class EndpointUtils {
     }
     
     private static boolean hasWebServiceProviderAnnotation(Class<?> cls) {
-        if (cls != null) {
-            return cls.isAnnotationPresent(WebServiceProvider.class);
+        if (cls == null) {
+            return false;
         }
-        
-        return false;
+        if (null != cls.getAnnotation(WebServiceProvider.class)) {
+            return true;
+        }
+        for (Class<?> inf : cls.getInterfaces()) {
+            if (null != inf.getAnnotation(WebServiceProvider.class)) {
+                return true;
+            }
+        }
+        return hasWebServiceProviderAnnotation(cls.getSuperclass());
     }
     
     public static boolean isValidImplementor(Object implementor) {
-        if (Provider.class.isAssignableFrom(implementor.getClass())
-            && hasWebServiceProviderAnnotation(implementor.getClass())) {
+        return isValidImplementor(implementor.getClass());
+    }
+    public static boolean isValidImplementor(Class<?> implementorClass) {
+        if (Provider.class.isAssignableFrom(implementorClass)
+            && hasWebServiceProviderAnnotation(implementorClass)) {
             return true;
         }
 
@@ -69,11 +79,13 @@ public final class EndpointUtils {
         // annotation
         // (that implements an SEI) OR a Provider
 
-        if (hasWebServiceAnnotation(implementor.getClass())) {
+        if (hasWebServiceAnnotation(implementorClass)) {
             return true;
         }
 
         LOG.info("Implementor is not annotated with WebService annotation.");
         return false;
     } 
+    
+    
 }

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java Tue Jul 27 20:46:55 2010
@@ -104,7 +104,13 @@ public class JaxWsProxyFactoryBean exten
 
     protected Class[] getImplementingClasses() {
         Class cls = getClientFactoryBean().getServiceClass();
-        return new Class[] {cls, BindingProvider.class};
+        Class ret[] = new Class[] {cls, BindingProvider.class};
+        try {
+            Proxy.getProxyClass(cls.getClassLoader(), ret);
+        } catch (Throwable t) {
+            ret = new Class[] {cls};
+        }
+        return ret;
     }
     
     /**

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java Tue Jul 27 20:46:55 2010
@@ -61,6 +61,8 @@ import org.apache.cxf.service.model.Bind
 public class JaxWsServerFactoryBean extends ServerFactoryBean {
     protected boolean doInit;
     protected List<Handler> handlers = new ArrayList<Handler>();
+
+    private boolean blockPostConstruct;
     
     public JaxWsServerFactoryBean() {
         this(new JaxWsServiceFactoryBean());
@@ -74,7 +76,9 @@ public class JaxWsServerFactoryBean exte
         setBindingConfig(defConfig);
         doInit = true;
     }
-    
+    public JaxWsServiceFactoryBean getJaxWsServiceFactory() {
+        return (JaxWsServiceFactoryBean)getServiceFactory();
+    }
     public void setHandlers(List<Handler> h) {
         handlers.clear();
         handlers.addAll(h);
@@ -233,11 +237,27 @@ public class JaxWsServerFactoryBean exte
             ResourceInjector injector = new ResourceInjector(resourceManager);
             if (Proxy.isProxyClass(instance.getClass()) && getServiceClass() != null) {
                 injector.inject(instance, getServiceClass());
-                injector.construct(instance, getServiceClass());
+                if (!blockPostConstruct) {
+                    injector.construct(instance, getServiceClass());
+                }
             } else {
                 injector.inject(instance);
-                injector.construct(instance);
+                if (!blockPostConstruct) {
+                    injector.construct(instance);
+                }
             }
         }
-    }  
+    }
+
+    /**
+     * 
+     * @param blockPostConstruct @PostConstruct method will not be called 
+     *  if this property is set to true - this may be necessary in cases
+     *  when the @PostConstruct method needs to be called at a later stage,
+     *  for example, when a higher level container does its own injection.  
+     */
+    public void setBlockPostConstruct(boolean blockPostConstruct) {
+        this.blockPostConstruct = blockPostConstruct;
+    }
+      
 }

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Tue Jul 27 20:46:55 2010
@@ -626,6 +626,7 @@ public class ServiceImpl extends Service
         if (executor != null) {
             client.getEndpoint().setExecutor(executor);
         }
+                
         Dispatch<T> disp = new DispatchImpl<T>(client, mode, type);
         configureObject(disp);
         return disp;
@@ -675,6 +676,7 @@ public class ServiceImpl extends Service
         if (executor != null) {
             client.getEndpoint().setExecutor(executor);
         }
+        
         Dispatch<Object> disp = new DispatchImpl<Object>(client, mode, 
                                                          context, Object.class);
         configureObject(disp);
@@ -705,5 +707,7 @@ public class ServiceImpl extends Service
         client.getOutInterceptors().addAll(clientFact.getOutInterceptors());
         client.getInFaultInterceptors().addAll(clientFact.getInFaultInterceptors());
         client.getOutFaultInterceptors().addAll(clientFact.getOutFaultInterceptors());
-    }
+    }    
 }
+
+

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java Tue Jul 27 20:46:55 2010
@@ -33,6 +33,7 @@ import java.util.logging.Logger;
 
 import javax.xml.bind.annotation.XmlAttachmentRef;
 import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlList;
 import javax.xml.bind.annotation.XmlMimeType;
 import javax.xml.bind.annotation.XmlNsForm;
@@ -102,7 +103,8 @@ public final class WrapperClassGenerator
                 if (anno.annotationType() == XmlList.class 
                     || anno.annotationType() == XmlAttachmentRef.class
                     || anno.annotationType() == XmlJavaTypeAdapter.class
-                    || anno.annotationType() == XmlMimeType.class) {
+                    || anno.annotationType() == XmlMimeType.class
+                    || anno.annotationType() == XmlElementWrapper.class) {
                     list.add(anno);
                 }
             }
@@ -395,7 +397,14 @@ public final class WrapperClassGenerator
                 av0.visit("defaultValue", el.defaultValue());
                 av0.visit("type", el.type());
                 av0.visitEnd(); 
-                
+            } else if (ann instanceof XmlElementWrapper) {
+                XmlElementWrapper el = (XmlElementWrapper)ann;
+                av0 = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlElementWrapper;", true);
+                av0.visit("name", el.name());
+                av0.visit("nillable", el.nillable());
+                av0.visit("requried", el.required());
+                av0.visit("namespace", el.namespace());
+                av0.visitEnd(); 
             }
         }
         return addedEl;

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java Tue Jul 27 20:46:55 2010
@@ -288,7 +288,10 @@ public class AnnotationHandlerChainBuild
         return clazz.getResource(name);
     }
     
-    private HandlerChainAnnotation findHandlerChainAnnotation(Class<?> clz, boolean searchSEI) {        
+    private HandlerChainAnnotation findHandlerChainAnnotation(Class<?> clz, boolean searchSEI) {
+        if (clz == null) {
+            return null;
+        }
         if (LOG.isLoggable(Level.FINE)) {
             LOG.fine("Checking for HandlerChain annotation on " + clz.getName());
         }
@@ -325,6 +328,9 @@ public class AnnotationHandlerChainBuild
                         break;
                     }
                 }
+                if (hcAnn == null) {
+                    hcAnn = findHandlerChainAnnotation(clz.getSuperclass(), false);
+                }
             }
         } else {
             hcAnn = new HandlerChainAnnotation(ann, clz);

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java Tue Jul 27 20:46:55 2010
@@ -35,9 +35,7 @@ import javax.xml.stream.XMLStreamExcepti
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
 import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.ws.LogicalMessage;
 import javax.xml.ws.Service;
@@ -49,7 +47,6 @@ import org.w3c.dom.Node;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.common.WSDLConstants;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Message;
@@ -148,8 +145,7 @@ public class LogicalMessageImpl implemen
             if (obj instanceof StreamSource) {
                 try {
                     CachedOutputStream cos = new CachedOutputStream();
-                    Transformer transformer = XMLUtils.newTransformer();
-                    transformer.transform(obj, new StreamResult(cos));
+                    StaxUtils.copy(obj, cos);
 
                     obj = new StreamSource(cos.getInputStream());
                     message.setContent(Source.class, new StreamSource(cos.getInputStream()));
@@ -164,9 +160,7 @@ public class LogicalMessageImpl implemen
             } else {
                 try {
                     CachedOutputStream cos = new CachedOutputStream();
-                    Transformer transformer = XMLUtils.newTransformer();
-
-                    transformer.transform(obj, new StreamResult(cos));
+                    StaxUtils.copy(obj, cos);
                     InputStream in = cos.getInputStream();
                     SOAPMessage msg = initSOAPMessage(in);
                     source = new DOMSource(((SOAPMessage)msg).getSOAPBody().getFirstChild());

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java Tue Jul 27 20:46:55 2010
@@ -277,7 +277,7 @@ public class SOAPHandlerInterceptor exte
                     }
                 }
             }
-            if (msg.getSOAPPart().getEnvelope().getBody() != null 
+            if (isRequestor(message) && msg.getSOAPPart().getEnvelope().getBody() != null 
                 && msg.getSOAPPart().getEnvelope().getBody().hasFault()) {
                 return null;
             }            



Mime
View raw message