axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hemap...@apache.org
Subject svn commit: r202470 - in /webservices/axis/trunk/java/modules/core/src/org/apache/axis: context/ receivers/ transport/ transport/http/
Date Thu, 30 Jun 2005 02:58:00 GMT
Author: hemapani
Date: Wed Jun 29 19:57:59 2005
New Revision: 202470

URL: http://svn.apache.org/viewcvs?rev=202470&view=rev
Log:
handle the MTOM as the HTTP response

Added:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPOutTransportInfo.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/ServletBasedOutTransportInfo.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPOutTransportInfo.java
Modified:
    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/http/AxisServlet.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPConstants.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
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPWorker.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPOutputStream.java

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=202470&r1=202469&r2=202470&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 19:57:59 2005
@@ -45,6 +45,8 @@
      * Field TRANSPORT_READER
      */
     public static final String TRANSPORT_IN = "TRANSPORT_IN";
+    
+    
 
     /**
      * Field TRANSPORT_SUCCEED
@@ -124,7 +126,7 @@
     
     private String soapAction;
     
-    private boolean doMTOM = false;
+    private boolean doingMTOM = false;
     
     /**
      * Conveniance Method, but before call engine.send() or  engine.receive() one must send
transport in/out
@@ -572,15 +574,15 @@
     /**
      * @return
      */
