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 nt...@apache.org on 2007/02/06 22:48:37 UTC

svn commit: r504311 - in /webservices/axis2/trunk/java/modules: jaxws-api/src/javax/xml/ws/handler/ jaxws/src/org/apache/axis2/jaxws/client/async/ jaxws/src/org/apache/axis2/jaxws/context/utils/ metadata/src/org/apache/axis2/jaxws/description/ metadata...

Author: nthaker
Date: Tue Feb  6 13:48:36 2007
New Revision: 504311

URL: http://svn.apache.org/viewvc?view=rev&rev=504311
Log:
Axis2-2124

This patch has fix for Async future.cancel() behaviour and fix to correct constants in MessageContext api.

Modified:
    webservices/axis2/trunk/java/modules/jaxws-api/src/javax/xml/ws/handler/MessageContext.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUitls.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java

Modified: webservices/axis2/trunk/java/modules/jaxws-api/src/javax/xml/ws/handler/MessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-api/src/javax/xml/ws/handler/MessageContext.java?view=diff&rev=504311&r1=504310&r2=504311
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-api/src/javax/xml/ws/handler/MessageContext.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-api/src/javax/xml/ws/handler/MessageContext.java Tue Feb  6 13:48:36 2007
@@ -29,8 +29,6 @@
     public abstract Scope getScope(String s);
 
     public static final String MESSAGE_OUTBOUND_PROPERTY = "javax.xml.ws.handler.message.outbound";
-    public static final String MESSAGE_ATTACHMENTS_INBOUND = "javax.xml.ws.binding.attachments.inbound";
-    public static final String MESSAGE_ATTACHMENTS_OUTBOUND = "javax.xml.ws.binding.attachments.outbound";
     public static final String WSDL_DESCRIPTION = "javax.xml.ws.wsdl.description";
     public static final String WSDL_SERVICE = "javax.xml.ws.wsdl.service";
     public static final String WSDL_PORT = "javax.xml.ws.wsdl.port";
@@ -40,9 +38,11 @@
     public static final String HTTP_REQUEST_HEADERS = "javax.xml.ws.http.request.headers";
     public static final String HTTP_RESPONSE_HEADERS = "javax.xml.ws.http.response.headers";
     public static final String HTTP_REQUEST_METHOD = "javax.xml.ws.http.request.method";
-    public static final String HTTP_REQUEST_QUERYSTRING = "javax.xml.ws.http.request.querystring";
-    public static final String HTTP_REQUEST_PATHINFO = "javax.xml.ws.http.request.pathinfo";
     public static final String SERVLET_REQUEST = "javax.xml.ws.servlet.request";
     public static final String SERVLET_RESPONSE = "javax.xml.ws.servlet.response";
     public static final String SERVLET_CONTEXT = "javax.xml.ws.servlet.context";
+    public static final String INBOUND_MESSAGE_ATTACHMENTS = "javax.xml.ws.binding.attachments.inbound";
+    public static final String OUTBOUND_MESSAGE_ATTACHMENTS = "javax.xml.ws.binding.attachments.outbound";
+    public static final String QUERY_STRING = "javax.xml.ws.http.request.querystring";
+    public static final String PATH_INFO = "javax.xml.ws.http.request.pathinfo"; 
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java?view=diff&rev=504311&r1=504310&r2=504311
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java Tue Feb  6 13:48:36 2007
@@ -48,6 +48,24 @@
     private CallbackFutureTask cft;
     private Executor executor;
     private FutureTask task;
+    /*
+     * There are two Async Callback Future.cancel scenario that we address
+     * 1) Client app creates request and call Async Operation. Now before the request is submitted
+     * 	  by JAXWS to Executor for processing and any response is received client decides to cancel 
+     * 	  the future task.
+     * 2) Client app creates request and call Async Operation. Request is submitted by JAXWS 
+     * 	  to Executor for processing and a response is received and client decides to cancel the future
+     * 	  task.
+     * 
+     * We will address both these scenarios in the code. In scenario 1 we will do the following:
+     * 1) Check the for the future.isCancelled before submitting the task to Executor 
+     * 2) If cancelled then do not submit the task and do not call the Async Handler of client. 
+     * 3)The client program in this case (Since it cancelled the future) will be responsible for cleaning any resources that it engages.
+     * 
+     * In Second Scenario we will call the AsyncHandler as Future.isCancelled will be false. As per java doc
+     * the Future cannot be cancelled once the task has been submitted. Also the response has already arrived so 
+     * we will make the AsyncHandler and let the client code decided how it wants to treat the response.
+     */
    
     @SuppressWarnings("unchecked")
     public CallbackFuture(AsyncResponse response, AsyncHandler handler, Executor exec) {
@@ -96,7 +114,17 @@
         }
         
         if (executor != null) {
-            executor.execute(task);
+        	if(task!=null && !task.isCancelled()){
+        		executor.execute(task);
+        		if(log.isDebugEnabled()){
+        			log.debug("Task submitted to Executor");
+        		}
+        	}else{
+        		System.out.println("Task is cancelled");
+        		if(log.isDebugEnabled()){
+        			log.info("Executor task was not sumbitted as Async Future task was cancelled by clients");
+        		}
+        	}
         }
         
         if (log.isDebugEnabled()) {

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUitls.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUitls.java?view=diff&rev=504311&r1=504310&r2=504311
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUitls.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUitls.java Tue Feb  6 13:48:36 2007
@@ -116,8 +116,8 @@
 			}
 			
 			String pathInfo = req.getPathInfo();
