cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r607373 - in /incubator/cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/ systests/src/test/java/org/...
Date Sat, 29 Dec 2007 04:33:05 GMT
Author: jliu
Date: Fri Dec 28 20:33:05 2007
New Revision: 607373

URL: http://svn.apache.org/viewvc?rev=607373&view=rev
Log:
Configure JAX-WS handlers per binding type. 

Modified:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java?rev=607373&r1=607372&r2=607373&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
Fri Dec 28 20:33:05 2007
@@ -174,7 +174,7 @@
         JaxWsServiceFactoryBean sf = (JaxWsServiceFactoryBean)getServiceFactory(); 
         
         List<Handler> chain = builder.buildHandlerChainFromClass(getServiceBeanClass(),
sf.getEndpointInfo()
-            .getName(), sf.getServiceQName());
+            .getName(), sf.getServiceQName(), this.getBindingId());
         for (Handler h : chain) {
             injectResources(h);
         }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java?rev=607373&r1=607372&r2=607373&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
Fri Dec 28 20:33:05 2007
@@ -60,7 +60,7 @@
      * @return
      */
     public List<Handler> buildHandlerChainFromClass(Class<?> clz, List<Handler>
existingHandlers,
-                                                    QName portQName, QName serviceQName)
{
+                                                    QName portQName, QName serviceQName,
String bindingID) {
         LOG.fine("building handler chain");
         HandlerChainAnnotation hcAnn = findHandlerChainAnnotation(clz, true);
         List<Handler> chain = null;
@@ -92,8 +92,7 @@
                 
                 chain = new ArrayList<Handler>();
                 for (HandlerChainType hc : handlerChainsType.getHandlerChain()) {
-                    //Only add handlers if <port-name-pattern> is not presented or
is matched.
-                    //TODO: match the namespace, match the wild card etc. JSR-181, Appendix
B. 
+                    //TODO: match the namespace, match the wild card etc. JSR-181, Appendix
B.
                     if (hc.getPortNamePattern() != null && portQName != null) {
                         String portNamePattern = hc.getPortNamePattern();
                         String localPart = portNamePattern.substring(portNamePattern.indexOf(':')
+ 1,
@@ -110,6 +109,10 @@
                             continue;
                         }
                     }
+                    if (hc.getProtocolBindings() != null && !hc.getProtocolBindings().isEmpty()
+                        && bindingID != null && !hc.getProtocolBindings().contains(bindingID))
{
+                        continue;
+                    }
                     chain.addAll(buildHandlerChain(hc, clz.getClassLoader()));          
         
                 }
 
@@ -124,8 +127,9 @@
         return sortHandlers(chain);
     }
 
-    public List<Handler> buildHandlerChainFromClass(Class<?> clz, QName portQName,
QName serviceQName) {
-        return buildHandlerChainFromClass(clz, null, portQName, serviceQName);
+    public List<Handler> buildHandlerChainFromClass(Class<?> clz, QName portQName,
QName serviceQName,
+                                                    String bindingID) {
+        return buildHandlerChainFromClass(clz, null, portQName, serviceQName, bindingID);
     }
     
     protected URL resolveHandlerChainAnnotationFile(Class clazz, String name) {
@@ -133,7 +137,7 @@
     }
     
     public List<Handler> buildHandlerChainFromClass(Class<?> clz) {
-        return buildHandlerChainFromClass(clz, null, null);
+        return buildHandlerChainFromClass(clz, null, null, null);
     }
     
     private HandlerChainAnnotation findHandlerChainAnnotation(Class<?> clz, boolean
searchSEI) {        

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java?rev=607373&r1=607372&r2=607373&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerResolverImpl.java
Fri Dec 28 20:33:05 2007
@@ -88,9 +88,10 @@
     private List<Handler> getHandlersFromAnnotation(Class<?> clazz, PortInfo
portInfo) {
         AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder();
 
-        List<Handler> chain = builder.buildHandlerChainFromClass(clazz, portInfo !=
null ? portInfo
-            .getPortName() : null, portInfo != null ? portInfo.getServiceName() : null);
-
+        List<Handler> chain = builder.buildHandlerChainFromClass(clazz, 
+            portInfo != null ? portInfo.getPortName() : null, 
+            portInfo != null ? portInfo.getServiceName() : null,
+            portInfo != null ? portInfo.getBindingID() : null);
         return chain;
     }
     

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java?rev=607373&r1=607372&r2=607373&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
Fri Dec 28 20:33:05 2007
@@ -46,36 +46,40 @@
         AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
         List<Handler> handlers = chainBuilder.buildHandlerChainFromClass(handlerTestImpl.getClass());
         assertNotNull(handlers);
-        assertEquals(7, handlers.size());
+        assertEquals(9, handlers.size());
         assertEquals(TestLogicalHandler.class, handlers.get(0).getClass());
         assertEquals(TestLogicalHandler.class, handlers.get(1).getClass());
         assertEquals(TestLogicalHandler.class, handlers.get(2).getClass());
         assertEquals(TestLogicalHandler.class, handlers.get(3).getClass());
         assertEquals(TestLogicalHandler.class, handlers.get(4).getClass());
         assertEquals(TestLogicalHandler.class, handlers.get(5).getClass());
-        assertEquals(TestProtocolHandler.class, handlers.get(6).getClass());
+        assertEquals(TestLogicalHandler.class, handlers.get(6).getClass());
+        assertEquals(TestProtocolHandler.class, handlers.get(7).getClass());
+        assertEquals(TestProtocolHandler.class, handlers.get(8).getClass());
     }    
     
     @Test
-    public void testFindHandlerChainAnnotationPerPortPerService() {
+    public void testFindHandlerChainAnnotationPerPortServiceBinding() {
         HandlerTestImpl handlerTestImpl = new HandlerTestImpl();
         AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
         QName portQName = new QName("namespacedoesntsupportyet", "SoapPort1");
         QName serviceQName = new QName("namespacedoesntsupportyet", "SoapService1");
+        String bindingID = "http://schemas.xmlsoap.org/wsdl/soap/http";
         List<Handler> handlers = chainBuilder
-            .buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName);
+            .buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName,
bindingID);
         assertNotNull(handlers);
-        assertEquals(7, handlers.size());
+        assertEquals(9, handlers.size());
     }
     
     @Test
