ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hemap...@apache.org
Subject svn commit: r154637 - in webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport: AbstractTransportSender.java http/HTTPTransportSender.java
Date Mon, 21 Feb 2005 06:27:27 GMT
Author: hemapani
Date: Sun Feb 20 22:27:25 2005
New Revision: 154637

URL: http://svn.apache.org/viewcvs?view=rev&rev=154637
Log:
clean up transport bit more

Modified:
    webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/AbstractTransportSender.java
    webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/HTTPTransportSender.java

Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/AbstractTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/AbstractTransportSender.java?view=diff&r1=154636&r2=154637
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/AbstractTransportSender.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/AbstractTransportSender.java
Sun Feb 20 22:27:25 2005
@@ -15,6 +15,12 @@
  */
 package org.apache.axis.transport;
 
+import java.io.Writer;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
 import org.apache.axis.addressing.EndpointReference;
 import org.apache.axis.context.MessageContext;
 import org.apache.axis.description.HandlerMetadata;
@@ -24,12 +30,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-import java.io.OutputStream;
-import java.io.Writer;
-
 /**
  */
 public abstract class AbstractTransportSender extends AbstractHandler
@@ -66,28 +66,28 @@
             if (msgContext.getFaultTo() != null) {
                 log.info("Obtain the output stream to send the fault flow to "
                                 + msgContext.getFaultTo().getAddress());
-                out = obtainOutputStream(msgContext, msgContext.getFaultTo());
+                out = obtainWriter(msgContext, msgContext.getFaultTo());
             } else {
                 log.info(
                         "Obtain the output stream to send the fault flow to ANONYMOUS");
-                out = obtainOutputStream(msgContext);
+                out = obtainWriter(msgContext);
             }
         } else {
             if (msgContext.getTo() != null) {
                 log.info("Obtain the output stream to send to To flow to "
                                 + msgContext.getTo().getAddress());
-                out = obtainOutputStream(msgContext, msgContext.getTo());
+                out = obtainWriter(msgContext, msgContext.getTo());
             } else if (msgContext.getReplyTo() != null) {
                 log.info("Obtain the output stream to send to ReplyTo flow to "
                                 + msgContext.getReplyTo().getAddress());
-                out = obtainOutputStream(msgContext, msgContext.getTo());
+                out = obtainWriter(msgContext, msgContext.getTo());
             } else {
                 log.info(
                         "Obtain the output stream to send the fault flow to ANONYMOUS");
-                out = obtainOutputStream(msgContext);
+                out = obtainWriter(msgContext);
             }
         }
-        startSending(msgContext);
+        startSending(msgContext,out);
         SOAPEnvelope envelope = msgContext.getEnvelope();
         if (envelope != null) {
             XMLStreamWriter outputWriter = null;
@@ -101,7 +101,7 @@
                 throw new AxisFault("Stream error", e);
             }
         }
-        finalizeSending(msgContext);
+        finalizeSending(msgContext,out);
         log.info("Send the Response");
     }
 
@@ -111,8 +111,7 @@
      * @param msgContext
      * @throws AxisFault
      */
-    protected void startSending(MessageContext msgContext) throws AxisFault {
-    }
+    protected abstract void startSending(MessageContext msgContext,Writer writer) throws
AxisFault;
 
     /**
      * Method obtainOutputStream
@@ -122,7 +121,7 @@
      * @return
      * @throws AxisFault
      */
-    protected abstract Writer obtainOutputStream(
+    protected abstract Writer obtainWriter(
             MessageContext msgContext, EndpointReference epr) throws AxisFault;
 
     /**
@@ -132,7 +131,7 @@
      * @return
      * @throws AxisFault
      */
-    protected abstract Writer obtainOutputStream(MessageContext msgContext)
+    protected abstract Writer obtainWriter(MessageContext msgContext)
             throws AxisFault;
 
     /**
@@ -141,7 +140,6 @@
          * @param msgContext
          * @throws AxisFault
          */
-    protected void finalizeSending(MessageContext msgContext)
-            throws AxisFault {
-    }
+    protected abstract void finalizeSending(MessageContext msgContext,Writer writer)
+            throws AxisFault ;
 }

Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/HTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/HTTPTransportSender.java?view=diff&r1=154636&r2=154637
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/HTTPTransportSender.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/HTTPTransportSender.java
Sun Feb 20 22:27:25 2005
@@ -15,13 +15,6 @@
  */
 package org.apache.axis.transport.http;
 
-import org.apache.axis.addressing.EndpointReference;
-import org.apache.axis.context.MessageContext;
-import org.apache.axis.engine.AxisFault;
-import org.apache.axis.transport.AbstractTransportSender;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
@@ -33,6 +26,11 @@
 import java.net.SocketAddress;
 import java.net.URL;
 
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.transport.AbstractTransportSender;
+
 /**
  * Class HTTPTransportSender
  */
@@ -54,7 +52,7 @@
      * @return
      * @throws AxisFault
      */
-    protected Writer obtainOutputStream(MessageContext msgContext)
+    protected Writer obtainWriter(MessageContext msgContext)
             throws AxisFault {
         if (!msgContext.isServerSide()) {
             EndpointReference toURL = msgContext.getTo();
@@ -66,12 +64,11 @@
                     socket = new Socket();
                     socket.connect(add);
                     OutputStream outS = socket.getOutputStream();
-                    out = new BufferedWriter(new OutputStreamWriter(outS));
+                    out = new OutputStreamWriter(outS);
                     writeTransportHeaders(out, url);
                     msgContext.setProperty(
                             MessageContext.TRANSPORT_READER,
-                            new BufferedReader(
-                                    new InputStreamReader(socket.getInputStream())));
+                                    new InputStreamReader(socket.getInputStream()));
                     msgContext.setProperty(HTTPConstants.SOCKET, socket);
                 } catch (MalformedURLException e) {
                     throw new AxisFault(e.getMessage(), e);
@@ -101,11 +98,11 @@
      * @return
      * @throws AxisFault
      */
-    protected Writer obtainOutputStream(
+    protected Writer obtainWriter(
             MessageContext msgContext, EndpointReference epr) throws AxisFault {
 
         // TODO this is temporay work around
-        return obtainOutputStream(msgContext);
+        return obtainWriter(msgContext);
     }
 
     /**
@@ -114,7 +111,7 @@
      * @param msgContext
      * @throws AxisFault
      */
-    protected void finalizeSending(MessageContext msgContext)
+    protected void finalizeSending(MessageContext msgContext,Writer writer)
             throws AxisFault {
         try {
             socket.shutdownOutput();
@@ -129,7 +126,7 @@
      * @param msgContext
      * @throws AxisFault
      */
-    protected void startSending(MessageContext msgContext) throws AxisFault {
+    protected void startSending(MessageContext msgContext,Writer out) throws AxisFault {
     }
 
     /**
@@ -150,6 +147,6 @@
         buf.append("Cache-Control: no-cache\n");
         buf.append("Pragma: no-cache\n");
         buf.append("SOAPAction: \"\"\n\n");
-        out.write(buf.toString().toCharArray());
+        out.write(buf.toString());
     }
 }



Mime
View raw message