You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ga...@apache.org on 2008/04/10 07:07:45 UTC

svn commit: r646648 - in /webservices/axis2/trunk/java/modules/jaxws: src/org/apache/axis2/jaxws/context/utils/ src/org/apache/axis2/jaxws/handler/ src/org/apache/axis2/jaxws/server/ test/org/apache/axis2/jaxws/handler/ test/org/apache/axis2/jaxws/hand...

Author: gawor
Date: Wed Apr  9 22:07:42 2008
New Revision: 646648

URL: http://svn.apache.org/viewvc?rev=646648&view=rev
Log:
revert 646647

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUtils.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/SoapMessageContext.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerChainProcessorTests.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/handler/context/SOAPMessageContextTests.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUtils.java?rev=646648&r1=646647&r2=646648&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUtils.java Wed Apr  9 22:07:42 2008
@@ -34,7 +34,6 @@
 import org.apache.commons.logging.LogFactory;
 import org.w3c.dom.Element;
 
-import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.xml.namespace.QName;
@@ -116,16 +115,17 @@
         
         // If we are running within a servlet container, then JAX-WS requires that the
         // servlet related properties be set on the MessageContext
-        ServletContext servletContext = 
-            (ServletContext)jaxwsMessageContext.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT);
-        if (servletContext != null) {
-            log.debug("Servlet Context Set");
-            soapMessageContext.put(javax.xml.ws.handler.MessageContext.SERVLET_CONTEXT,
-                                   servletContext);
-            soapMessageContext
+        soapMessageContext.put(javax.xml.ws.handler.MessageContext.SERVLET_CONTEXT,
+                               jaxwsMessageContext.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT));
+        soapMessageContext
                 .setScope(javax.xml.ws.handler.MessageContext.SERVLET_CONTEXT, Scope.APPLICATION);
-        } else {
-            log.debug("Servlet Context not found");
+
+        if (log.isDebugEnabled()) {
+            if (jaxwsMessageContext.getProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT) != null) {
+                log.debug("Servlet Context Set");
+            } else {
+                log.debug("Servlet Context not found");
+            }
         }
 
         HttpServletRequest req = (HttpServletRequest)jaxwsMessageContext

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java?rev=646648&r1=646647&r2=646648&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/HandlerChainProcessor.java Wed Apr  9 22:07:42 2008
@@ -265,14 +265,6 @@
                 // a request that requires no response is a one-way message
                 // and we should only close whomever got invoked
                 callCloseHandlers(newStart_inclusive, newEnd, newDirection);
-
-                // As according to the Sun "experts", exceptions raised by
-                // handlers in one way invocation are discarded. They 
-                // are NOT propagated to the user code.
-                if (savedException != null) {
-                    log.warn("Exception thrown by a handler in one way invocation", 
-                             savedException);
-                }
             }
             else {
                 // it's a response, so we can safely assume that 
@@ -283,12 +275,12 @@
                 } else {
                     callCloseHandlers(0, handlers.size() - 1, direction);
                 }
-                if (savedException != null) {
-                    // we have a saved exception, throw it (JAX-WS 9.3.2.1 "Throw 
-                    // ProtocolException or any other runtime exception --> No 
-                    // response" case.
-                    throw savedException;
-                }
+            }
+            if (savedException != null) {
+                // we have a saved exception, throw it (JAX-WS 9.3.2.1 "Throw 
+                // ProtocolException or any other runtime exception --> No 
+                // response" case.
+                throw savedException;
             }
         }
     }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/SoapMessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/SoapMessageContext.java?rev=646648&r1=646647&r2=646648&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/SoapMessageContext.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/SoapMessageContext.java Wed Apr  9 22:07:42 2008
@@ -54,7 +54,6 @@
     private static final Log log = LogFactory.getLog(SoapMessageContext.class);
     
     // cache the message object after transformation --- see getMessage and setMessage methods
-    Message cachedMessage = null;
     SOAPMessage cachedSoapMessage = null;
     
     public SoapMessageContext(MessageContext messageCtx) {
@@ -128,11 +127,10 @@
     }
 
     public SOAPMessage getMessage() {
-        Message msg = messageCtx.getMEPContext().getMessageObject();
-        if (msg != cachedMessage) {
-            cachedMessage = msg;
-            cachedSoapMessage = msg.getAsSOAPMessage();
-        } 
+    	if (cachedSoapMessage == null) {
+    		Message msg = messageCtx.getMEPContext().getMessageObject();
+    		cachedSoapMessage = msg.getAsSOAPMessage();
+    	}
         return cachedSoapMessage;
     }
 