-    public boolean isDoMTOM() {
-        return doMTOM;
+    public boolean isDoingMTOM() {
+        return doingMTOM;
     }
 
     /**
      * @param b
      */
-    public void setDoMTOM(boolean b) {
-        doMTOM = b;
+    public void setDoingMTOM(boolean b) {
+        doingMTOM = 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=202470&r1=202469&r2=202470&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 19:57:59 2005
@@ -57,7 +57,7 @@
         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.setDoMTOM(messgeCtx.isDoMTOM());
+        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=202470&r1=202469&r2=202470&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 19:57:59 2005
@@ -82,7 +82,7 @@
 			this.doREST = true;
 		}
         
-        msgContext.setDoMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
+        msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
 
 		OutputStream out = null;
 
@@ -138,7 +138,7 @@
 			OMOutput omOutput = null;
 
 			try {
-				if (msgContext.isDoMTOM()) {
+				if (msgContext.isDoingMTOM()) {
 					omOutput = new OMOutput(out, true);
 					outputMessage.serialize(omOutput);
 					omOutput.flush();

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=202470&r1=202469&r2=202470&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 19:57:59 2005
@@ -109,6 +109,7 @@
                         new QName(Constants.TRANSPORT_HTTP)));
                     msgContext.setProperty(Constants.Configuration.DO_REST, Constants.VALUE_TRUE);
             msgContext.setServerSide(true);
+            msgContext.setProperty(HTTPConstants.HTTPOutTransportInfo,new ServletBasedOutTransportInfo(httpServletResponse));
 
             boolean processed =
                 HTTPTransportUtils.processHTTPGetRequest(

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPConstants.java?rev=202470&r1=202469&r2=202470&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPConstants.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPConstants.java
Wed Jun 29 19:57:59 2005
@@ -385,6 +385,7 @@
      */
     public static final String HTTP_REQ_TYPE = "HTTP_REQ_TYPE";
     
+    public static final String HTTPOutTransportInfo = "HTTPOutTransportInfo";
 
        /**
         * Default content encoding chatset

Added: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPOutTransportInfo.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPOutTransportInfo.java?rev=202470&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPOutTransportInfo.java
(added)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPOutTransportInfo.java
Wed Jun 29 19:57:59 2005
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *  Runtime state of the engine
+ */
+package org.apache.axis.transport.http;
+
+/**
+ * @author hemapani
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public interface HTTPOutTransportInfo {
+    public abstract void setContentType(String contentType);
+}
\ No newline at end of file

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=202470&r1=202469&r2=202470&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 19:57:59 2005
@@ -55,7 +55,7 @@
             String soapActionString =
                 soapAction == null ? "" : soapAction.toString();
             
-            boolean doMTOM = msgContext.isDoMTOM();
+            boolean doMTOM = msgContext.isDoingMTOM();
             StringBuffer buf = new StringBuffer();
             buf.append(HTTPConstants.HEADER_POST).append(" ");
             buf.append(url.getFile()).append(" ").append(httpVersion).append("\n");
@@ -76,7 +76,7 @@
                     .append(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED)
                     .append("\n");
             } 
-            if(!chuncked && !msgContext.isDoMTOM()) {
+            if(!chuncked && !msgContext.isDoingMTOM()) {
                 buf.append(HTTPConstants.HEADER_CONTENT_LENGTH).append(": " + contentLength
+ "\n");
             }
             if (!this.doREST) {
@@ -133,7 +133,7 @@
                 (TransportSenderInfo) msgContext.getProperty(
                     TRANSPORT_SENDER_INFO);
             InputStream in = null;
-            if(chuncked || msgContext.isDoMTOM()){
+            if(chuncked || msgContext.isDoingMTOM()){
                 if (chuncked) {
                     ((ChunkedOutputStream) out).eos();
                 } 
@@ -185,7 +185,7 @@
         throws AxisFault {
         msgctx.setProperty(TRANSPORT_SENDER_INFO, new TransportSenderInfo());
         
-        if(msgctx.isDoMTOM() || chuncked){
+        if(msgctx.isDoingMTOM() || chuncked){
             return openSocket(msgctx);
         } else {
             TransportSenderInfo transportInfo =
@@ -199,18 +199,10 @@
         MessageContext msgContext,
         OutputStream out)
         throws AxisFault {
-        //        Object contianerManaged =
-        //            msgContext.getProperty(Constants.CONTAINER_MANAGED);
-        //        if (contianerManaged == null
-        //            || !Constants.VALUE_TRUE.equals(contianerManaged)) {
-        //            try {
-        //                out.write(new String(HTTPConstants.HTTP).getBytes());
-        //                out.write(new String(HTTPConstants.OK).getBytes());
-        //                out.write("\n\n".getBytes());
-        //            } catch (IOException e) {
-        //                throw new AxisFault(e);
-        //            }
-        //        }
+        if(msgContext.isDoingMTOM()){
+            HTTPOutTransportInfo httpOutTransportInfo = (HTTPOutTransportInfo)msgContext.getProperty(HTTPConstants.HTTPOutTransportInfo);
+            httpOutTransportInfo.setContentType(OMOutput.getContentType(true));
+        }
         return out;
     }
 
@@ -219,7 +211,7 @@
         OutputStream out)
         throws AxisFault {
         try {
-            if(msgContext.isDoMTOM() || chuncked){
+            if(msgContext.isDoingMTOM() || chuncked){
                 TransportSenderInfo transportInfo =
                     (TransportSenderInfo) msgContext.getProperty(
                         TRANSPORT_SENDER_INFO);

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=202470&r1=202469&r2=202470&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 19:57:59 2005
@@ -231,7 +231,7 @@
 		boolean envelopeContainsOptimise = HTTPTransportUtils
 				.checkEnvelopeForOptimise(msgContext.getEnvelope());
 		boolean doMTOM = enableMTOM && envelopeContainsOptimise;
-		msgContext.setDoMTOM(doMTOM);
+		msgContext.setDoingMTOM(doMTOM);
 		return doMTOM;
 	}
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPWorker.java?rev=202470&r1=202469&r2=202470&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPWorker.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPWorker.java
Wed Jun 29 19:57:59 2005
@@ -63,11 +63,11 @@
                         transportOut);
                 msgContext.setServerSide(true);
 
-                // We do not have any Addressing Headers to put
-                // let us put the information about incoming transport
+                //parse the Transport Headers
                 HTTPTransportReceiver reciver = new HTTPTransportReceiver();
                 Map map = reciver.parseTheHeaders(inStream, true);
 
+                //build a way to write the respone if the Axis choose to do so
                 SimpleHTTPOutputStream out;
                 String transferEncoding = (String) map.get(HTTPConstants.HEADER_TRANSFER_ENCODING);
                 if (transferEncoding != null
@@ -77,12 +77,14 @@
                 } else {
                     out = new SimpleHTTPOutputStream(socket.getOutputStream(), false);
                 }
-                
-
-                //OutputStream out = socket.getOutputStream();
                 msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
 
+                //This is way to provide Accsess to the transport information to the transport
Sender
+                msgContext.setProperty(HTTPConstants.HTTPOutTransportInfo,new SimpleHTTPOutTransportInfo(out));
+                
+
                 if (HTTPConstants.HEADER_GET.equals(map.get(HTTPConstants.HTTP_REQ_TYPE)))
{
+                    //It is GET handle the Get request 
                     boolean processed =
                         HTTPTransportUtils.processHTTPGetRequest(
                             msgContext,
@@ -101,6 +103,7 @@
                         out.flush();
                     }
                 } else {
+                    //It is POST, handle it
                     HTTPTransportUtils.processHTTPPostRequest(
                         msgContext,
                         inStream,

Added: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/ServletBasedOutTransportInfo.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/ServletBasedOutTransportInfo.java?rev=202470&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/ServletBasedOutTransportInfo.java
(added)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/ServletBasedOutTransportInfo.java
Wed Jun 29 19:57:59 2005
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *  Runtime state of the engine
+ */
+package org.apache.axis.transport.http;
+
+import javax.servlet.http.HttpServletResponse;
+
+public class ServletBasedOutTransportInfo implements HTTPOutTransportInfo {
+    private HttpServletResponse response;
+    public ServletBasedOutTransportInfo(HttpServletResponse response){
+        this.response = response;
+    }
+    public void setContentType(String contentType){
+        response.setContentType(contentType);
+    }
+}

Added: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPOutTransportInfo.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPOutTransportInfo.java?rev=202470&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPOutTransportInfo.java
(added)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPOutTransportInfo.java
Wed Jun 29 19:57:59 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *  Runtime state of the engine
+ */
+package org.apache.axis.transport.http;
+
+public class SimpleHTTPOutTransportInfo implements HTTPOutTransportInfo{
+    private SimpleHTTPOutputStream outInfo;
+    public SimpleHTTPOutTransportInfo(SimpleHTTPOutputStream outInfo){
+        this.outInfo = outInfo;
+    }
+
+    public void setContentType(String contentType) {
+        outInfo.setContentType(contentType);
+    }
+}

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPOutputStream.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPOutputStream.java?rev=202470&r1=202469&r2=202470&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPOutputStream.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPOutputStream.java
Wed Jun 29 19:57:59 2005
@@ -26,6 +26,7 @@
 public class SimpleHTTPOutputStream extends FilterOutputStream {
     private boolean written = false;
     private boolean chuncked = false;
+    private String contentType = null;
     
     public SimpleHTTPOutputStream(
         OutputStream out,boolean chuncked)
@@ -72,10 +73,18 @@
             buf.append(new String(HTTPConstants.OK)).append("\n");
             buf.append(HTTPConstants.HEADER_TRANSFER_ENCODING).append(": ");
             buf.append(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED).append("\n");
+            if(contentType != null){
+                buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ");
+                buf.append(contentType).append("\n");
+            }
             buf.append("\n");
         }else{
             buf.append(new String(HTTPConstants.HTTP));
             buf.append(new String(HTTPConstants.OK)).append("\n");
+            if(contentType != null){
+                buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ");
+                buf.append(contentType).append("\n");
+            }
             buf.append("\n");
         }
         out.write(buf.toString().getBytes());
@@ -111,6 +120,13 @@
             finalize();
         }
         super.close();
+    }
+
+    /**
+     * @param string
+     */
+    public void setContentType(String string) {
+        contentType = string;
     }
 
 }



Mime
View raw message