cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r512470 - in /incubator/cxf/trunk/rt/frontend/jaxws/src: main/java/org/apache/cxf/jaxws/handler/ test/java/org/apache/cxf/jaxws/handler/
Date Tue, 27 Feb 2007 22:50:02 GMT
Author: dkulp
Date: Tue Feb 27 14:50:01 2007
New Revision: 512470

URL: http://svn.apache.org/viewvc?view=rev&rev=512470
Log:
CXF-406 - commit patch from Jarek Gawor

Modified:
    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/HandlerChainBuilder.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

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?view=diff&rev=512470&r1=512469&r2=512470
==============================================================================
--- 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
Tue Feb 27 14:50:01 2007
@@ -65,7 +65,6 @@
         } else {
             hcAnn.validate();
 
-            HandlerChainType hc = null;
             try {
                 JAXBContext jc = JAXBContext
                         .newInstance(org.apache.cxf.jaxws.javaee.ObjectFactory.class);
@@ -79,20 +78,25 @@
                     throw new WebServiceException(BUNDLE
                             .getString("CHAIN_NOT_SPECIFIED_EXC"));
                 }
-                //We expect only one HandlerChainType here
-                hc = (HandlerChainType) handlerChainsType.getHandlerChain().iterator().next();
+                
+                chain = new ArrayList<Handler>();
+                for (HandlerChainType hc : handlerChainsType.getHandlerChain()) {
+                    chain.addAll(buildHandlerChain(hc, clz.getClassLoader()));
+                }
+
             } catch (Exception e) {
-                e.printStackTrace();
                 throw new WebServiceException(BUNDLE.getString("CHAIN_NOT_SPECIFIED_EXC"),
e);
             }
-
-            chain = buildHandlerChain(hc, clz.getClassLoader());
         }
         assert chain != null;
         if (existingHandlers != null) {
             chain.addAll(existingHandlers);
         }
         return sortHandlers(chain);
+    }
+
+    protected URL resolveHandlerChainAnnotationFile(Class clazz, String name) {
+        return clazz.getResource(name);
     }
 
     public List<Handler> buildHandlerChainFromClass(Class<?> clz) {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java?view=diff&rev=512470&r1=512469&r2=512470
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java
Tue Feb 27 14:50:01 2007
@@ -162,11 +162,13 @@
     }
 
     private void initializeViaInjection(Handler handler, final Map<String, String>
params) {
-        ResourceManager resMgr = bus.getExtension(ResourceManager.class);
-        List<ResourceResolver> resolvers = resMgr.getResourceResolvers();
-        resolvers.add(new InitParamResourceResolver(params));
-        ResourceInjector resInj = new ResourceInjector(resMgr, resolvers);
-        resInj.inject(handler);
+        if (bus != null) {
+            ResourceManager resMgr = bus.getExtension(ResourceManager.class);
+            List<ResourceResolver> resolvers = resMgr.getResourceResolvers();
+            resolvers.add(new InitParamResourceResolver(params));
+            ResourceInjector resInj = new ResourceInjector(resMgr, resolvers);
+            resInj.inject(handler);
+        }
     }
 
     private void initializeViaInitMethod(Handler handler, Map<String, String> params,
Method init) {

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?view=diff&rev=512470&r1=512469&r2=512470
==============================================================================
--- 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
Tue Feb 27 14:50:01 2007
@@ -40,9 +40,10 @@
         AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
         List<Handler> handlers = chainBuilder.buildHandlerChainFromClass(handlerTestImpl.getClass());
         assertNotNull(handlers);
-        assertEquals(2, handlers.size());
+        assertEquals(3, handlers.size());
         assertEquals(TestLogicalHandler.class, handlers.get(0).getClass());
         assertEquals(TestLogicalHandler.class, handlers.get(1).getClass());
+        assertEquals(TestProtocolHandler.class, handlers.get(2).getClass());
     }
 
     public static class TestLogicalHandler implements LogicalHandler {
@@ -63,6 +64,20 @@
         public final void init(final Map map) {
             config = map;
             initCalled = true;
+        }
+    }
+
+    public static class TestProtocolHandler implements Handler {
+
+        public void close(MessageContext arg0) {
+        }
+
+        public boolean handleFault(MessageContext arg0) {
+            return false;
+        }
+
+        public boolean handleMessage(MessageContext arg0) {
+            return false;
         }
     }
 

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?view=diff&rev=512470&r1=512469&r2=512470
==============================================================================
--- 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
Tue Feb 27 14:50:01 2007
@@ -24,6 +24,16 @@
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee">
     <handler-chain>
 	<handler>
+		<handler-name>lh3</handler-name>
+		<handler-class>org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestProtocolHandler</handler-class>
+		<init-param>
+			<param-name>token</param-name>
+			<param-value>String</param-value>
+		</init-param>
+	</handler>
+    </handler-chain>
+    <handler-chain>
+	<handler>
 		<handler-name>lh1</handler-name>
 		<handler-class>org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilderTest$TestLogicalHandler</handler-class>
 		<init-param>



Mime
View raw message