-    public void testFindHandlerChainAnnotationPerPortPerServiceNegative() {
+    public void testFindHandlerChainAnnotationPerPortServiceBindingNegative() {
         HandlerTestImpl handlerTestImpl = new HandlerTestImpl();
         AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
         QName portQName = new QName("namespacedoesntsupportyet", "SoapPortUnknown");
         QName serviceQName = new QName("namespacedoesntsupportyet", "SoapServiceUnknown");
+        String bindingID = "BindingUnknow";
         List<Handler> handlers = chainBuilder
-            .buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName);
+            .buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName,
bindingID);
         assertNotNull(handlers);
         assertEquals(3, handlers.size());
     }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml?rev=607373&r1=607372&r2=607373&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/handlers.xml
Fri Dec 28 20:33:05 2007
@@ -89,4 +89,22 @@
 			</handler-class>
 		</handler>
 	</handler-chain>	
+	
+	       <!-- ====================== -->
+           <!-- protocol based handlers-->
+           <!-- ====================== -->
+           <handler-chain>
+              <!-- REVISIT: valued used by TCK, do not understand...
+              <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
+               -->
+              <protocol-bindings>http://schemas.xmlsoap.org/wsdl/soap/http</protocol-bindings>
+              <handler>
+	             <handler-name>Handler7</handler-name>
+	             <handler-class>org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler</handler-class>
+              </handler>
+              <handler>
+	             <handler-name>Handler8</handler-name>
+	             <handler-class>org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestProtocolHandler</handler-class>
+              </handler>
+           </handler-chain>
 </handler-chains>

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java?rev=607373&r1=607372&r2=607373&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
Fri Dec 28 20:33:05 2007
@@ -115,7 +115,7 @@
         BindingProvider bp1 = (BindingProvider)handlerTest1;
         Binding binding1 = bp1.getBinding();
         List<Handler> port1HandlerChain = binding1.getHandlerChain();
-        assertEquals(0, port1HandlerChain.size());
+        assertEquals(1, port1HandlerChain.size());
     }
     
     @Test

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml?rev=607373&r1=607372&r2=607373&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/handlers_invocation_testunused.xml
Fri Dec 28 20:33:05 2007
@@ -37,6 +37,20 @@
                   <handler-class>org.apache.cxf.systest.handlers.TestUnusedHandler</handler-class>
               </handler>
            </handler-chain>
+           <handler-chain>
+              <protocol-bindings>http://schemas.xmlsoap.org/wsdl/soap/http</protocol-bindings>
+              <handler>
+                  <handler-name>TestUnusedHandler</handler-name>
+                  <handler-class>org.apache.cxf.systest.handlers.TestUnusedHandler</handler-class>
+              </handler>
+           </handler-chain>   
+           <handler-chain>
+              <protocol-bindings>unknownbinding</protocol-bindings>
+              <handler>
+                  <handler-name>TestUnusedHandler</handler-name>
+                  <handler-class>org.apache.cxf.systest.handlers.TestUnusedHandler</handler-class>
+              </handler>
+           </handler-chain>                    
 </handler-chains>
 
 



Mime
View raw message