axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hemap...@apache.org
Subject svn commit: r202475 - in /webservices/axis/trunk/java/modules/core/src/org/apache/axis: clientapi/ context/ receivers/ transport/ transport/http/
Date Thu, 30 Jun 2005 03:55:01 GMT
Author: hemapani
Date: Wed Jun 29 20:54:58 2005
New Revision: 202475

URL: http://svn.apache.org/viewcvs?rev=202475&view=rev
Log:
refactor the REST support

Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/receivers/AbstractInOutSyncMessageReceiver.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/AbstractTransportSender.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/TransportUtils.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/AxisServlet.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/CommonsHTTPTransportSender.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportSender.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportUtils.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java?rev=202475&r1=202474&r2=202475&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java
Wed Jun 29 20:54:58 2005
@@ -111,4 +111,11 @@
         soapVersionURI = string;
     }
 
+    /**
+     * @param string
+     */
+    public void setSoapAction(String string) {
+        soapAction = string;
+    }
+
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java?rev=202475&r1=202474&r2=202475&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java
Wed Jun 29 20:54:58 2005
@@ -126,7 +126,11 @@
     
     private String soapAction;
     
+    
+    //Are we doing MTOM now?
     private boolean doingMTOM = false;
+    //Are we doing REST now?
+    private boolean doingREST = false;
     
     /**
      * Conveniance Method, but before call engine.send() or  engine.receive() one must send
transport in/out
@@ -583,6 +587,20 @@
      */
     public void setDoingMTOM(boolean b) {
         doingMTOM = b;
+    }
+
+    /**
+     * @return
+     */
+    public boolean isDoingREST() {
+        return doingREST;
+    }
+
+    /**
+     * @param b
+     */
+    public void setDoingREST(boolean b) {
+        doingREST = b;
     }
 
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/receivers/AbstractInOutSyncMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/receivers/AbstractInOutSyncMessageReceiver.java?rev=202475&r1=202474&r2=202475&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/receivers/AbstractInOutSyncMessageReceiver.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/receivers/AbstractInOutSyncMessageReceiver.java
Wed Jun 29 20:54:58 2005
@@ -15,7 +15,6 @@
  */
 package org.apache.axis.receivers;
 
-import org.apache.axis.Constants;
 import org.apache.axis.addressing.AddressingConstants;
 import org.apache.axis.addressing.MessageInformationHeadersCollection;
 import org.apache.axis.addressing.miheaders.RelatesTo;
@@ -56,7 +55,7 @@
         newmsgCtx.setOperationContext(messgeCtx.getOperationContext());
         newmsgCtx.setServiceContext(messgeCtx.getServiceContext());
         newmsgCtx.setProperty(MessageContext.TRANSPORT_OUT,messgeCtx.getProperty(MessageContext.TRANSPORT_OUT));
-        newmsgCtx.setProperty(Constants.Configuration.DO_REST,messgeCtx.getProperty((Constants.Configuration.DO_REST)));
+        newmsgCtx.setDoingREST(messgeCtx.isDoingREST());
         newmsgCtx.setDoingMTOM(messgeCtx.isDoingMTOM());
         
         invokeBusinessLogic(messgeCtx,newmsgCtx);

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/AbstractTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/AbstractTransportSender.java?rev=202475&r1=202474&r2=202475&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/AbstractTransportSender.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/AbstractTransportSender.java
Wed Jun 29 20:54:58 2005
@@ -48,7 +48,7 @@
 	 */
 	private Log log = LogFactory.getLog(getClass());
 
