cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r956121 - in /cxf/trunk: rt/core/src/main/java/org/apache/cxf/service/factory/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ rt/ws/policy/src/main/java/org/apache/cxf/ws/p...
Date Fri, 18 Jun 2010 20:31:47 GMT
Author: dkulp
Date: Fri Jun 18 20:31:46 2010
New Revision: 956121

URL: http://svn.apache.org/viewvc?rev=956121&view=rev
Log:
Start wireing in the annotation listeners into the JAXRS stuff.

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java?rev=956121&r1=956120&r2=956121&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
Fri Jun 18 20:31:46 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/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java?rev=956121&r1=956120&r2=956121&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
Fri Jun 18 20:31:46 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/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java?rev=956121&r1=956120&r2=956121&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
Fri Jun 18 20:31:46 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,11 @@ public class JAXRSServerFactoryBean exte
                 ep.put("org.apache.cxf.jaxrs.comparator", rc);
             }
             checkPrivateEndpoint(ep);
+            
+            getServiceFactory().sendEvent(FactoryBeanListener.Event.SERVER_CREATED,
+                                          server, 
+                                          null,
+                                          null);
             if (start) {
                 server.start();
             }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java?rev=956121&r1=956120&r2=956121&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
Fri Jun 18 20:31:46 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/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java?rev=956121&r1=956120&r2=956121&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
Fri Jun 18 20:31:46 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/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java?rev=956121&r1=956120&r2=956121&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
Fri Jun 18 20:31:46 2010
@@ -72,13 +72,17 @@ public class PolicyAnnotationListener im
         case ENDPOINT_SELECTED: {
             Class<?> cls = (Class<?>)args[2];
             Endpoint ep = (Endpoint)args[1];
-            addPolicies(factory, ep, cls);
+            if (ep.getEndpointInfo().getInterface() != null) {
+                addPolicies(factory, ep, cls);
+            }
             break;
         }
         case SERVER_CREATED: {
             Class<?> cls = (Class<?>)args[2];
             Server server = (Server)args[0];
-            addPolicies(factory, server, cls);
+            if (server.getEndpoint().getEndpointInfo().getInterface() != null) {
+                addPolicies(factory, server, cls);
+            }
             break;
         }
         case INTERFACE_OPERATION_BOUND: {

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=956121&r1=956120&r2=956121&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java Fri
Jun 18 20:31:46 2010
@@ -64,6 +64,7 @@ import javax.xml.bind.annotation.adapter
 import javax.xml.namespace.QName;
 import javax.xml.transform.dom.DOMSource;
 
+import org.apache.cxf.annotations.GZIP;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.jaxrs.ext.Oneway;
 import org.apache.cxf.jaxrs.ext.search.SearchCondition;
@@ -71,6 +72,7 @@ import org.apache.cxf.jaxrs.ext.search.S
 import org.apache.cxf.phase.PhaseInterceptorChain;
 
 @Path("/bookstore")
+@GZIP(threshold = 1)
 public class BookStore {
 
     private Map<Long, Book> books = new HashMap<Long, Book>();

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java?rev=956121&r1=956120&r2=956121&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java
Fri Jun 18 20:31:46 2010
@@ -38,8 +38,11 @@ import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.UriInfo;
 
+import org.apache.cxf.annotations.Logging;
+
 @Path("/")
 @Produces("application/json")
+@Logging
 public class BookStoreSpring {
 
     private Map<Long, Book> books = new HashMap<Long, Book>();

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java?rev=956121&r1=956120&r2=956121&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
Fri Jun 18 20:31:46 2010
@@ -152,6 +152,7 @@ public class JAXRSClientServerSpringBook
         URLConnection connect = url.openConnection();
         connect.addRequestProperty("Content-Type", "*/*");
         connect.addRequestProperty("Accept", type);
+        connect.addRequestProperty("Accept-Encoding", "gzip;q=1.0, identity; q=0.5, *;q=0");
         if (mHeader != null) {
             connect.addRequestProperty("X-HTTP-Method-Override", mHeader);
         }

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt?rev=956121&r1=956120&r2=956121&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt
Fri Jun 18 20:31:46 2010
@@ -3,7 +3,6 @@ Accept: image/gif, image/x-xbitmap, imag
 Accept-Language: en-ie
 Content-Type: application/x-www-form-urlencoded
 UA-CPU: x86
-Accept-Encoding: gzip, deflate
 User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; iOpus-Web-Automation; .NET
CLR 2.0.50727)
 Host: localhost:9080
 Content-Length: 27



Mime
View raw message