@@ -168,7 +166,6 @@
             Message msg =
                     ((MessageFactory) FactoryRegistry.getFactory(MessageFactory.class)).createFrom(soapmessage);
             messageCtx.getMEPContext().setMessage(msg);
-            cachedMessage = msg;
             cachedSoapMessage = soapmessage;
         } catch (XMLStreamException e) {
             // TODO log it, and throw something?

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java?rev=646648&r1=646647&r2=646648&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/EndpointController.java Wed Apr  9 22:07:42 2008
@@ -93,9 +93,8 @@
         }
         
         MessageContext request = eic.getRequestMessageContext();
-        boolean good = false;
         try {
-            good = handleRequest(eic);
+            boolean good = handleRequest(eic);
 
             if (!good) {
                 return eic;
@@ -120,9 +119,7 @@
         } finally {
             // Passed pivot point
             request.getMessage().setPostPivot();
-            if (good) {
-                handleResponse(eic);    
-            }
+            handleResponse(eic);    
         }
         
         return eic;

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerChainProcessorTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerChainProcessorTests.java?rev=646648&r1=646647&r2=646648&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerChainProcessorTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/handler/HandlerChainProcessorTests.java Wed Apr  9 22:07:42 2008
@@ -584,7 +584,7 @@
         } catch (ProtocolException pe) {
             e = pe;
         }
-        assertNull(e);
+        assertNotNull(e);
         // no handleFault calls
         assertEquals("S2m:S1m:L1m:L1c:S1c:S2c:", result);
     }

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/handler/context/SOAPMessageContextTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/handler/context/SOAPMessageContextTests.java?rev=646648&r1=646647&r2=646648&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/handler/context/SOAPMessageContextTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/handler/context/SOAPMessageContextTests.java Wed Apr  9 22:07:42 2008
@@ -39,17 +39,16 @@
 
 public class SOAPMessageContextTests extends TestCase {
 
-	private final String INPUT_1 = "sample input";
-	private final String INPUT_2 = "sample input two";
+	private final String INPUT = "sample input";
 	
-    private Message createMessage(String input) throws Exception {
+    private SoapMessageContext createSampleContext() throws Exception {
         MessageFactory factory = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
         Message msg = factory.create(Protocol.soap11);
         
         // Create a jaxb object
         ObjectFactory objFactory = new ObjectFactory();
         EchoString echo = objFactory.createEchoString();
-        echo.setInput(input);
+        echo.setInput(INPUT);
         
         // Create the necessary JAXBContext
         JAXBContext jbc = JAXBContext.newInstance("test");
@@ -61,16 +60,12 @@
         
         msg.setBodyBlock(block);
         
-        return msg;
-    }
-    
-    private SoapMessageContext createSampleContext() throws Exception {
-        Message msg = createMessage(INPUT_1);
         MessageContext mc = new MessageContext();
         mc.setMEPContext(new MEPContext(mc));
         mc.setMessage(msg);
         
         return MessageContextFactory.createSoapMessageContext(mc);
+
     }
     
     public void testGetAsSoapMessageObjectID() {
@@ -83,31 +78,5 @@
     	} catch (Exception e) {
     		assertNull("should not get an exception in this test", e);
     	}
-    }
-    
-    public void testSoapMessageCaching() throws Exception {
-        Message msg1 = createMessage(INPUT_1);
-        Message msg2 = createMessage(INPUT_2);
-        
-        MessageContext mc = new MessageContext();
-        mc.setMessage(msg1);
-        SoapMessageContext soapCtx = MessageContextFactory.createSoapMessageContext(mc);
-        
-        SOAPMessage m1 = soapCtx.getMessage();
-        SOAPMessage m2 = soapCtx.getMessage();
-        
-        assertTrue("retrieval of message from SoapMessageContext twice in a row should result in same object", m1 == m2);
-        
-        // let's change underlying message as 
-        // HandlerChainProcessor.convertToFaultMessage() does
-        mc.setMessage(msg2);
-        
-        SOAPMessage m3 = soapCtx.getMessage();
-        SOAPMessage m4 = soapCtx.getMessage();
-        
-        assertTrue("retrieval of message from SoapMessageContext twice in a row should result in same object", m3 == m4);
-        
-        // Soap messages from before and after must be different!
-        assertTrue("retrieval of message from SoapMessageContext after message has changed in the underlying context", m1 != m3);  
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org