-	protected boolean doREST = false;
+
 
 	/**
 	 * Field NAME
@@ -77,11 +77,6 @@
 	public void invoke(MessageContext msgContext) throws AxisFault {
 		//Check for the REST behaviour, if you desire rest beahaviour
 		//put a <parameter name="doREST" value="true"/> at the axis2.xml
-		Object doREST = msgContext.getProperty(Constants.Configuration.DO_REST);
-		if (doREST != null && Constants.VALUE_TRUE.equals(doREST)) {
-			this.doREST = true;
-		}
-        
         msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
 
 		OutputStream out = null;
@@ -130,7 +125,7 @@
 		SOAPEnvelope envelope = msgContext.getEnvelope();
 		OMElement outputMessage = envelope;
 
-		if (envelope != null && this.doREST) {
+		if (envelope != null && msgContext.isDoingREST()) {
 			outputMessage = envelope.getBody().getFirstElement();
 		}
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/TransportUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/TransportUtils.java?rev=202475&r1=202474&r2=202475&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/TransportUtils.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/TransportUtils.java
Wed Jun 29 20:54:58 2005
@@ -22,7 +22,6 @@
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.axis.Constants;
 import org.apache.axis.context.MessageContext;
 import org.apache.axis.engine.AxisFault;
 import org.apache.axis.om.impl.llom.builder.StAXBuilder;
@@ -53,10 +52,6 @@
         InputStream inStream )
         throws AxisFault {
         try {
-            //Check for the REST behaviour, if you desire rest beahaviour
-            //put a <parameter name="doREST" value="true"/> at the server.xml/client.xml
file
-            Object doREST =
-                msgContext.getProperty(Constants.Configuration.DO_REST);
             Reader reader = new InputStreamReader(inStream);
             
             XMLStreamReader xmlreader =
@@ -64,7 +59,7 @@
                 
             StAXBuilder builder = null;
             SOAPEnvelope envelope = null;
-            if (doREST != null && "true".equals(doREST)) {
+            if (msgContext.isDoingREST()) {
                 SOAPFactory soapFactory = new SOAP11Factory();
                 builder = new StAXOMBuilder(xmlreader);
                 builder.setOmbuilderFactory(soapFactory);

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/AxisServlet.java?rev=202475&r1=202474&r2=202475&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/AxisServlet.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/AxisServlet.java
Wed Jun 29 20:54:58 2005
@@ -107,7 +107,7 @@
                         new QName(Constants.TRANSPORT_HTTP)),
                     configContext.getAxisConfiguration().getTransportOut(
                         new QName(Constants.TRANSPORT_HTTP)));
-                    msgContext.setProperty(Constants.Configuration.DO_REST, Constants.VALUE_TRUE);
+                    msgContext.setDoingREST(true);
             msgContext.setServerSide(true);
             msgContext.setProperty(HTTPConstants.HTTPOutTransportInfo,new ServletBasedOutTransportInfo(httpServletResponse));
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/CommonsHTTPTransportSender.java?rev=202475&r1=202474&r2=202475&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/CommonsHTTPTransportSender.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/CommonsHTTPTransportSender.java
Wed Jun 29 20:54:58 2005
@@ -34,14 +34,13 @@
 
 public class CommonsHTTPTransportSender extends AbstractHandler implements TransportSender
{
     private boolean chuncked = false;
-    private boolean doMTOM = false;
+
     private String httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
     public static final String HTTP_METHOD = "HTTP_METHOD";
 
     
     protected HttpClient httpClient;
     protected OMElement outputMessage;
-    protected boolean doREST;
 
     public CommonsHTTPTransportSender() {
     } //default
@@ -50,10 +49,6 @@
         try {
             //Check for the REST behaviour, if you desire rest beahaviour
             //put a <parameter name="doREST" value="true"/> at the server.xml/client.xml
file
-            Object doREST = msgContext.getProperty(Constants.Configuration.DO_REST);
-            if (doREST != null && Constants.VALUE_TRUE.equals(doREST)) {
-                this.doREST = true;
-            }
 
             EndpointReference epr = null;
             if (msgContext.getTo() != null
@@ -65,7 +60,7 @@
             }
 
             OMElement dataOut = null;
-            if (this.doREST) {
+            if (msgContext.isDoingREST()) {
                 dataOut = msgContext.getEnvelope().getFirstElement();
             } else {
                 dataOut = msgContext.getEnvelope();
@@ -144,7 +139,7 @@
                 }
             }
             // othervise assumes HTTP 1.1 and keep-alive is default.
-            if (!this.doREST) {
+            if (!msgContext.isDoingREST()) {
                 postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapActionString);
             }
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportSender.java?rev=202475&r1=202474&r2=202475&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportSender.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportSender.java
Wed Jun 29 20:54:58 2005
@@ -79,7 +79,7 @@
             if(!chuncked && !msgContext.isDoingMTOM()) {
                 buf.append(HTTPConstants.HEADER_CONTENT_LENGTH).append(": " + contentLength
+ "\n");
             }
-            if (!this.doREST) {
+            if (!msgContext.isDoingREST()) {
                 buf.append("SOAPAction: \"" + soapActionString + "\"\n");
             }
             buf.append("\n");

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportUtils.java?rev=202475&r1=202474&r2=202475&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportUtils.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportUtils.java
Wed Jun 29 20:54:58 2005
@@ -25,7 +25,6 @@
 import java.io.Reader;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.StringTokenizer;
 
 import javax.xml.parsers.FactoryConfigurationError;
 import javax.xml.stream.XMLInputFactory;
@@ -83,8 +82,7 @@
 						&& Constants.VALUE_TRUE
 								.equals(msgContext
 										.getProperty(Constants.Configuration.ENABLE_REST))) {
-					msgContext.setProperty(Constants.Configuration.DO_REST,
-							Constants.VALUE_TRUE);
+					msgContext.setDoingREST(true);
 					SOAPFactory soapFactory = new SOAP11Factory();
                     Reader reader = new InputStreamReader(in);
                     XMLStreamReader xmlreader = XMLInputFactory.newInstance()
@@ -133,8 +131,7 @@
 			if (envelope == null) {
 				return false;
 			} else {
-				msgContext.setProperty(Constants.Configuration.DO_REST,
-						Constants.VALUE_TRUE);
+				msgContext.setDoingREST(true);
 				msgContext.setEnvelope(envelope);
 				AxisEngine engine = new AxisEngine(configurationContext);
 				engine.receive(msgContext);



Mime
View raw message