-			soapMessageContext.put(javax.xml.ws.handler.MessageContext.HTTP_REQUEST_PATHINFO, pathInfo);
-			soapMessageContext.setScope(javax.xml.ws.handler.MessageContext.HTTP_REQUEST_PATHINFO, Scope.APPLICATION);
+			soapMessageContext.put(javax.xml.ws.handler.MessageContext.PATH_INFO, pathInfo);
+			soapMessageContext.setScope(javax.xml.ws.handler.MessageContext.PATH_INFO, Scope.APPLICATION);
 			if(log.isDebugEnabled()){
 				if(pathInfo != null){
 					log.debug("HTTP_REQUEST_PATHINFO Set");
@@ -127,8 +127,8 @@
 				}
 			}
 			String queryString = req.getQueryString();
-			soapMessageContext.put(javax.xml.ws.handler.MessageContext.HTTP_REQUEST_QUERYSTRING, queryString);
-			soapMessageContext.setScope(javax.xml.ws.handler.MessageContext.HTTP_REQUEST_QUERYSTRING, Scope.APPLICATION);
+			soapMessageContext.put(javax.xml.ws.handler.MessageContext.QUERY_STRING, queryString);
+			soapMessageContext.setScope(javax.xml.ws.handler.MessageContext.QUERY_STRING, Scope.APPLICATION);
 			if(log.isDebugEnabled()){
 				if(queryString != null){
 					log.debug("HTTP_REQUEST_QUERYSTRING Set");
@@ -176,11 +176,11 @@
 		   
 		// Set the message properties
 		
-		soapMessageContext.put(javax.xml.ws.handler.MessageContext.MESSAGE_ATTACHMENTS_INBOUND, axisMsgContext.getAttachmentMap());
-		soapMessageContext.setScope(javax.xml.ws.handler.MessageContext.MESSAGE_ATTACHMENTS_INBOUND, Scope.APPLICATION);
+		soapMessageContext.put(javax.xml.ws.handler.MessageContext.INBOUND_MESSAGE_ATTACHMENTS, axisMsgContext.getAttachmentMap());
+		soapMessageContext.setScope(javax.xml.ws.handler.MessageContext.INBOUND_MESSAGE_ATTACHMENTS, Scope.APPLICATION);
 		
-        soapMessageContext.put(javax.xml.ws.handler.MessageContext.MESSAGE_ATTACHMENTS_OUTBOUND, null);
-        soapMessageContext.setScope(javax.xml.ws.handler.MessageContext.MESSAGE_ATTACHMENTS_OUTBOUND, Scope.APPLICATION);
+        soapMessageContext.put(javax.xml.ws.handler.MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS, null);
+        soapMessageContext.setScope(javax.xml.ws.handler.MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS, Scope.APPLICATION);
         
 	}
 	
@@ -205,21 +205,17 @@
 			if(eid!=null){
 				EndpointDescription ed = eid.getEndpointDescription();
 				QName portType = eid.getPortType();
-				
+				if(portType == null || portType.getLocalPart() == ""){
+					if(log.isDebugEnabled()){
+						log.debug("Did not get port type from EndpointInterfaceDescription, attempting to get PortType from EndpointDescription");
+					}
+				}		
 				if(ed !=null){
 					soapMessageContext.put(javax.xml.ws.handler.MessageContext.WSDL_PORT, ed.getPortQName());
 					soapMessageContext.setScope(javax.xml.ws.handler.MessageContext.WSDL_PORT, Scope.APPLICATION);
 					if(log.isDebugEnabled()){
 						log.debug("WSDL_PORT :"+ed.getPortQName());
 					}	
-					if(portType == null || portType.getLocalPart() == ""){
-						if(log.isDebugEnabled()){
-							log.debug("Did not get port type from EndpointInterfaceDescription, attempting to get PortType from EndpointDescription");
-						}
-						portType = ed.getPortType();
-					}
-					
-					
 				}
 				soapMessageContext.put(javax.xml.ws.handler.MessageContext.WSDL_INTERFACE, portType);
 				soapMessageContext.setScope(javax.xml.ws.handler.MessageContext.WSDL_INTERFACE, Scope.APPLICATION);

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java?view=diff&rev=504311&r1=504310&r2=504311
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java Tue Feb  6 13:48:36 2007
@@ -118,5 +118,4 @@
      */
     public TreeSet<String> getPackages();
     
-    public QName getPortType();
 }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?view=diff&rev=504311&r1=504310&r2=504311
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Tue Feb  6 13:48:36 2007
@@ -1338,11 +1338,6 @@
         return wsdlSOAPAddress;
     }
     
-    public QName getPortType(){
-    	String tns = getTargetNamespace();
-    	String portType = getName();
-    	return new QName(tns, portType);
-    }
     /**
      * Determine if the WSDL Extensibility element corresponds to the SOAP Address element.
      * @param exElement

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java?view=diff&rev=504311&r1=504310&r2=504311
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java Tue Feb  6 13:48:36 2007
@@ -739,9 +739,12 @@
         return webService_Name;
     }
     
+    public String getName(){
+    	return getAnnoWebServiceName();
+    }
     public QName getPortType(){
-    	String name = getAnnoWebServiceName();
-    	String tns = getAnnoWebServiceTargetNamespace();
+    	String name = getName();
+    	String tns = getTargetNamespace();
     	return new QName(tns, name);
     }
 



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