You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ro...@apache.org on 2008/10/21 23:41:45 UTC

svn commit: r706779 - in /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws: BindingProvider.java client/dispatch/BaseDispatch.java client/proxy/JAXWSProxyHandler.java

Author: rott
Date: Tue Oct 21 14:41:44 2008
New Revision: 706779

URL: http://svn.apache.org/viewvc?rev=706779&view=rev
Log:
Improve support for client-set requestContext "Cookie" property from commit at 702617.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java?rev=706779&r1=706778&r2=706779&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java Tue Oct 21 14:41:44 2008
@@ -219,10 +219,8 @@
         Object sessionValue = null;
 
         if (properties == null) {
-            return;
-        }
-
-        if (properties.containsKey(HTTPConstants.HEADER_LOCATION)) {
+            throw ExceptionFactory.makeWebServiceException(Messages.getMessage("NoMaintainSessionProperty"));
+        } else if (properties.containsKey(HTTPConstants.HEADER_LOCATION)) {
             sessionKey = HTTPConstants.HEADER_LOCATION;
             sessionValue = properties.get(sessionKey);
             if (sessionValue != null && !"".equals(sessionValue)) {

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java?rev=706779&r1=706778&r2=706779&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java Tue Oct 21 14:41:44 2008
@@ -153,10 +153,12 @@
              */
             if ((requestContext.containsKey(BindingProvider.SESSION_MAINTAIN_PROPERTY)) && ((Boolean)requestContext.get(BindingProvider.SESSION_MAINTAIN_PROPERTY))) {
                 if ((requestContext.containsKey(HTTPConstants.HEADER_COOKIE)) && (requestContext.get(HTTPConstants.HEADER_COOKIE) != null)) {
-                    invocationContext.getServiceClient().getServiceContext().setProperty(HTTPConstants.HEADER_COOKIE, requestContext.get(HTTPConstants.HEADER_COOKIE));
-                    if (log.isDebugEnabled()) {
-                        log.debug("Client-app defined Cookie property (assume to be session cookie) on request context copied to service context." +
-                                "  Caution:  server may or may not support sessions, but client app will not be informed when not supported.");
+                    if (invocationContext.getServiceClient().getServiceContext().getProperty(HTTPConstants.HEADER_COOKIE) == null) {
+                        invocationContext.getServiceClient().getServiceContext().setProperty(HTTPConstants.HEADER_COOKIE, requestContext.get(HTTPConstants.HEADER_COOKIE));
+                        if (log.isDebugEnabled()) {
+                            log.debug("Client-app defined Cookie property (assume to be session cookie) on request context copied to service context." +
+                                    "  Caution:  server may or may not support sessions, but client app will not be informed when not supported.");
+                        }
                     }
                 }
             }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java?rev=706779&r1=706778&r2=706779&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java Tue Oct 21 14:41:44 2008
@@ -215,10 +215,12 @@
          */
         if ((requestContext.containsKey(BindingProvider.SESSION_MAINTAIN_PROPERTY)) && ((Boolean)requestContext.get(BindingProvider.SESSION_MAINTAIN_PROPERTY))) {
             if ((requestContext.containsKey(HTTPConstants.HEADER_COOKIE)) && (requestContext.get(HTTPConstants.HEADER_COOKIE) != null)) {
-                requestIC.getServiceClient().getServiceContext().setProperty(HTTPConstants.HEADER_COOKIE, requestContext.get(HTTPConstants.HEADER_COOKIE));
-                if (log.isDebugEnabled()) {
-                    log.debug("Client-app defined Cookie property (assume to be session cookie) on request context copied to service context." +
-                            "  Caution:  server may or may not support sessions, but client app will not be informed when not supported.");
+                if (requestIC.getServiceClient().getServiceContext().getProperty(HTTPConstants.HEADER_COOKIE) == null) {
+                    requestIC.getServiceClient().getServiceContext().setProperty(HTTPConstants.HEADER_COOKIE, requestContext.get(HTTPConstants.HEADER_COOKIE));
+                    if (log.isDebugEnabled()) {
+                        log.debug("Client-app defined Cookie property (assume to be session cookie) on request context copied to service context." +
+                                "  Caution:  server may or may not support sessions, but client app will not be informed when not supported.");
+                    }
                 }
             }
         }