cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmo...@apache.org
Subject svn commit: r979862 [5/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/core/src/main/java/org/apache/cxf/bus/resource/ResourceManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/bus/resource/ResourceManagerImpl.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/bus/resource/ResourceManagerImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/bus/resource/ResourceManagerImpl.java Tue Jul 27 20:46:55 2010
@@ -19,9 +19,7 @@
 
 package org.apache.cxf.bus.resource;
 
-import java.util.Collection;
 import java.util.List;
-import java.util.Map;
 
 import javax.annotation.Resource;
 
@@ -31,7 +29,6 @@ import org.apache.cxf.configuration.Conf
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.resource.DefaultResourceManager;
 import org.apache.cxf.resource.ObjectTypeResolver;
-import org.apache.cxf.resource.PropertiesResolver;
 import org.apache.cxf.resource.ResourceManager;
 import org.apache.cxf.resource.ResourceResolver;
 
@@ -43,23 +40,18 @@ public class ResourceManagerImpl extends
     public ResourceManagerImpl() {
     }
 
-    public ResourceManagerImpl(List<? extends ResourceResolver> r) {
-        super(r);
-    }
     public ResourceManagerImpl(Bus b) {
         super();
         setBus(b);
-    }
-    public ResourceManagerImpl(Bus b, List<? extends ResourceResolver> r) {
-        super(r);
-        setBus(b);
-    }
-
-    public ResourceManagerImpl(Map<String, Object> properties) { 
-        super();
-        registeredResolvers.clear();
-        
-        registeredResolvers.add(new PropertiesResolver(properties));
+    } 
+    protected void onFirstResolve() {
+        super.onFirstResolve();
+        if (bus != null) {
+            ConfiguredBeanLocator locator = bus.getExtension(ConfiguredBeanLocator.class);
+            if (locator != null) {
+                this.addResourceResolvers(locator.getBeansOfType(ResourceResolver.class));
+            }
+        }
     }
 
     /**
@@ -71,25 +63,15 @@ public class ResourceManagerImpl extends
         registeredResolvers.addAll(resolvers);
     }
     
-    public final void addResolvers(Collection<? extends ResourceResolver> resolvers) {
-        super.addResourceResolvers(resolvers);
-    }
-    public final void addResolver(ResourceResolver resolver) {
-        super.addResourceResolver(resolver);
-    }
-    
     @Resource
     public final void setBus(Bus b) {
         if (bus != b) {
             bus = b;
+            firstCalled = false;
             super.addResourceResolver(new ObjectTypeResolver(bus));
             if (null != bus) {
                 bus.setExtension(this, ResourceManager.class);
             }
-            ConfiguredBeanLocator locator = bus.getExtension(ConfiguredBeanLocator.class);
-            if (locator != null) {
-                this.addResolvers(locator.getBeansOfType(ResourceResolver.class));
-            }
         }
     }
 

Modified: cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java Tue Jul 27 20:46:55 2010
@@ -21,10 +21,10 @@ package org.apache.cxf.bus.spring;
 
 
 
-import org.apache.cxf.Bus;
 import org.apache.cxf.common.injection.ResourceInjector;
 import org.apache.cxf.resource.ResourceManager;
 import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
 import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
@@ -63,17 +63,24 @@ public class Jsr250BeanPostProcessor 
     }
     private ResourceManager getResourceManager(Object bean) {
         if (resourceManager == null) {
+            boolean temp = isProcessing;
+            isProcessing = false;
             if (bean instanceof ResourceManager) {
                 resourceManager = (ResourceManager)bean;
                 resourceManager.addResourceResolver(new BusApplicationContextResourceResolver(context));
             } else {
-                Bus b = (Bus)context.getBean("cxf");
-                ResourceManager m = b.getExtension(ResourceManager.class);
+                ResourceManager m = null;
+                try {
+                    m = (ResourceManager)context.getBean(ResourceManager.class.getName());
+                } catch (NoSuchBeanDefinitionException t) {
+                    //ignore - no resource manager
+                }
                 if (resourceManager == null && m != null) {
                     resourceManager = m;
                     resourceManager.addResourceResolver(new BusApplicationContextResourceResolver(context));
                 }
             }
+            isProcessing = temp;
         }
         return resourceManager;
     }

Modified: cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/databinding/source/NodeDataReader.java Tue Jul 27 20:46:55 2010
@@ -24,16 +24,16 @@ import java.util.Collection;
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.Schema;
 
+import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
-import org.xml.sax.InputSource;
-
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.databinding.DataReader;
@@ -42,6 +42,8 @@ import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.staxutils.StaxSource;
+import org.apache.cxf.staxutils.StaxUtils;
 
 public class NodeDataReader implements DataReader<Node> {
     private static final Logger LOG = LogUtils.getL7dLogger(NodeDataReader.class);
@@ -52,16 +54,8 @@ public class NodeDataReader implements D
 
     public Object read(QName name, Node input, Class type) {
         if (SAXSource.class.isAssignableFrom(type)) {
-            try {
-                CachedOutputStream out = new CachedOutputStream();
-                DOMUtils.writeXml(input, out);
-                
-                return new SAXSource(new InputSource(out.getInputStream()));
-            } catch (IOException e) {
-                throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
-            } catch (TransformerException e) {
-                throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
-            }
+            XMLStreamReader reader = StaxUtils.createXMLStreamReader((Element)input);
+            return new StaxSource(reader);
         } else if (StreamSource.class.isAssignableFrom(type)) {
             try {
                 CachedOutputStream out = new CachedOutputStream();                

Modified: cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Tue Jul 27 20:46:55 2010
@@ -378,18 +378,47 @@ public class ClientImpl
     public void invoke(ClientCallback callback,
                        BindingOperationInfo oi,
                        Object... params) throws Exception {
+        invoke(callback, oi, params, null, null);
+    }
+    
+    public void invoke(ClientCallback callback,
+                       BindingOperationInfo oi,
+                       Object[] params,
+                       Map<String, Object> context) throws Exception {
+        invoke(callback, oi, params, context, null);
+    }
+    
+    public void invoke(ClientCallback callback,
+                       BindingOperationInfo oi,
+                       Object[] params,
+                       Exchange exchange) throws Exception {
+        invoke(callback, oi, params, null, exchange);
+    }
+    
+    @SuppressWarnings("unchecked")
+    public void invoke(ClientCallback callback,
+                       BindingOperationInfo oi,
+                       Object[] params,
+                       Map<String, Object> context,
+                       Exchange exchange) throws Exception {
         Bus origBus = BusFactory.getThreadDefaultBus(false);
         BusFactory.setThreadDefaultBus(bus);
         try {
-            Exchange exchange = new ExchangeImpl();
+            if (exchange == null) {
+                exchange = new ExchangeImpl();
+            }
             exchange.setSynchronous(false);
             Endpoint endpoint = getEndpoint();
-            Map<String, Object> context = new HashMap<String, Object>();
-            Map<String, Object> resp = getResponseContext();
-            resp.clear();
-            Map<String, Object> reqContext = new HashMap<String, Object>(getRequestContext());
-            context.put(RESPONSE_CONTEXT, resp);
-            context.put(REQUEST_CONTEXT, reqContext);
+            if (context == null) {
+                context = new HashMap<String, Object>();
+                Map<String, Object> resp = getResponseContext();
+                resp.clear();
+                Map<String, Object> reqContext = new HashMap<String, Object>(getRequestContext());
+                context.put(RESPONSE_CONTEXT, resp);
+                context.put(REQUEST_CONTEXT, reqContext);
+            }
+                        
+            Map<String, Object> reqContext = (Map<String, Object>)context.get(REQUEST_CONTEXT);
 
             Message message = endpoint.getBinding().createMessage();
             message.put(Message.INVOCATION_CONTEXT, context);

Modified: cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java Tue Jul 27 20:46:55 2010
@@ -127,14 +127,14 @@ public class EndpointImpl extends Abstra
             BindingFactory bf = null;
             try {
                 bf = bus.getExtension(BindingFactoryManager.class).getBindingFactory(namespace);
+                if (null == bf) {
+                    Message msg = new Message("NO_BINDING_FACTORY", BUNDLE, namespace);
+                    throw new EndpointException(msg);
+                }
                 binding = bf.createBinding(bi);
             } catch (BusException ex) {
                 throw new EndpointException(ex);
             }
-            if (null == bf) {
-                Message msg = new Message("NO_BINDING_FACTORY", BUNDLE, namespace);
-                throw new EndpointException(msg);
-            }
         }    
     }
     

Modified: cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java Tue Jul 27 20:46:55 2010
@@ -38,13 +38,14 @@ import org.apache.cxf.staxutils.StaxUtil
 public class WrappedOutInterceptor extends AbstractOutDatabindingInterceptor {
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(WrappedOutInterceptor.class);
 
-    private WrappedOutEndingInterceptor ending = new WrappedOutEndingInterceptor();
+    private final WrappedOutEndingInterceptor ending;
     
     public WrappedOutInterceptor() {
         this(Phase.MARSHAL);
     }
     public WrappedOutInterceptor(String phase) {
         super(phase);
+        ending = new WrappedOutEndingInterceptor(phase + "-ending");
         addBefore(BareOutInterceptor.class.getName());
     }
 
@@ -90,8 +91,8 @@ public class WrappedOutInterceptor exten
     }
     
     public class WrappedOutEndingInterceptor extends AbstractOutDatabindingInterceptor {
-        public WrappedOutEndingInterceptor() {
-            super(Phase.MARSHAL_ENDING);
+        public WrappedOutEndingInterceptor(String phase) {
+            super(phase);
         }
 
         public void handleMessage(Message message) throws Fault {

Modified: cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java Tue Jul 27 20:46:55 2010
@@ -19,20 +19,37 @@
 
 package org.apache.cxf.service.factory;
 
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Logger;
+
+import javax.xml.transform.dom.DOMSource;
+
+import org.w3c.dom.Document;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.databinding.AbstractDataBinding;
 import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.interceptor.OneWayProcessorInterceptor;
 import org.apache.cxf.interceptor.OutgoingChainInterceptor;
 import org.apache.cxf.interceptor.ServiceInvokerInterceptor;
+import org.apache.cxf.resource.ResourceManager;
+import org.apache.cxf.resource.URIResolver;
 import org.apache.cxf.service.Service;
 
 public abstract class AbstractServiceFactoryBean {
+    private static final Logger LOG = LogUtils.getL7dLogger(AbstractServiceFactoryBean.class);
+    
     protected boolean dataBindingSet;
+    protected List<String> schemaLocations;
 
     private Bus bus;
     private DataBinding dataBinding;
@@ -63,6 +80,9 @@ public abstract class AbstractServiceFac
     }
     
     protected void initializeDataBindings() {
+        if (getDataBinding() instanceof AbstractDataBinding && schemaLocations != null) {
+            fillDataBindingSchemas();
+        }
         getDataBinding().initialize(getService());
         
         service.setDataBinding(getDataBinding());
@@ -106,5 +126,33 @@ public abstract class AbstractServiceFac
     protected void setService(Service service) {
         this.service = service;
     }
+    
+    private void fillDataBindingSchemas() {
+        ResourceManager rr = getBus().getExtension(ResourceManager.class);
+        List<DOMSource> schemas = new ArrayList<DOMSource>();
+        for (String l : schemaLocations) {
+            URL url = rr.resolveResource(l, URL.class);
+            if (url == null) {
+                URIResolver res;
+                try {
+                    res = new URIResolver(l);
+                } catch (IOException e) {
+                    throw new ServiceConstructionException(new Message("INVALID_SCHEMA_URL", LOG, l), e);
+                }
+                if (!res.isResolved()) {
+                    throw new ServiceConstructionException(new Message("INVALID_SCHEMA_URL", LOG, l));
+                }
+                url = res.getURL();
+            }
+            Document d;
+            try {
+                d = DOMUtils.readXml(url.openStream());
+            } catch (Exception e) {
+                throw new ServiceConstructionException(new Message("ERROR_READING_SCHEMA", LOG, l), e);
+            }
+            schemas.add(new DOMSource(d, url.toString()));
+        }
+        ((AbstractDataBinding)getDataBinding()).setSchemas(schemas);
+    }
  
 }

Modified: cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java Tue Jul 27 20:46:55 2010
@@ -87,6 +87,9 @@ public class AnnotationsFactoryBeanListe
         }
         case SERVER_CREATED: {
             Class<?> cls = (Class<?>)args[2];
+            if (cls == null) {
+                return;
+            }
             Server server = (Server)args[0];
             Bus bus = factory.getBus();
             addGZipSupport(server.getEndpoint(), bus, cls.getAnnotation(GZIP.class));

Modified: cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/service/factory/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/service/factory/Messages.properties?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/service/factory/Messages.properties (original)
+++ cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/service/factory/Messages.properties Tue Jul 27 20:46:55 2010
@@ -19,3 +19,5 @@
 #
 #
 NO_METHOD_FOR_OP=No method was found for the WSDL operation {0}.
+INVALID_SCHEMA_URL=Could not load schema {0}
+ERROR_READING_SCHEMA=There was an error reading the schema {0}.
\ No newline at end of file

Modified: cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java Tue Jul 27 20:46:55 2010
@@ -59,7 +59,6 @@ import org.w3c.dom.Element;
 
 import com.ibm.wsdl.extensions.schema.SchemaImpl;
 import org.apache.cxf.Bus;
-import org.apache.cxf.NSManager;
 import org.apache.cxf.common.WSDLConstants;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.XMLUtils;
@@ -77,6 +76,7 @@ import org.apache.cxf.service.model.Mess
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.ws.addressing.NSManager;
 import org.apache.cxf.wsdl.WSDLManager;
 
 /**

Modified: cxf/sandbox/oauth_1.0a/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentSerializerTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentSerializerTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentSerializerTest.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentSerializerTest.java Tue Jul 27 20:46:55 2010
@@ -43,7 +43,16 @@ import org.junit.Test;
 public class AttachmentSerializerTest extends Assert {
     
     @Test
-    public void testMessageWrite() throws Exception {
+    public void testMessageWriteXopOn() throws Exception {
+        doTestMessageWrite(true);
+    }
+    
+    @Test
+    public void testMessageWriteXopOff() throws Exception {
+        doTestMessageWrite(false);
+    }
+    
+    private void doTestMessageWrite(boolean xop) throws Exception {
         MessageImpl msg = new MessageImpl();
         
         Collection<Attachment> atts = new ArrayList<Attachment>();
@@ -64,6 +73,10 @@ public class AttachmentSerializerTest ex
         msg.setContent(OutputStream.class, out);
         
         AttachmentSerializer serializer = new AttachmentSerializer(msg);
+        if (!xop) {
+            // default is "on"
+            serializer.setXop(xop);
+        }
         
         serializer.writeProlog();
 
@@ -84,8 +97,14 @@ public class AttachmentSerializerTest ex
         MimeMultipart multipart = (MimeMultipart) inMsg.getContent();
         
         MimeBodyPart part = (MimeBodyPart) multipart.getBodyPart(0);
-        assertEquals("application/xop+xml; charset=UTF-8; type=\"application/soap+xml\";", 
-                     part.getHeader("Content-Type")[0]);
+        if (xop) {
+            assertEquals("application/xop+xml; charset=UTF-8; type=\"application/soap+xml\";", 
+                         part.getHeader("Content-Type")[0]);
+        } else {
+            assertEquals("text/xml; charset=UTF-8; type=\"application/soap+xml\";", 
+                         part.getHeader("Content-Type")[0]);
+        }
+        
         assertEquals("binary", part.getHeader("Content-Transfer-Encoding")[0]);
         assertEquals("<root.message@cxf.apache.org>", part.getHeader("Content-ID")[0]);
         
@@ -101,7 +120,7 @@ public class AttachmentSerializerTest ex
         assertEquals("application/octet-stream", part2.getHeader("Content-Type")[0]);
         assertEquals("binary", part2.getHeader("Content-Transfer-Encoding")[0]);
         assertEquals("<test.xml>", part2.getHeader("Content-ID")[0]);
-        
+
     }
     
     @Test

Modified: cxf/sandbox/oauth_1.0a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java Tue Jul 27 20:46:55 2010
@@ -565,14 +565,7 @@ public class BeanType extends AegisType 
             }
         }
 
-        BeanTypeInfo elementTypeInfo;
-        if (beanType != null) {
-            elementTypeInfo = beanType.getTypeInfo();
-        } else {
-            // didn't find a bean type so just use this bean's type info
-            elementTypeInfo = getTypeInfo();
-        }
-        return elementTypeInfo;
+        return beanType.getTypeInfo();
     }
 
     /**

Modified: cxf/sandbox/oauth_1.0a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java Tue Jul 27 20:46:55 2010
@@ -44,6 +44,6 @@ public class BigDecimalType extends Aegi
 
     @Override
     public void writeObject(final Object object, final MessageWriter writer, final Context context) {
-        writer.writeValue(object.toString());
+        writer.writeValue(((BigDecimal)object).toPlainString());
     }
 }

Modified: cxf/sandbox/oauth_1.0a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/xml/DocumentType.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/xml/DocumentType.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/xml/DocumentType.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/xml/DocumentType.java Tue Jul 27 20:46:55 2010
@@ -18,9 +18,6 @@
  */
 package org.apache.cxf.aegis.type.xml;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
@@ -43,21 +40,7 @@ import org.apache.cxf.staxutils.StaxUtil
  * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
  */
 public class DocumentType extends AegisType {
-    private DocumentBuilder builder;
-
     public DocumentType() {
-        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-        factory.setNamespaceAware(true);
-        try {
-            builder = factory.newDocumentBuilder();
-        } catch (ParserConfigurationException e) {
-            throw new DatabindingException("Couldn't load document builder.", e);
-        }
-        setWriteOuter(false);
-    }
-
-    public DocumentType(DocumentBuilder builder) {
-        this.builder = builder;
         setWriteOuter(false);
     }
 
@@ -67,7 +50,7 @@ public class DocumentType extends AegisT
             XMLStreamReader reader = ((ElementReader)mreader).getXMLStreamReader();
             // we need to eat the surrounding element.
             reader.nextTag();
-            Object tree = StaxUtils.read(builder, new FragmentStreamReader(reader), true);
+            Object tree = StaxUtils.read(null, new FragmentStreamReader(reader), true);
             reader.nextTag(); // eat the end tag.
             return tree;
         } catch (XMLStreamException e) {

Modified: cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/pom.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/pom.xml (original)
+++ cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/pom.xml Tue Jul 27 20:46:55 2010
@@ -33,29 +33,6 @@
     <build>
         <plugins>
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>unpack-schemas</id>
-                        <phase>process-test-sources</phase>
-                        <goals>
-                            <goal>unpack</goal>
-                        </goals>
-                        <configuration>
-                            <outputDirectory>${project.build.directory}/generated/src/test/resources</outputDirectory>
-                            <artifactItems>
-                                <artifactItem>
-                                    <groupId>org.apache.cxf</groupId>
-                                    <artifactId>cxf-common-schemas</artifactId>
-                                    <version>${project.version}</version>
-                                </artifactItem>
-                            </artifactItems>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
                 <groupId>org.apache.cxf</groupId>
                 <artifactId>cxf-xjc-plugin</artifactId>
                 <version>${cxf.xjc-utils.version}</version>
@@ -139,7 +116,7 @@
              <dependencies>
                  <dependency>
                      <groupId>org.apache.geronimo.specs</groupId>
-                     <artifactId>geronimo-jaxws_2.1_spec</artifactId>
+                     <artifactId>geronimo-jaxws_2.2_spec</artifactId>
                      <scope>test</scope>
                  </dependency>
                  <dependency>

Modified: cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java Tue Jul 27 20:46:55 2010
@@ -34,7 +34,6 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.StringTokenizer;
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.logging.Level;
@@ -43,7 +42,9 @@ import java.util.logging.Logger;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
 
+import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 import org.xml.sax.EntityResolver;
@@ -74,6 +75,7 @@ import org.apache.cxf.service.Service;
 import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.staxutils.StaxUtils;
 /**
  * This class reads a WSDL and creates a dynamic client from it.
  * 
@@ -421,42 +423,18 @@ public class DynamicClientFactory {
             compiler.parseSchema(key, el);
             num++;
         }
-        
-        if (simpleBindingEnabled && isJaxb21(compiler)) {
+        if (simpleBindingEnabled) {
             String id = "/org/apache/cxf/endpoint/dynamic/simple-binding.xjb";
-            LOG.info("Loading the JAXB 2.1 simple binding for client.");
-            InputSource source = new InputSource(getClass().getResourceAsStream(id));
-            source.setSystemId(id);
-            compiler.parseSchema(source);
-        }
-    }
-    
-    private boolean isJaxb21(SchemaCompiler sc) {
-        String id = sc.getOptions().getBuildID();
-        StringTokenizer st = new StringTokenizer(id, ".");
-        String minor = null;
-        
-        // major version
-        if (st.hasMoreTokens()) {
-            st.nextToken();
-        }
-        
-        if (st.hasMoreTokens()) {
-            minor = st.nextToken();
-        }
-        
-        try {
-            int i = Integer.valueOf(minor);
-            if (i >= 1) {
-                return true;
+            LOG.fine("Loading the JAXB 2.1 simple binding for client.");
+            try {
+                Document doc = StaxUtils.read(getClass().getResourceAsStream(id));
+                compiler.parseSchema(id, doc.getDocumentElement());
+            } catch (XMLStreamException e) {
+                LOG.log(Level.WARNING, "Could not parse simple-binding.xsd", e);
             }
-        } catch (NumberFormatException e) {
-            // do nothing;
         }
-        
-        return false;
     }
-
+    
     public boolean isSimpleBindingEnabled() {
         return simpleBindingEnabled;
     }

Propchange: cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java
            ('svn:mergeinfo' removed)

Modified: cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java Tue Jul 27 20:46:55 2010
@@ -20,6 +20,7 @@
 package org.apache.cxf.jaxb.io;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
 import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -28,6 +29,7 @@ import javax.xml.bind.JAXBException;
 import javax.xml.bind.PropertyException;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.ValidationEventHandler;
+import javax.xml.datatype.XMLGregorianCalendar;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.i18n.Message;
@@ -108,23 +110,43 @@ public class DataReaderImpl<T> extends J
             honorJaxbAnnotation = (Boolean)part.getProperty("honor.jaxb.annotations");
         }
         Annotation[] anns = null;
+       
         if (honorJaxbAnnotation) {
             anns = getJAXBAnnotation(part);
             if (anns.length > 0) {
-                //RpcLit will use the JAXB Bridge to unmarshall part message when it is 
-                //annotated with @XmlList,@XmlAttachmentRef,@XmlJavaTypeAdapter
-                //TODO:Cache the JAXBRIContext
+                // RpcLit will use the JAXB Bridge to unmarshall part message when it is
+                // annotated with @XmlList,@XmlAttachmentRef,@XmlJavaTypeAdapter
+                // TODO:Cache the JAXBRIContext
                 QName qname = new QName(null, part.getConcreteName().getLocalPart());
-    
-                return JAXBEncoderDecoder.unmarshalWithBridge(qname,
-                                                              part.getTypeClass(),
+
+                return JAXBEncoderDecoder.unmarshalWithBridge(qname, 
+                                                              part.getTypeClass(), 
                                                               anns, 
-                                                              databinding.getContextClasses(),
+                                                              databinding.getContextClasses(), 
+                                                              reader, 
+                                                              getAttachmentUnmarshaller());
+            }
+        }
+        //The jaxb class contains XMLGregorianCalendar field also needs JAXB Bridge
+        if (part != null && part.getTypeClass() != null) {
+            boolean useJAXBBridge = false;
+            for (Field field : part.getTypeClass().getDeclaredFields()) {
+                if (field.getType().equals(XMLGregorianCalendar.class)) {
+                    useJAXBBridge = true;
+                    break;
+                }
+            }
+            if (useJAXBBridge) {
+                return JAXBEncoderDecoder.unmarshalWithBridge(part.getConcreteName(), 
+                                                              part.getTypeClass(),
+                                                              part.getTypeClass().getAnnotations(),
+                                                              databinding.getContextClasses(), 
                                                               reader,
                                                               getAttachmentUnmarshaller());
             }
         }
         
+        
         return JAXBEncoderDecoder.unmarshall(createUnmarshaller(), reader, part, 
                                              unwrapJAXBElement);
     }

Modified: cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/src/main/resources/org/apache/cxf/endpoint/dynamic/simple-binding.xjb
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/src/main/resources/org/apache/cxf/endpoint/dynamic/simple-binding.xjb?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/src/main/resources/org/apache/cxf/endpoint/dynamic/simple-binding.xjb (original)
+++ cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/src/main/resources/org/apache/cxf/endpoint/dynamic/simple-binding.xjb Tue Jul 27 20:46:55 2010
@@ -23,7 +23,7 @@
 -->
 <jaxb:bindings
   xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
-  xmlns:xjc= "http://java.sun.com/xml/ns/jaxb/xjc" jaxb:extensionBindingPrefixes="xjc">
+  xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jaxb:extensionBindingPrefixes="xjc">
   
   <jaxb:globalBindings generateElementProperty="false">
     <xjc:simple />

Propchange: cxf/sandbox/oauth_1.0a/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBWrapperHelperTest.java
            ('svn:mergeinfo' removed)

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/pom.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/pom.xml (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/pom.xml Tue Jul 27 20:46:55 2010
@@ -60,7 +60,6 @@
         <dependency>
             <groupId>javax.ws.rs</groupId>
             <artifactId>jsr311-api</artifactId>
-            <version>1.1</version>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
@@ -134,8 +133,8 @@
             </exclusions>
         </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>
         <dependency>

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java Tue Jul 27 20:46:55 2010
@@ -30,7 +30,6 @@ import java.util.logging.Logger;
 
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Response;
-
 import org.apache.cxf.BusException;
 import org.apache.cxf.binding.BindingConfiguration;
 import org.apache.cxf.binding.BindingFactory;
@@ -50,7 +49,9 @@ import org.apache.cxf.jaxrs.provider.Pro
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.jaxrs.utils.ResourceUtils;
 import org.apache.cxf.service.Service;
+import org.apache.cxf.service.factory.FactoryBeanListener;
 import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.DestinationFactory;
 import org.apache.cxf.transport.DestinationFactoryManager;
@@ -121,6 +122,7 @@ public class AbstractJAXRSFactoryBean ex
 
         BindingInfo bindingInfo = createBindingInfo();
         ei.setBinding(bindingInfo);
+        serviceFactory.sendEvent(FactoryBeanListener.Event.ENDPOINTINFO_CREATED, ei);
 
         return ei;
     }
@@ -141,8 +143,14 @@ public class AbstractJAXRSFactoryBean ex
         try {
             BindingFactory bindingFactory = mgr.getBindingFactory(binding);
             setBindingFactory(bindingFactory);
-            return bindingFactory.createBindingInfo(serviceFactory.getService(),
-                                                    binding, bindingConfig);
+            BindingInfo bi = bindingFactory.createBindingInfo(serviceFactory.getService(),
+                                                              binding, bindingConfig);
+            for (BindingOperationInfo boi : bi.getOperations()) {
+                serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_OPERATION_CREATED, boi, boi);
+            }
+
+            serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_CREATED, bi);
+            return bi;
         } catch (BusException ex) {
             ex.printStackTrace();
             //do nothing
@@ -188,8 +196,9 @@ public class AbstractJAXRSFactoryBean ex
         List<ClassResourceInfo> list = serviceFactory.getRealClassResourceInfo();
         for (ClassResourceInfo cri : list) {
             initializeAnnotationInterceptors(ep, cri.getServiceClass());
+            serviceFactory.sendEvent(FactoryBeanListener.Event.ENDPOINT_SELECTED, ei, ep,
+                                     cri.getServiceClass());
         }
-            
         return ep;
     }
     

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java Tue Jul 27 20:46:55 2010
@@ -39,6 +39,7 @@ import org.apache.cxf.jaxrs.lifecycle.Re
 import org.apache.cxf.jaxrs.model.ClassResourceInfo;
 import org.apache.cxf.jaxrs.provider.ProviderFactory;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
+import org.apache.cxf.service.factory.FactoryBeanListener;
 import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.invoker.Invoker;
 
@@ -82,6 +83,7 @@ public class JAXRSServerFactoryBean exte
     
     public Server create() {
         try {
+            serviceFactory.setBus(getBus());
             checkResources(true);
             if (serviceFactory.getService() == null) {
                 serviceFactory.setServiceName(getServiceName());
@@ -109,6 +111,14 @@ public class JAXRSServerFactoryBean exte
                 ep.put("org.apache.cxf.jaxrs.comparator", rc);
             }
             checkPrivateEndpoint(ep);
+            
+            getServiceFactory().sendEvent(FactoryBeanListener.Event.SERVER_CREATED,
+                                          server, 
+                                          null,
+                                          null);
+            
+            applyFeatures();
+            
             if (start) {
                 server.start();
             }
@@ -122,7 +132,6 @@ public class JAXRSServerFactoryBean exte
             throw new ServiceConstructionException(e);
         }
 
-        applyFeatures();
         return server;
     }
 

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java Tue Jul 27 20:46:55 2010
@@ -39,6 +39,7 @@ import org.apache.cxf.jaxrs.utils.Inject
 import org.apache.cxf.jaxrs.utils.ResourceUtils;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.factory.AbstractServiceFactoryBean;
+import org.apache.cxf.service.factory.FactoryBeanListener.Event;
 import org.apache.cxf.service.invoker.Invoker;
 
 
@@ -69,6 +70,8 @@ public class JAXRSServiceFactoryBean ext
     
     @Override
     public Service create() {
+        sendEvent(Event.START_CREATE);
+
         initializeServiceModel();
 
         initializeDefaultInterceptors();
@@ -86,7 +89,9 @@ public class JAXRSServiceFactoryBean ext
             getService().setDataBinding(getDataBinding());
         }
 
-        return getService();
+        Service serv = getService();
+        sendEvent(Event.END_CREATE, serv);
+        return serv;
     }
 
     public Executor getExecutor() {
@@ -216,6 +221,8 @@ public class JAXRSServiceFactoryBean ext
     }
     
     private ClassResourceInfo getCreatedFromModel(Class<?> realClass) {
+        sendEvent(Event.CREATE_FROM_CLASS, realClass);
+
         for (ClassResourceInfo cri : classResourceInfos) {
             if (cri.isCreatedFromModel() 
                 && cri.isRoot() && cri.getServiceClass().isAssignableFrom(realClass)) {
@@ -230,6 +237,7 @@ public class JAXRSServiceFactoryBean ext
         JAXRSServiceImpl service = new JAXRSServiceImpl(classResourceInfos, serviceName);
 
         setService(service);
+        sendEvent(Event.SERVICE_SET, service);
 
         if (properties != null) {
             service.putAll(properties);

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java Tue Jul 27 20:46:55 2010
@@ -147,6 +147,7 @@ public class JAXRSClientFactoryBean exte
     }
     
     public Client createWithValues(Object... varValues) {
+        serviceFactory.setBus(getBus());
         checkResources(false);
         ClassResourceInfo cri = null;
         try {

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java Tue Jul 27 20:46:55 2010
@@ -68,6 +68,9 @@ public class MessageContextImpl implemen
             || (MultipartBody.INBOUND_MESSAGE_ATTACHMENTS + ".embedded").equals(keyValue)) {
             return createAttachments(key.toString());
         }
+        if (keyValue.equals("WRITE-" + Message.ATTACHMENTS)) {
+            return m.getExchange().getOutMessage().get(Message.ATTACHMENTS);
+        }
         Object value = m.get(key);
         if (value == null && isRequestor()) {
             Message inMessage = m.getExchange().getInMessage();
@@ -150,6 +153,10 @@ public class MessageContextImpl implemen
             convertToAttachments(value);
         }
         m.put(key.toString(), value);
+        if (!isRequestor()) {
+            m.getExchange().put(key.toString(), value);
+        }
+            
     }
 
     private void convertToAttachments(Object value) {
@@ -161,7 +168,7 @@ public class MessageContextImpl implemen
             Attachment handler = (Attachment)handlers.get(i);
             AttachmentImpl att = new AttachmentImpl(handler.getContentId(), handler.getDataHandler());
             for (String key : handler.getHeaders().keySet()) {
-                att.setHeader(key, att.getHeader(key));
+                att.setHeader(key, handler.getHeader(key));
             }
             att.setXOP(false);
             atts.add(att);

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java Tue Jul 27 20:46:55 2010
@@ -24,12 +24,17 @@ import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.StringTokenizer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate;
 
 public class MediaTypeHeaderProvider implements HeaderDelegate<MediaType> {
 
+    private static final Pattern COMPLEX_PARAMETERS = 
+        Pattern.compile("(([\\w-]+=\"[^\"]*\")|([\\w-]+=[\\w-]+))");
+    
     public MediaType fromString(String mType) {
         
         if (mType == null) {
@@ -53,21 +58,22 @@ public class MediaTypeHeaderProvider imp
         
         Map<String, String> parameters = Collections.emptyMap();
         if (paramsStart != -1) {
-            // Using Pattern.compile might be marginally faster ?
-            // though it's rare when more than one parameter is provided
+
             parameters = new LinkedHashMap<String, String>();
-            StringTokenizer st = 
-                new StringTokenizer(mType.substring(paramsStart + 1), ";");
-            while (st.hasMoreTokens()) {
-                String token = st.nextToken();
-                int equalSign = token.indexOf('=');
-                if (equalSign == -1) {
-                    throw new IllegalArgumentException("Wrong media type  parameter, seperator is missing");
+            
+            String paramString = mType.substring(paramsStart + 1);
+            if (paramString.contains("\"")) {
+                Matcher m = COMPLEX_PARAMETERS.matcher(paramString);
+                while (m.find()) {
+                    String val = m.group().trim();
+                    addParameter(parameters, val);
+                }
+            } else {
+                StringTokenizer st = new StringTokenizer(paramString, ";");
+                while (st.hasMoreTokens()) {
+                    addParameter(parameters, st.nextToken());
                 }
-                parameters.put(token.substring(0, equalSign).trim().toLowerCase(), 
-                               token.substring(equalSign + 1).trim());
             }
-            
         }
         
         return new MediaType(type.trim().toLowerCase(), 
@@ -75,6 +81,15 @@ public class MediaTypeHeaderProvider imp
                              parameters);
     }
 
+    private static void addParameter(Map<String, String> parameters, String token) {
+        int equalSign = token.indexOf('=');
+        if (equalSign == -1) {
+            throw new IllegalArgumentException("Wrong media type parameter, separator is missing");
+        }
+        parameters.put(token.substring(0, equalSign).trim().toLowerCase(), 
+                       token.substring(equalSign + 1).trim());
+    }
+    
     public String toString(MediaType type) {
         StringBuilder sb = new StringBuilder();
         sb.append(type.getType()).append('/').append(type.getSubtype());

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/PathSegmentImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/PathSegmentImpl.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/PathSegmentImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/PathSegmentImpl.java Tue Jul 27 20:46:55 2010
@@ -55,5 +55,9 @@ public class PathSegmentImpl implements 
     public String getOriginalPath() {
         return path;
     }
+    
+    public String toString() {
+        return path;
+    }
 
 }

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java Tue Jul 27 20:46:55 2010
@@ -48,6 +48,7 @@ public class UriBuilderImpl extends UriB
     private int port;
     private String host;
     private List<PathSegment> paths = new ArrayList<PathSegment>();
+    private boolean leadingSlash;
     private String fragment;
     private String schemeSpecificPart; 
     private MultivaluedMap<String, String> query = new MetadataMap<String, String>();
@@ -126,7 +127,13 @@ public class UriBuilderImpl extends UriB
             }
             return new URI(b.toString());
         } else if (!isSchemeOpaque()) {
-            return new URI(scheme, userInfo, host, port, thePath, theQuery, fragment);
+            if ((scheme != null || host != null || userInfo != null)
+                && thePath.length() != 0 && !thePath.startsWith("/")) {
+                thePath = "/" + thePath;
+            }
+            
+            return new URI(scheme, userInfo, host, port, 
+                           thePath, theQuery, fragment);
         } else {
             return new URI(scheme, schemeSpecificPart, fragment);
         }
@@ -149,6 +156,9 @@ public class UriBuilderImpl extends UriB
         int idx = ind;
         for (String var : uniqueVars) {
             Object oval = values[idx++];
+            if (oval == null) {
+                throw new IllegalArgumentException("No object for " + var);
+            }
             varValueMap.put(var, oval.toString());
         }
         return templ.substitute(varValueMap);
@@ -162,8 +172,14 @@ public class UriBuilderImpl extends UriB
         // is promising unfortunatley it causes the loss of encoded reserved values such as +,
         // which might cause problems if consumers do rely on URLEncoder which would turn '+' into
         // ' ' or would break the contract in when query parameters are expected to have %2B 
-        
+        if (values == null) {
+            throw new IllegalArgumentException("Template parameter values are set to null");
+        }
         for (int i = 0; i < values.length; i++) {
+            if (values[i] == null) {
+                throw new IllegalArgumentException("Template parameter value is set to null");
+            }
+            
             values[i] = HttpUtils.encodePartiallyEncoded(values[i].toString(), false);
         }
         return doBuild(true, values);
@@ -243,6 +259,9 @@ public class UriBuilderImpl extends UriB
 
     @Override
     public UriBuilder host(String theHost) throws IllegalArgumentException {
+        if ("".equals(theHost)) {
+            throw new IllegalArgumentException("Host cannot be empty");
+        }
         this.host = theHost;
         return this;
     }
@@ -308,7 +327,9 @@ public class UriBuilderImpl extends UriB
         if (path == null) {
             throw new IllegalArgumentException("path is null");
         }
-        
+        if (paths.isEmpty()) {
+            leadingSlash = path.startsWith("/");
+        }
         List<PathSegment> segments = JAXRSUtils.getPathSegments(path, false, false);
         if (!paths.isEmpty() && !matrix.isEmpty()) {
             PathSegment ps = paths.remove(paths.size() - 1);
@@ -324,6 +345,9 @@ public class UriBuilderImpl extends UriB
 
     @Override
     public UriBuilder port(int thePort) throws IllegalArgumentException {
+        if (thePort < 0) {
+            throw new IllegalArgumentException("Port cannot be negative");
+        }
         this.port = thePort;
         return this;
     }
@@ -386,6 +410,7 @@ public class UriBuilderImpl extends UriB
     }
 
     private void setPathAndMatrix(String path) {
+        leadingSlash = path.startsWith("/");
         paths = JAXRSUtils.getPathSegments(path, false, false);
         if (!paths.isEmpty()) {
             matrix = paths.get(paths.size() - 1).getMatrixParameters();
@@ -402,7 +427,9 @@ public class UriBuilderImpl extends UriB
             String p = ps.getPath();
             if (p.length() != 0 || !iter.hasNext()) {
                 p = fromEncoded ? new URITemplate(p).encodeLiteralCharacters() : p;
-                if (!p.startsWith("/")) {
+                if (sb.length() == 0 && leadingSlash) {
+                    sb.append('/');
+                } else if (!p.startsWith("/") && sb.length() > 0) {
                     sb.append('/');
                 }
                 sb.append(p);
@@ -498,6 +525,9 @@ public class UriBuilderImpl extends UriB
 
     @Override
     public UriBuilder segment(String... segments) throws IllegalArgumentException {
+        if (segments == null) {
+            throw new IllegalArgumentException("Segments should not be null");
+        }
         for (String segment : segments) {
             path(segment);
         }

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletRequest.java Tue Jul 27 20:46:55 2010
@@ -23,15 +23,24 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.security.Principal;
+import java.util.Collection;
 import java.util.Enumeration;
 import java.util.Locale;
 import java.util.Map;
 
+import javax.servlet.AsyncContext;
+import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
 import javax.servlet.ServletInputStream;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
+import javax.servlet.http.Part;
 
 public class ThreadLocalHttpServletRequest extends AbstractThreadLocalProxy<HttpServletRequest> 
     implements HttpServletRequest {
@@ -56,11 +65,11 @@ public class ThreadLocalHttpServletReque
         return get().getHeader(name);
     }
 
-    public Enumeration getHeaderNames() {
+    public Enumeration<String> getHeaderNames() {
         return get().getHeaderNames();
     }
 
-    public Enumeration getHeaders(String name) {
+    public Enumeration<String> getHeaders(String name) {
         return get().getHeaders(name);
     }
 
@@ -141,7 +150,7 @@ public class ThreadLocalHttpServletReque
         return get().getAttribute(name);
     }
 
-    public Enumeration getAttributeNames() {
+    public Enumeration<String> getAttributeNames() {
         return get().getAttributeNames();
     }
 
@@ -177,7 +186,7 @@ public class ThreadLocalHttpServletReque
         return get().getLocale();
     }
 
-    public Enumeration getLocales() {
+    public Enumeration<Locale> getLocales() {
         return get().getLocales();
     }
 
@@ -185,11 +194,11 @@ public class ThreadLocalHttpServletReque
         return get().getParameter(name);
     }
 
-    public Map getParameterMap() {
+    public Map<String, String[]> getParameterMap() {
         return get().getParameterMap();
     }
 
-    public Enumeration getParameterNames() {
+    public Enumeration<String> getParameterNames() {
         return get().getParameterNames();
     }
 
@@ -257,4 +266,51 @@ public class ThreadLocalHttpServletReque
 
     }
 
+    public AsyncContext getAsyncContext() {
+        return get().getAsyncContext();
+    }
+
+    public DispatcherType getDispatcherType() {
+        return get().getDispatcherType();
+    }
+
+    public ServletContext getServletContext() {
+        return get().getServletContext();
+    }
+
+    public boolean isAsyncStarted() {
+        return get().isAsyncStarted();
+    }
+
+    public boolean isAsyncSupported() {
+        return get().isAsyncSupported();
+    }
+
+    public AsyncContext startAsync() {
+        return get().startAsync();
+    }
+
+    public AsyncContext startAsync(ServletRequest request, ServletResponse response) {
+        return get().startAsync(request, response);
+    }
+
+    public boolean authenticate(HttpServletResponse response) throws IOException, ServletException {
+        return get().authenticate(response);
+    }
+
+    public Part getPart(String name) throws IOException, ServletException {
+        return get().getPart(name);
+    }
+
+    public Collection<Part> getParts() throws IOException, ServletException {
+        return get().getParts();
+    }
+
+    public void login(String username, String password) throws ServletException {
+        get().login(username, password);
+    }
+
+    public void logout() throws ServletException {
+        get().logout();
+    }
 }

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletResponse.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletResponse.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletResponse.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalHttpServletResponse.java Tue Jul 27 20:46:55 2010
@@ -21,6 +21,7 @@ package org.apache.cxf.jaxrs.impl.tl;
 
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.util.Collection;
 import java.util.Locale;
 
 import javax.servlet.ServletOutputStream;
@@ -174,6 +175,22 @@ public class ThreadLocalHttpServletRespo
         
     }
 
+    public String getHeader(String name) {
+        return get().getHeader(name);
+    }
+
+    public Collection<String> getHeaderNames() {
+        return get().getHeaderNames();
+    }
+
+    public Collection<String> getHeaders(String headerName) {
+        return get().getHeaders(headerName);
+    }
+
+    public int getStatus() {
+        return get().getStatus();
+    }
+
     
 
 }

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalServletConfig.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalServletConfig.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalServletConfig.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalServletConfig.java Tue Jul 27 20:46:55 2010
@@ -32,7 +32,7 @@ public class ThreadLocalServletConfig ex
         return get().getInitParameter(name);
     }
 
-    public Enumeration getInitParameterNames() {
+    public Enumeration<String> getInitParameterNames() {
         return get().getInitParameterNames();
     }
 

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalServletContext.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalServletContext.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalServletContext.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalServletContext.java Tue Jul 27 20:46:55 2010
@@ -23,12 +23,21 @@ import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Enumeration;
+import java.util.EventListener;
+import java.util.Map;
 import java.util.Set;
 
+import javax.servlet.Filter;
+import javax.servlet.FilterRegistration;
 import javax.servlet.RequestDispatcher;
 import javax.servlet.Servlet;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
+import javax.servlet.ServletRegistration.Dynamic;
+import javax.servlet.SessionCookieConfig;
+import javax.servlet.SessionTrackingMode;
+import javax.servlet.descriptor.JspConfigDescriptor;
 
 public class ThreadLocalServletContext extends AbstractThreadLocalProxy<ServletContext> 
     implements ServletContext {
@@ -37,7 +46,7 @@ public class ThreadLocalServletContext e
         return get().getAttribute(name);
     }
 
-    public Enumeration getAttributeNames() {
+    public Enumeration<String> getAttributeNames() {
         return get().getAttributeNames();
     }
 
@@ -53,7 +62,7 @@ public class ThreadLocalServletContext e
         return get().getInitParameter(name);
     }
 
-    public Enumeration getInitParameterNames() {
+    public Enumeration<String> getInitParameterNames() {
         return get().getInitParameterNames();
     }
 
@@ -89,7 +98,7 @@ public class ThreadLocalServletContext e
         return get().getResourceAsStream(path);
     }
 
-    public Set getResourcePaths(String path) {
+    public Set<String> getResourcePaths(String path) {
         return get().getResourcePaths(path);
     }
 
@@ -107,12 +116,12 @@ public class ThreadLocalServletContext e
     }
 
     @SuppressWarnings("deprecation")
-    public Enumeration getServletNames() {
+    public Enumeration<String> getServletNames() {
         return get().getServletNames();
     }
 
     @SuppressWarnings("deprecation")
-    public Enumeration getServlets() {
+    public Enumeration<Servlet> getServlets() {
         return get().getServlets();
     }
 
@@ -138,4 +147,117 @@ public class ThreadLocalServletContext e
         
     }
 
+    public boolean setInitParameter(String name, String value) {
+        return get().setInitParameter(name, value);
+    }
+
+    public Dynamic addServlet(String servletName, String className) throws IllegalArgumentException,
+        IllegalStateException {
+        return get().addServlet(servletName, className);
+    }
+
+    public Dynamic addServlet(String servletName, Servlet servlet) throws IllegalArgumentException,
+        IllegalStateException {
+        return get().addServlet(servletName, servlet);
+    }
+
+    public Dynamic addServlet(String servletName, Class<? extends Servlet> clazz)
+        throws IllegalArgumentException, IllegalStateException {
+        return get().addServlet(servletName, clazz);
+    }
+
+    public <T extends Servlet> T createServlet(Class<T> clazz) throws ServletException {
+        return get().createServlet(clazz);
+    }
+
+    public ServletRegistration getServletRegistration(String servletName) {
+        return get().getServletRegistration(servletName);
+    }
+
+    public Map<String, ? extends ServletRegistration> getServletRegistrations() {
+        return get().getServletRegistrations();
+    }
+
+    public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName, String className)
+        throws IllegalArgumentException, IllegalStateException {
+        return get().addFilter(filterName, className);
+    }
+
+    public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName, Filter filter)
+        throws IllegalArgumentException, IllegalStateException {
+        return get().addFilter(filterName, filter);
+    }
+
+    public javax.servlet.FilterRegistration.Dynamic addFilter(String filterName,
+                                                              Class<? extends Filter> filterClass)
+        throws IllegalArgumentException, IllegalStateException {
+        return get().addFilter(filterName, filterClass);
+    }
+
+    public <T extends Filter> T createFilter(Class<T> clazz) throws ServletException {
+        return get().createFilter(clazz);
+    }
+
+    public FilterRegistration getFilterRegistration(String filterName) {
+        return get().getFilterRegistration(filterName);
+    }
+
+    public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
+        return get().getFilterRegistrations();
+    }
+
+    public void addListener(Class<? extends EventListener> listenerClass) {
+        get().addListener(listenerClass);
+    }
+
+    public void addListener(String className) {
+        get().addListener(className);
+        
+    }
+
+    public <T extends EventListener> void addListener(T t) {
+        get().addListener(t);
+    }
+
+    public <T extends EventListener> T createListener(Class<T> clazz) throws ServletException {
+        return get().createListener(clazz);
+    }
+
+    public void declareRoles(String... roleNames) {
+        get().declareRoles(roleNames);
+    }
+
+    public SessionCookieConfig getSessionCookieConfig() {
+        return get().getSessionCookieConfig();
+    }
+
+    public void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes) {
+        get().setSessionTrackingModes(sessionTrackingModes);
+        
+    }
+
+    public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
+        return get().getDefaultSessionTrackingModes();
+    }
+
+    public int getEffectiveMajorVersion() throws UnsupportedOperationException {
+        return get().getEffectiveMajorVersion();
+    }
+
+    public int getEffectiveMinorVersion() throws UnsupportedOperationException {
+        return get().getEffectiveMinorVersion();
+    }
+
+    public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
+        return get().getEffectiveSessionTrackingModes();
+    }
+
+    public ClassLoader getClassLoader() {
+        return get().getClassLoader();
+    }
+
+    public JspConfigDescriptor getJspConfigDescriptor() {
+        return get().getJspConfigDescriptor();
+    }
+
 }

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java Tue Jul 27 20:46:55 2010
@@ -374,12 +374,13 @@ public class JAXRSOutInterceptor extends
         
         Object contentType = 
             response.getMetadata().getFirst(HttpHeaders.CONTENT_TYPE);
+        if (contentType != null) {
+            return Collections.singletonList(MediaType.valueOf(contentType.toString()));
+        }
         Exchange exchange = message.getExchange();
         List<MediaType> produceTypes = null;
         OperationResourceInfo operation = exchange.get(OperationResourceInfo.class);
-        if (contentType != null) {
-            return Collections.singletonList(MediaType.valueOf(contentType.toString()));
-        } else if (operation != null) {
+        if (operation != null) {
             produceTypes = operation.getProduceTypes();
         } else {
             produceTypes = Collections.singletonList(MediaType.APPLICATION_OCTET_STREAM_TYPE);
@@ -389,7 +390,7 @@ public class JAXRSOutInterceptor extends
         if (acceptContentTypes == null) {
             acceptContentTypes = Collections.singletonList(MediaType.WILDCARD_TYPE);
         }        
-        return JAXRSUtils.intersectMimeTypes(acceptContentTypes, produceTypes);
+        return JAXRSUtils.intersectMimeTypes(acceptContentTypes, produceTypes, true);
         
     }
     

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java Tue Jul 27 20:46:55 2010
@@ -439,97 +439,100 @@ public final class URITemplate {
             }
         }
     }
-}
+    
+    /**
+     * Splits string into parts inside and outside curly braces. Nested curly braces are ignored and treated
+     * as part inside top-level curly braces. Example: string "foo{bar{baz}}blah" is split into three tokens,
+     * "foo","{bar{baz}}" and "blah". When closed bracket is missing, whole unclosed part is returned as one
+     * token, e.g.: "foo{bar" is split into "foo" and "{bar". When opening bracket is missing, closing
+     * bracket is ignored and taken as part of current token e.g.: "foo{bar}baz}blah" is split into "foo",
+     * "{bar}" and "baz}blah".
+     * <p>
+     * This is helper class for {@link URITemplate} that enables recurring literals appearing next to regular
+     * expressions e.g. "/foo/{zipcode:[0-9]{5}}/". Nested expressions with closed sections, like open-closed
+     * brackets causes expression to be out of regular grammar (is context-free grammar) which are not
+     * supported by Java regexp version.
+     * 
+     * @author amichalec
+     * @version $Rev$
+     */
+    static class CurlyBraceTokenizer {
+
+        private List<String> tokens = new ArrayList<String>();
+        private int tokenIdx;
 
-/**
- * Splits string into parts inside and outside curly braces. Nested curly braces are ignored and treated as
- * part inside top-level curly braces. Example: string "foo{bar{baz}}blah" is split into three tokens, "foo",
- * "{bar{baz}}" and "blah". When closed bracket is missing, whole unclosed part is returned as one token,
- * e.g.: "foo{bar" is split into "foo" and "{bar". When opening bracket is missing, closing bracked is ignored
- * and taken as part of current token e.g.: "foo{bar}baz}blah" is split into "foo", "{bar}" and "baz}blah".
- * <p>
- * This is helper class for {@link URITemplate} that enables recurring literals appearing next to regular
- * expressions e.g. "/foo/{zipcode:[0-9]{5}}/". Nested expressions with closed sections, like open-closed
- * brackets causes expression to be out of regular grammar (is context-free grammar) which are not supported
- * by Java regexp version.
- * 
- * @author amichalec
- * @version $Rev$
- */
-final class CurlyBraceTokenizer {
-
-    private List<String> tokens = new ArrayList<String>();
-    private int tokenIdx;
-
-    public CurlyBraceTokenizer(String string) {
-        boolean outside = true;
-        int level = 0;
-        int lastIdx = 0;
-        int idx;
-        for (idx = 0; idx < string.length(); idx++) {
-            if (string.charAt(idx) == '{') {
-                if (outside) {
-                    if (lastIdx < idx) {
-                        tokens.add(string.substring(lastIdx, idx));
+        public CurlyBraceTokenizer(String string) {
+            boolean outside = true;
+            int level = 0;
+            int lastIdx = 0;
+            int idx;
+            for (idx = 0; idx < string.length(); idx++) {
+                if (string.charAt(idx) == '{') {
+                    if (outside) {
+                        if (lastIdx < idx) {
+                            tokens.add(string.substring(lastIdx, idx));
+                        }
+                        lastIdx = idx;
+                        outside = false;
+                    } else {
+                        level++;
                     }
-                    lastIdx = idx;
-                    outside = false;
-                } else {
-                    level++;
-                }
-            } else if (string.charAt(idx) == '}' && !outside) {
-                if (level > 0) {
-                    level--;
-                } else {
-                    if (lastIdx < idx) {
-                        tokens.add(string.substring(lastIdx, idx + 1));
+                } else if (string.charAt(idx) == '}' && !outside) {
+                    if (level > 0) {
+                        level--;
+                    } else {
+                        if (lastIdx < idx) {
+                            tokens.add(string.substring(lastIdx, idx + 1));
+                        }
+                        lastIdx = idx + 1;
+                        outside = true;
                     }
-                    lastIdx = idx + 1;
-                    outside = true;
                 }
             }
+            if (lastIdx < idx) {
+                tokens.add(string.substring(lastIdx, idx));
+            }
         }
-        if (lastIdx < idx) {
-            tokens.add(string.substring(lastIdx, idx));
-        }
-    }
 
-    /**
-     * Token is enclosed by curly braces.
-     * 
-     * @param token
-     *            text to verify
-     * @return true if enclosed, false otherwise.
-     */
-    public static boolean insideBraces(String token) {
-        return token.charAt(0) == '{' && token.charAt(token.length() - 1) == '}';
-    }
+        /**
+         * Token is enclosed by curly braces.
+         * 
+         * @param token
+         *            text to verify
+         * @return true if enclosed, false otherwise.
+         */
+        public static boolean insideBraces(String token) {
+            return token.charAt(0) == '{' && token.charAt(token.length() - 1) == '}';
+        }
 
-    /**
-     * Strips token from enclosed curly braces. If token is not enclosed method
-     * has no side effect.
-     * 
-     * @param token
-     *            text to verify
-     * @return text stripped from curly brace begin-end pair.
-     */
-    public static String stripBraces(String token) {
-        if (insideBraces(token)) {
-            return token.substring(1, token.length() - 1);
-        } else {
-            return token;
+        /**
+         * Strips token from enclosed curly braces. If token is not enclosed method
+         * has no side effect.
+         * 
+         * @param token
+         *            text to verify
+         * @return text stripped from curly brace begin-end pair.
+         */
+        public static String stripBraces(String token) {
+            if (insideBraces(token)) {
+                return token.substring(1, token.length() - 1);
+            } else {
+                return token;
+            }
         }
-    }
 
-    public boolean hasNext() {
-        return tokens.size() > tokenIdx;
-    }
+        public boolean hasNext() {
+            return tokens.size() > tokenIdx;
+        }
 
-    public String next() {
-        if (hasNext()) {
-            return tokens.get(tokenIdx++);
-        } else {
-            throw new IllegalStateException("no more elements");
+        public String next() {
+            if (hasNext()) {
+                return tokens.get(tokenIdx++);
+            } else {
+                throw new IllegalStateException("no more elements");
+            }
         }
     }
 }
+
+

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java Tue Jul 27 20:46:55 2010
@@ -25,6 +25,7 @@ import java.io.InputStream;
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -495,6 +496,8 @@ public class WadlGenerator implements Re
                 }
                 sb.append("<representation");
                 sb.append(" mediaType=\"").append(mt.toString()).append("\"");
+                
+                type = getActualJaxbType(type, ori.getAnnotatedMethod(), inbound);
                 if (qnameResolver != null && mt.getSubtype().contains("xml") && jaxbTypes.contains(type)) {
                     generateQName(sb, qnameResolver, clsMap, type,
                                   getBodyAnnotations(ori, inbound));
@@ -511,6 +514,11 @@ public class WadlGenerator implements Re
         }
     }
     
+    protected Class<?> getActualJaxbType(Class<?> type, Method resourceMethod, boolean inbound) {
+        WadlElement element = resourceMethod.getAnnotation(WadlElement.class);
+        return element == null ? type : inbound ? element.request() : element.response();
+    }
+    
     protected List<OperationResourceInfo> sortOperationsByPath(Set<OperationResourceInfo> ops) {
         List<OperationResourceInfo> opsWithSamePath = new LinkedList<OperationResourceInfo>(ops);
         Collections.sort(opsWithSamePath, new Comparator<OperationResourceInfo>() {

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.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/AbstractJAXBProvider.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java Tue Jul 27 20:46:55 2010
@@ -382,16 +382,11 @@ public abstract class AbstractJAXBProvid
             || JAXBElement.class.isAssignableFrom(type)
             || objectFactoryForClass(type)
             || (type != genericType && objectFactoryForType(genericType))
-            || adapterAvailable(type, anns)
+            || getAdapter(type, anns) != null
             || type.getResource("jaxb.index") != null;
     
     }
     
-    protected boolean adapterAvailable(Class<?> type, Annotation[] anns) {
-        return AnnotationUtils.getAnnotation(anns, XmlJavaTypeAdapter.class) != null
-               || type.getAnnotation(XmlJavaTypeAdapter.class) != null;
-    }
-    
     protected boolean objectFactoryForClass(Class<?> type) {
         try {
             return type.getClassLoader().loadClass(PackageUtils.getPackageName(type) 
@@ -464,7 +459,7 @@ public abstract class AbstractJAXBProvid
     }
     
     @SuppressWarnings("unchecked")
-    protected Object checkAdapter(Object obj, Annotation[] anns, boolean marshal) {
+    protected Object checkAdapter(Object obj, Class<?> cls, Annotation[] anns, boolean marshal) {
         XmlJavaTypeAdapter typeAdapter = getAdapter(obj.getClass(), anns); 
         if (typeAdapter != null) {
             try {
@@ -482,10 +477,16 @@ public abstract class AbstractJAXBProvid
         return obj;
     }
     
-    protected XmlJavaTypeAdapter getAdapter(Class<?> type, Annotation[] anns) {
+    protected XmlJavaTypeAdapter getAdapter(Class<?> objectClass, Annotation[] anns) {
         XmlJavaTypeAdapter typeAdapter = AnnotationUtils.getAnnotation(anns, XmlJavaTypeAdapter.class);
         if (typeAdapter == null) {
-            typeAdapter = type.getAnnotation(XmlJavaTypeAdapter.class);
+            typeAdapter = objectClass.getAnnotation(XmlJavaTypeAdapter.class);
+            if (typeAdapter == null) {
+                // lets just try the 1st interface for now
+                Class<?>[] interfaces = objectClass.getInterfaces();
+                typeAdapter = interfaces.length > 0 
+                    ? interfaces[0].getAnnotation(XmlJavaTypeAdapter.class) : null;
+            }
         }
         return typeAdapter;
     }

Modified: cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.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/FormEncodingProvider.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java Tue Jul 27 20:46:55 2010
@@ -128,7 +128,7 @@ public class FormEncodingProvider implem
             FormUtils.populateMapFromMultipart(params, body, decode);
         } else {
             FormUtils.populateMapFromString(params, 
-                                            FormUtils.readBody(is), 
+                                            FormUtils.readBody(is, mt), 
                                             decode,
                                             mc != null ? mc.getHttpServletRequest() : null);
         }
@@ -179,14 +179,17 @@ public class FormEncodingProvider implem
         } else {
             MultivaluedMap<String, String> map = (MultivaluedMap<String, String>)obj;
             boolean encoded = AnnotationUtils.getAnnotation(anns, Encoded.class) != null;
+            
+            String encoding = HttpUtils.getSetEncoding(mt, headers, "UTF-8");
+            
             for (Iterator<Map.Entry<String, List<String>>> it = map.entrySet().iterator(); it.hasNext();) {
                 Map.Entry<String, List<String>> entry = it.next();
                 for (Iterator<String> entryIterator = entry.getValue().iterator(); entryIterator.hasNext();) {
                     String value = entryIterator.next();
-                    os.write(entry.getKey().getBytes("UTF-8"));
+                    os.write(entry.getKey().getBytes(encoding));
                     os.write('=');
                     String data = encoded ? value : HttpUtils.urlEncode(value);
-                    os.write(data.getBytes("UTF-8"));
+                    os.write(data.getBytes(encoding));
                     if (entryIterator.hasNext() || it.hasNext()) {
                         os.write('&');
                     }



Mime
View raw message