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 2007/04/12 18:08:55 UTC

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

Author: robinsona
Date: Thu Apr 12 09:08:52 2007
New Revision: 528001

URL: http://svn.apache.org/viewvc?view=rev&rev=528001
Log:
axis2-2448 url rewrite not working when using policy set

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?view=diff&rev=528001&r1=528000&r2=528001
==============================================================================
--- 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 Thu Apr 12 09:08:52 2007
@@ -20,6 +20,8 @@
 
 import org.apache.axis2.jaxws.binding.SOAPBinding;
 import org.apache.axis2.jaxws.client.PropertyValidator;
+import org.apache.axis2.jaxws.core.InvocationContext;
+import org.apache.axis2.jaxws.core.MessageContext;
 import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.handler.HandlerResolverImpl;
 import org.apache.axis2.jaxws.i18n.Messages;
@@ -35,8 +37,11 @@
 public class BindingProvider implements org.apache.axis2.jaxws.spi.BindingProvider {
 
     protected Map<String, Object> requestContext;
+
     protected Map<String, Object> responseContext;
+
     protected EndpointDescription endpointDesc;
+
     protected ServiceDelegate serviceDelegate;
 
     private Binding binding;  // force subclasses to use the lazy getter
@@ -98,6 +103,28 @@
 
     public Map<String, Object> getResponseContext() {
         return responseContext;
+    }
+
+    /**
+     * Check for maintain session state enablement either in the
+     * MessageContext.isMaintainSession() or in the ServiceContext properties.
+     * 
+     * @param mc
+     * @param ic
+     */
+    protected void checkMaintainSessionState(MessageContext mc, InvocationContext ic) {
+        Map<String, Object> properties = ic.getServiceClient().getServiceContext().getProperties();
+        boolean bValue = false;
+
+        if (properties != null
+            && properties
+                         .containsKey(javax.xml.ws.BindingProvider.SESSION_MAINTAIN_PROPERTY)) {
+            bValue = (Boolean) properties
+                .get(javax.xml.ws.BindingProvider.SESSION_MAINTAIN_PROPERTY);
+        }
+        if (mc.isMaintainSession() || bValue == true) {
+            setupSessionContext(properties);
+        }
     }
 
     /*

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?view=diff&rev=528001&r1=528000&r2=528001
==============================================================================
--- 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 Thu Apr 12 09:08:52 2007
@@ -54,7 +54,9 @@
     private Log log = LogFactory.getLog(BaseDispatch.class);
 
     protected InvocationController ic;
+
     protected ServiceClient serviceClient;
+
     protected Mode mode;
 
     protected BaseDispatch(ServiceDelegate svcDelgate, EndpointDescription epDesc) {
@@ -143,11 +145,7 @@
             Object returnObj = getValueFromMessage(responseMsg);
 
             //Check to see if we need to maintain session state
-            if (requestMsgCtx.isMaintainSession()) {
-                //TODO: Need to figure out a cleaner way to make this call. 
-                setupSessionContext(
-                        invocationContext.getServiceClient().getServiceContext().getProperties());
-            }
+            checkMaintainSessionState(requestMsgCtx, invocationContext);
 
             if (log.isDebugEnabled()) {
                 log.debug("Synchronous invocation completed: BaseDispatch.invoke()");
@@ -201,11 +199,7 @@
             ic.invokeOneWay(invocationContext);
 
             //Check to see if we need to maintain session state
-            if (requestMsgCtx.isMaintainSession()) {
-                //TODO: Need to figure out a cleaner way to make this call. 
-                setupSessionContext(
-                        invocationContext.getServiceClient().getServiceContext().getProperties());
-            }
+            checkMaintainSessionState(requestMsgCtx, invocationContext);
 
             if (log.isDebugEnabled()) {
                 log.debug("One-way invocation completed: BaseDispatch.invokeOneWay()");
@@ -270,11 +264,7 @@
             Future<?> asyncResponse = ic.invokeAsync(invocationContext, asynchandler);
 
             //Check to see if we need to maintain session state
-            if (requestMsgCtx.isMaintainSession()) {
-                //TODO: Need to figure out a cleaner way to make this call. 
-                setupSessionContext(
-                        invocationContext.getServiceClient().getServiceContext().getProperties());
-            }
+            checkMaintainSessionState(requestMsgCtx, invocationContext);
 
             if (log.isDebugEnabled()) {
                 log.debug("Asynchronous (callback) invocation sent: BaseDispatch.invokeAsync()");
@@ -339,11 +329,7 @@
             Response asyncResponse = ic.invokeAsync(invocationContext);
 
             //Check to see if we need to maintain session state
-            if (requestMsgCtx.isMaintainSession()) {
-                //TODO: Need to figure out a cleaner way to make this call. 
-                setupSessionContext(
-                        invocationContext.getServiceClient().getServiceContext().getProperties());
-            }
+            checkMaintainSessionState(requestMsgCtx, invocationContext);
 
             if (log.isDebugEnabled()) {
                 log.debug("Asynchronous (polling) invocation sent: BaseDispatch.invokeAsync()");

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?view=diff&rev=528001&r1=528000&r2=528001
==============================================================================
--- 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 Thu Apr 12 09:08:52 2007
@@ -77,7 +77,9 @@
 
     //Reference to ServiceDelegate instance that was used to create the Proxy
     protected ServiceDescription serviceDesc = null;
+
     private Class seiClazz = null;
+
     private Method method = null;
 
     public JAXWSProxyHandler(ServiceDelegate delegate, Class seiClazz, EndpointDescription epDesc) {
@@ -201,12 +203,7 @@
             controller.invokeOneWay(requestIC);
 
             // Check to see if we need to maintain session state
-            if (request.isMaintainSession()) {
-                //TODO: Need to figure out a cleaner way to make this call.  This could probably
-                //make use of the property migrator mentioned above.
-                setupSessionContext(
-                        requestIC.getServiceClient().getServiceContext().getProperties());
-            }
+            checkMaintainSessionState(request, requestIC);
         }
 
         if (method.getReturnType() == Future.class) {
@@ -248,11 +245,7 @@
             Future<?> future = controller.invokeAsync(requestIC, asyncHandler);
 
             //Check to see if we need to maintain session state
-            if (request.isMaintainSession()) {
-                //TODO: Need to figure out a cleaner way to make this call. 
-                setupSessionContext(
-                        requestIC.getServiceClient().getServiceContext().getProperties());
-            }
+            checkMaintainSessionState(request, requestIC);
 
             return future;
         }
@@ -268,11 +261,7 @@
             Response response = controller.invokeAsync(requestIC);
 
             //Check to see if we need to maintain session state
-            if (request.isMaintainSession()) {
-                //TODO: Need to figure out a cleaner way to make this call. 
-                setupSessionContext(
-                        requestIC.getServiceClient().getServiceContext().getProperties());
-            }
+            checkMaintainSessionState(request, requestIC);
 
             return response;
         }
@@ -281,11 +270,7 @@
             InvocationContext responseIC = controller.invoke(requestIC);
 
             //Check to see if we need to maintain session state
-            if (request.isMaintainSession()) {
-                //TODO: Need to figure out a cleaner way to make this call. 
-                setupSessionContext(
-                        requestIC.getServiceClient().getServiceContext().getProperties());
-            }
+            checkMaintainSessionState(request, requestIC);
 
             MessageContext responseContext = responseIC.getResponseMessageContext();
             Object responseObj = createResponse(method, args, responseContext, operationDesc);



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