axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject svn commit: r210150 [6/35] - in /webservices/axis/trunk/java: ./ etc/ modules/addressing/ modules/addressing/src/org/apache/axis2/handlers/addressing/ modules/addressing/test-resources/ modules/addressing/test/org/apache/axis2/handlers/addressing/ modu...
Date Mon, 11 Jul 2005 15:49:55 GMT
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedInputStream.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedInputStream.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedInputStream.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedInputStream.java Mon Jul 11 08:49:30 2005
@@ -21,25 +21,25 @@
 
 
 /**
- *
- * @author Rick Rineholt 
+ * @author Rick Rineholt
  */
 
 public class ChunkedInputStream extends java.io.FilterInputStream {
     protected long chunkSize = 0l;
     protected volatile boolean closed = false;
     private static final int maxCharLong = (Long.toHexString(Long.MAX_VALUE))
-      .toString().length();
-    private ChunkedInputStream () {
+            .toString().length();
+
+    private ChunkedInputStream() {
         super(null);
     }
 
-    public ChunkedInputStream (InputStream is) {
+    public ChunkedInputStream(InputStream is) {
         super(is);
     }
 
     public int read()
-        throws IOException {
+            throws IOException {
         byte[] d = new byte[1];
         int rc = read(d, 0, 1);
 
@@ -47,44 +47,45 @@
     }
 
     public int read(byte[] b)
-        throws IOException {
+            throws IOException {
         return read(b, 0, b.length);
     }
 
     public synchronized int read(byte[] b,
-        int off,
-        int len)
-        throws IOException {
+                                 int off,
+                                 int len)
+            throws IOException {
         if (closed) return -1;
         int cs = (int) Math.min(Integer.MAX_VALUE, chunkSize);
         int totalread = 0;
-        int bytesread = 0; 
+        int bytesread = 0;
 
         try {
             do {
                 if (chunkSize < 1L) {
                     if (0l == getChunked()) {
-                        if (totalread == 0) return -1;
-                        else return totalread;
+                        if (totalread == 0)
+                            return -1;
+                        else
+                            return totalread;
                     }
                 }
                 bytesread = in.read(b, off + totalread, Math.min(len - totalread,
-                                (int) Math.min(chunkSize, Integer.MAX_VALUE)));
+                                                                 (int) Math.min(chunkSize, Integer.MAX_VALUE)));
                 if (bytesread > 0) {
                     totalread += bytesread;
                     chunkSize -= bytesread;
                 }
-            }
-            while (len - totalread > 0 && bytesread > -1);
+            } while (len - totalread > 0 && bytesread > -1);
         } catch (IOException e) {
             closed = true;
             throw e;
         }
-        return  totalread;
+        return totalread;
     }
 
     public long skip(final long n)
-        throws IOException {
+            throws IOException {
         if (closed) return 0;
         long skipped = 0l;
         byte[] b = new byte[1024];
@@ -93,25 +94,24 @@
         do {
             bread = read(b, 0, b.length);
             if (bread > 0) skipped += bread;
-        }
-        while (bread != -1 && skipped < n);
+        } while (bread != -1 && skipped < n);
         return skipped;
     }
 
     public int available()
-        throws IOException {
+            throws IOException {
         if (closed) return 0;
         int rc = (int) Math.min(chunkSize, Integer.MAX_VALUE);
 
-        return  Math.min(rc, in.available());
+        return Math.min(rc, in.available());
     }
-              
-    protected long getChunked()throws IOException {
+
+    protected long getChunked() throws IOException {
         //StringBuffer buf= new StringBuffer(1024);
-        byte[]buf = new byte[maxCharLong + 2];
+        byte[] buf = new byte[maxCharLong + 2];
         int bufsz = 0;
- 
-        chunkSize = -1L; 
+
+        chunkSize = -1L;
         int c = -1;
 
         do {
@@ -121,8 +121,7 @@
                     buf[bufsz++] = ((byte) c);
                 }
             }
-        }
-        while (c > -1 && (c != '\n' || bufsz == 0) && bufsz < buf.length);
+        } while (c > -1 && (c != '\n' || bufsz == 0) && bufsz < buf.length);
         if (c < 0) {
             closed = true;
         }
@@ -138,18 +137,19 @@
             closed = true;
             throw new IOException("'" + sbuf + "' " + ne.getMessage());
         }
-        if (chunkSize < 1L) closed = true;                  
+        if (chunkSize < 1L) closed = true;
         if (chunkSize != 0L && c < 0) {
             //If chunk size is zero try and be tolerant that there maybe no cr or lf at the end.
             throw new IOException("HTTP Chunked stream closed in middle of chunk.");
         }
-        if (chunkSize < 0L) throw new IOException("HTTP Chunk size received " +
-            chunkSize + " is less than zero.");
-        return chunkSize;                  
+        if (chunkSize < 0L)
+            throw new IOException("HTTP Chunk size received " +
+                                  chunkSize + " is less than zero.");
+        return chunkSize;
     }
 
     public void close() throws IOException {
-   
+
         synchronized (this) {
             if (closed) return;
             closed = true;
@@ -160,8 +160,7 @@
 
         do {
             bread = read(b, 0, b.length);
-        }
-        while (bread != -1);
+        } while (bread != -1);
     }
 
     /*
@@ -172,7 +171,7 @@
      */
 
     public void reset()
-        throws IOException {
+            throws IOException {
         throw new IOException("Don't support marked streams");
     }
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedOutputStream.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedOutputStream.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedOutputStream.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedOutputStream.java Mon Jul 11 08:49:30 2005
@@ -22,8 +22,7 @@
 
 
 /**
- *
- * @author Rick Rineholt 
+ * @author Rick Rineholt
  */
 public class ChunkedOutputStream extends FilterOutputStream {
 
@@ -38,24 +37,24 @@
     }
 
     public void write(int b)
-        throws IOException {
-        write(new byte[] {(byte) b}, 0, 1);
+            throws IOException {
+        write(new byte[]{(byte) b}, 0, 1);
     }
 
     public void write(byte[] b)
-            
-        throws IOException {
+
+            throws IOException {
         write(b, 0, b.length);
     }
 
     static final byte[] crlf = "\r\n".getBytes();
 
     public void write(byte[] b,
-        int off,
-        int len)
-        throws IOException {
+                      int off,
+                      int len)
+            throws IOException {
         if (len == 0) return;
-           
+
         out.write((Integer.toHexString(len)).getBytes());
         out.write(crlf);
         out.write(b, off, len);
@@ -69,7 +68,7 @@
      }
      */
 
-    public void eos()throws IOException {
+    public void eos() throws IOException {
         synchronized (this) {
             if (eos) return;
             eos = true;
@@ -77,9 +76,9 @@
         out.write("0\r\n\r\n".getBytes());
         out.flush();
     }
-    
+
     public void close()
-        throws IOException {
+            throws IOException {
         eos();
         out.close();
     }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Mon Jul 11 08:49:30 2005
@@ -45,309 +45,304 @@
 import java.net.URL;
 
 public class CommonsHTTPTransportSender extends AbstractHandler implements
-		TransportSender {
-	private boolean chuncked = false;
+        TransportSender {
+    private boolean chuncked = false;
 
-	private String httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
+    private String httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
 
-	public static final String HTTP_METHOD = "HTTP_METHOD";
+    public static final String HTTP_METHOD = "HTTP_METHOD";
 
-	protected HttpClient httpClient;
+    protected HttpClient httpClient;
 
-	protected OMElement outputMessage;
-
-	public CommonsHTTPTransportSender() {
-	} //default
-
-	public void invoke(MessageContext msgContext) 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
-			msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
-
-			EndpointReference epr = null;
-			if (msgContext.getTo() != null
-					&& !AddressingConstants.Submission.WSA_ANONYMOUS_URL
-							.equals(msgContext.getTo().getAddress())
-					&& !AddressingConstants.Final.WSA_ANONYMOUS_URL
-							.equals(msgContext.getTo().getAddress())) {
-				epr = msgContext.getTo();
-			}
-
-			OMElement dataOut = null;
-			if (msgContext.isDoingREST()) {
-				dataOut = msgContext.getEnvelope().getFirstElement();
-			} else {
-				dataOut = msgContext.getEnvelope();
-			}
-
-			//TODO timeout, configuration
-			if (epr != null) {
-				writeMessageWithCommons(msgContext, epr, dataOut);
-			} else {
-				OutputStream out = (OutputStream) msgContext
-						.getProperty(MessageContext.TRANSPORT_OUT);
-				OMOutput output = new OMOutput(out, false);
-				dataOut.serialize(output);
-			}
-			msgContext.getOperationContext().setProperty(
-					Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
-		} catch (XMLStreamException e) {
-			throw new AxisFault(e);
-		} catch (FactoryConfigurationError e) {
-			throw new AxisFault(e);
-		}
-	}
-
-	public void writeMessageWithToOutPutStream(MessageContext msgContext,
-			OutputStream out) {
-
-	}
-
-	public void writeMessageWithCommons(MessageContext msgContext,
-			EndpointReference toURL, OMElement dataout) throws AxisFault {
-		try {
-			URL url = new URL(toURL.getAddress());
-			//Configure the transport
-			String soapAction = msgContext.getWSAAction();
-			//settign soapAction
-			String soapActionString = soapAction == null ? "" : soapAction
-					.toString();
-
-			PostMethod postMethod = new PostMethod();
-			postMethod.setPath(url.getFile());
-			msgContext.setProperty(HTTP_METHOD, postMethod);
-			postMethod.setRequestEntity(new AxisRequestEntity(dataout,
-					chuncked, msgContext.isDoingMTOM()));
-			if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)
-					&& chuncked) {
-				((PostMethod) postMethod).setContentChunked(true);
-			}
-
-			if (msgContext.isDoingMTOM()) {
-				postMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
-						OMOutput.getContentType(true));
-			} else {
-				postMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
-						"text/xml; charset=utf-8");
-			}
-			postMethod.setRequestHeader(HTTPConstants.HEADER_ACCEPT,
-					HTTPConstants.HEADER_ACCEPT_APPL_SOAP
-							+ HTTPConstants.HEADER_ACCEPT_APPLICATION_DIME
-							+ HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED
-							+ HTTPConstants.HEADER_ACCEPT_TEXT_ALL);
-			postMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url
-					.getHost());
-			postMethod.setRequestHeader(HTTPConstants.HEADER_CACHE_CONTROL,
-					"no-cache");
-			postMethod
-					.setRequestHeader(HTTPConstants.HEADER_PRAGMA, "no-cache");
-			//content length is not set yet
-			//setting HTTP vesion
-
-			if (httpVersion != null) {
-				if (httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)) {
-					//postMethod.setHttp11(false); todo method to findout the
-					// transport version...
-					//allowing keep-alive for 1.0
-					postMethod.setRequestHeader(
-							HTTPConstants.HEADER_CONNECTION,
-							HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
-				} else {
-					// allowing keep-alive for 1.1
-					postMethod.setRequestHeader(
-							HTTPConstants.HEADER_CONNECTION,
-							HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
-				}
-			}
-			// othervise assumes HTTP 1.1 and keep-alive is default.
-			if (!msgContext.isDoingREST()) {
-				postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION,
-						soapActionString);
-			}
-
-			//execuite the HtttpMethodBase - a connection manager can be given
-			// for handle multiple
-			httpClient = new HttpClient();
-			//hostConfig handles the socket functions..
-			HostConfiguration hostConfig = getHostConfiguration(msgContext, url);
-
-			//code that wirte the stream to the wire
-
-			this.httpClient.executeMethod(hostConfig, postMethod);
-			if (postMethod.getStatusCode() == HttpStatus.SC_OK) {
-				InputStream in = postMethod.getResponseBodyAsStream();
-				if (in == null) {
-					throw new AxisFault("Input Stream can not be Null");
-				}
-				msgContext.getOperationContext().setProperty(
-						MessageContext.TRANSPORT_IN, in);
-				Header contentTypeHeader = postMethod
-						.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
-				if (contentTypeHeader != null) {
-					String contentType = contentTypeHeader.getValue();
-					if (contentType != null
-							&& contentType
-									.indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >= 0) {
-						OperationContext opContext = msgContext
-								.getOperationContext();
-						if (opContext != null) {
-							opContext.setProperty(
-									HTTPConstants.MTOM_RECIVED_CONTENT_TYPE,
-									contentType);
-						}
-					}
-				}
-
-			} else if (postMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
-				return;
-			} else {
-				throw new AxisFault("Error " + postMethod.getStatusCode()
-						+ "  Error Message is "
-						+ postMethod.getResponseBodyAsString());
-			}
-		} catch (MalformedURLException e) {
-			throw new AxisFault(e);
-		} catch (HttpException e) {
-			throw new AxisFault(e);
-		} catch (IOException e) {
-			throw new AxisFault(e);
-		}
-
-	}
-
-	protected HostConfiguration getHostConfiguration(MessageContext context,
-			URL targetURL) {
-		//TODO cheaking wheather the host is a proxy
-		HostConfiguration config = new HostConfiguration();
-		config.setHost(targetURL.getHost(), targetURL.getPort() == -1 ? 80
-				: targetURL.getPort());
-		return config;
-	}
-
-	//get the contentLength...
-	public class AxisRequestEntity implements RequestEntity {
-		private OMElement element;
-
-		private boolean chuncked;
-
-		private byte[] bytes;
-
-		private boolean doingMTOM = false;
-
-		public AxisRequestEntity(OMElement element, boolean chuncked,
-				boolean doingMTOM) {
-			this.element = element;
-			this.chuncked = chuncked;
-			this.doingMTOM = doingMTOM;
-		}
-
-		public boolean isRepeatable() {
-			return false;
-		}
-
-		public byte[] writeBytes() throws AxisFault {
-			try {
-				ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
-				XMLStreamWriter outputWriter = XMLOutputFactory.newInstance()
-						.createXMLStreamWriter(bytesOut);
-				OMOutput output = new OMOutput(outputWriter);
-				element.serialize(output);
-				outputWriter.flush();
-				return bytesOut.toByteArray();
-			} catch (XMLStreamException e) {
-				throw new AxisFault(e);
-			} catch (FactoryConfigurationError e) {
-				throw new AxisFault(e);
-			}
-		}
-
-		public void writeRequest(OutputStream out) throws IOException {
-			try {
-				if (chuncked || doingMTOM) {
-					OMOutput output = new OMOutput(out, doingMTOM);
-					element.serialize(output);
-					if (doingMTOM)
-						output.complete();
-					output.flush();
-					out.flush();
-				} else {
-					if (bytes == null) {
-						bytes = writeBytes();
-					}
-					out.write(bytes);
-				}
-			} catch (XMLStreamException e) {
-				throw new AxisFault(e);
-			} catch (FactoryConfigurationError e) {
-				throw new AxisFault(e);
-			} catch (IOException e) {
-				throw new AxisFault(e);
-			}
-		}
-
-		public long getContentLength() {
-			try {
-				if (chuncked) {
-					return -1;
-				} else {
-					if (bytes == null) {
-						bytes = writeBytes();
-					}
-					return bytes.length;
-				}
-			} catch (AxisFault e) {
-				return -1;
-			}
-		}
-
-		public String getContentType() {
-			return "text/xml; charset=utf-8";
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.axis2.transport.TransportSender#cleanUp(org.apache.axis2.context.MessageContext)
-	 */
-	public void cleanUp(MessageContext msgContext) throws AxisFault {
-		HttpMethod httpMethod = (HttpMethod) msgContext
-				.getProperty(HTTP_METHOD);
-		if (httpMethod != null) {
-			httpMethod.releaseConnection();
-		}
-
-	}
-
-	public void init(ConfigurationContext confContext,
-			TransportOutDescription transportOut) throws AxisFault {
-		//<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.0</parameter> or
-		//<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.1</parameter> is
-		// checked
-		Parameter version = transportOut
-				.getParameter(HTTPConstants.PROTOCOL_VERSION);
-		if (version != null) {
-			if (HTTPConstants.HEADER_PROTOCOL_11.equals(version.getValue())) {
-				this.httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
-				Parameter transferEncoding = transportOut
-						.getParameter(HTTPConstants.HEADER_TRANSFER_ENCODING);
-				if (transferEncoding != null
-						&& HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED
-								.equals(transferEncoding.getValue())) {
-					this.chuncked = true;
-				}
-			} else if (HTTPConstants.HEADER_PROTOCOL_10.equals(version
-					.getValue())) {
-				//TODO HTTP1.0 specific parameters
-			} else {
-				throw new AxisFault("Parameter "
-						+ HTTPConstants.PROTOCOL_VERSION
-						+ " Can have values only HTTP/1.0 or HTTP/1.1");
-			}
-		}
+    protected OMElement outputMessage;
+
+    public CommonsHTTPTransportSender() {
+    } //default
+
+    public void invoke(MessageContext msgContext) 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
+            msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
+
+            EndpointReference epr = null;
+            if (msgContext.getTo() != null
+                    && !AddressingConstants.Submission.WSA_ANONYMOUS_URL
+                    .equals(msgContext.getTo().getAddress())
+                    && !AddressingConstants.Final.WSA_ANONYMOUS_URL
+                    .equals(msgContext.getTo().getAddress())) {
+                epr = msgContext.getTo();
+            }
+
+            OMElement dataOut = null;
+            if (msgContext.isDoingREST()) {
+                dataOut = msgContext.getEnvelope().getFirstElement();
+            } else {
+                dataOut = msgContext.getEnvelope();
+            }
+
+            //TODO timeout, configuration
+            if (epr != null) {
+                writeMessageWithCommons(msgContext, epr, dataOut);
+            } else {
+                OutputStream out = (OutputStream) msgContext
+                        .getProperty(MessageContext.TRANSPORT_OUT);
+                OMOutput output = new OMOutput(out, false);
+                dataOut.serialize(output);
+            }
+            msgContext.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
+        } catch (XMLStreamException e) {
+            throw new AxisFault(e);
+        } catch (FactoryConfigurationError e) {
+            throw new AxisFault(e);
+        }
+    }
+
+    public void writeMessageWithToOutPutStream(MessageContext msgContext,
+                                               OutputStream out) {
+
+    }
+
+    public void writeMessageWithCommons(MessageContext msgContext,
+                                        EndpointReference toURL, OMElement dataout) throws AxisFault {
+        try {
+            URL url = new URL(toURL.getAddress());
+            //Configure the transport
+            String soapAction = msgContext.getWSAAction();
+            //settign soapAction
+            String soapActionString = soapAction == null ? "" : soapAction
+                    .toString();
+
+            PostMethod postMethod = new PostMethod();
+            postMethod.setPath(url.getFile());
+            msgContext.setProperty(HTTP_METHOD, postMethod);
+            postMethod.setRequestEntity(new AxisRequestEntity(dataout,
+                                                              chuncked, msgContext.isDoingMTOM()));
+            if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)
+                    && chuncked) {
+                ((PostMethod) postMethod).setContentChunked(true);
+            }
+
+            if (msgContext.isDoingMTOM()) {
+                postMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
+                                            OMOutput.getContentType(true));
+            } else {
+                postMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
+                                            "text/xml; charset=utf-8");
+            }
+            postMethod.setRequestHeader(HTTPConstants.HEADER_ACCEPT,
+                                        HTTPConstants.HEADER_ACCEPT_APPL_SOAP
+                                        + HTTPConstants.HEADER_ACCEPT_APPLICATION_DIME
+                                        + HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED
+                                        + HTTPConstants.HEADER_ACCEPT_TEXT_ALL);
+            postMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url
+                                                                   .getHost());
+            postMethod.setRequestHeader(HTTPConstants.HEADER_CACHE_CONTROL,
+                                        "no-cache");
+            postMethod
+                    .setRequestHeader(HTTPConstants.HEADER_PRAGMA, "no-cache");
+            //content length is not set yet
+            //setting HTTP vesion
+
+            if (httpVersion != null) {
+                if (httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)) {
+                    //postMethod.setHttp11(false); todo method to findout the
+                    // transport version...
+                    //allowing keep-alive for 1.0
+                    postMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION,
+                                                HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
+                } else {
+                    // allowing keep-alive for 1.1
+                    postMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION,
+                                                HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
+                }
+            }
+            // othervise assumes HTTP 1.1 and keep-alive is default.
+            if (!msgContext.isDoingREST()) {
+                postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION,
+                                            soapActionString);
+            }
+
+            //execuite the HtttpMethodBase - a connection manager can be given
+            // for handle multiple
+            httpClient = new HttpClient();
+            //hostConfig handles the socket functions..
+            HostConfiguration hostConfig = getHostConfiguration(msgContext, url);
+
+            //code that wirte the stream to the wire
+
+            this.httpClient.executeMethod(hostConfig, postMethod);
+            if (postMethod.getStatusCode() == HttpStatus.SC_OK) {
+                InputStream in = postMethod.getResponseBodyAsStream();
+                if (in == null) {
+                    throw new AxisFault("Input Stream can not be Null");
+                }
+                msgContext.getOperationContext().setProperty(MessageContext.TRANSPORT_IN, in);
+                Header contentTypeHeader = postMethod
+                        .getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+                if (contentTypeHeader != null) {
+                    String contentType = contentTypeHeader.getValue();
+                    if (contentType != null
+                            && contentType
+                            .indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >= 0) {
+                        OperationContext opContext = msgContext
+                                .getOperationContext();
+                        if (opContext != null) {
+                            opContext.setProperty(HTTPConstants.MTOM_RECIVED_CONTENT_TYPE,
+                                                  contentType);
+                        }
+                    }
+                }
+
+            } else if (postMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
+                return;
+            } else {
+                throw new AxisFault("Error " + postMethod.getStatusCode()
+                                    + "  Error Message is "
+                                    + postMethod.getResponseBodyAsString());
+            }
+        } catch (MalformedURLException e) {
+            throw new AxisFault(e);
+        } catch (HttpException e) {
+            throw new AxisFault(e);
+        } catch (IOException e) {
+            throw new AxisFault(e);
+        }
+
+    }
+
+    protected HostConfiguration getHostConfiguration(MessageContext context,
+                                                     URL targetURL) {
+        //TODO cheaking wheather the host is a proxy
+        HostConfiguration config = new HostConfiguration();
+        config.setHost(targetURL.getHost(), targetURL.getPort() == -1 ? 80
+                                            : targetURL.getPort());
+        return config;
+    }
+
+    //get the contentLength...
+    public class AxisRequestEntity implements RequestEntity {
+        private OMElement element;
+
+        private boolean chuncked;
+
+        private byte[] bytes;
+
+        private boolean doingMTOM = false;
+
+        public AxisRequestEntity(OMElement element, boolean chuncked,
+                                 boolean doingMTOM) {
+            this.element = element;
+            this.chuncked = chuncked;
+            this.doingMTOM = doingMTOM;
+        }
+
+        public boolean isRepeatable() {
+            return false;
+        }
+
+        public byte[] writeBytes() throws AxisFault {
+            try {
+                ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
+                XMLStreamWriter outputWriter = XMLOutputFactory.newInstance()
+                        .createXMLStreamWriter(bytesOut);
+                OMOutput output = new OMOutput(outputWriter);
+                element.serialize(output);
+                outputWriter.flush();
+                return bytesOut.toByteArray();
+            } catch (XMLStreamException e) {
+                throw new AxisFault(e);
+            } catch (FactoryConfigurationError e) {
+                throw new AxisFault(e);
+            }
+        }
+
+        public void writeRequest(OutputStream out) throws IOException {
+            try {
+                if (chuncked || doingMTOM) {
+                    OMOutput output = new OMOutput(out, doingMTOM);
+                    element.serialize(output);
+                    if (doingMTOM)
+                        output.complete();
+                    output.flush();
+                    out.flush();
+                } else {
+                    if (bytes == null) {
+                        bytes = writeBytes();
+                    }
+                    out.write(bytes);
+                }
+            } catch (XMLStreamException e) {
+                throw new AxisFault(e);
+            } catch (FactoryConfigurationError e) {
+                throw new AxisFault(e);
+            } catch (IOException e) {
+                throw new AxisFault(e);
+            }
+        }
+
+        public long getContentLength() {
+            try {
+                if (chuncked) {
+                    return -1;
+                } else {
+                    if (bytes == null) {
+                        bytes = writeBytes();
+                    }
+                    return bytes.length;
+                }
+            } catch (AxisFault e) {
+                return -1;
+            }
+        }
+
+        public String getContentType() {
+            return "text/xml; charset=utf-8";
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.axis2.transport.TransportSender#cleanUp(org.apache.axis2.context.MessageContext)
+     */
+    public void cleanUp(MessageContext msgContext) throws AxisFault {
+        HttpMethod httpMethod = (HttpMethod) msgContext
+                .getProperty(HTTP_METHOD);
+        if (httpMethod != null) {
+            httpMethod.releaseConnection();
+        }
+
+    }
+
+    public void init(ConfigurationContext confContext,
+                     TransportOutDescription transportOut) throws AxisFault {
+        //<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.0</parameter> or
+        //<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.1</parameter> is
+        // checked
+        Parameter version = transportOut
+                .getParameter(HTTPConstants.PROTOCOL_VERSION);
+        if (version != null) {
+            if (HTTPConstants.HEADER_PROTOCOL_11.equals(version.getValue())) {
+                this.httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
+                Parameter transferEncoding = transportOut
+                        .getParameter(HTTPConstants.HEADER_TRANSFER_ENCODING);
+                if (transferEncoding != null
+                        && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED
+                        .equals(transferEncoding.getValue())) {
+                    this.chuncked = true;
+                }
+            } else if (HTTPConstants.HEADER_PROTOCOL_10.equals(version
+                                                               .getValue())) {
+                //TODO HTTP1.0 specific parameters
+            } else {
+                throw new AxisFault("Parameter "
+                                    + HTTPConstants.PROTOCOL_VERSION
+                                    + " Can have values only HTTP/1.0 or HTTP/1.1");
+            }
+        }
 
-	}
+    }
 
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java Mon Jul 11 08:49:30 2005
@@ -21,7 +21,7 @@
  * HTTP protocol and message context constants.
  */
 public class HTTPConstants {
- 
+
     public static final String PROTOCOL_VERSION = "PROTOCOL";
 
     /**
@@ -73,11 +73,11 @@
      * Field HEADER_POST
      */
     public static final String HEADER_POST = "POST";
-    
+
     /**
      * Field HEADER_GET
      */
-    public static final String HEADER_GET = "GET";    
+    public static final String HEADER_GET = "GET";
 
     /**
      * Field HEADER_HOST
@@ -349,67 +349,68 @@
             "transport.http.plugin.exceptionLog";
 
     /**
-         * Field OK[]
-         */
+     * Field OK[]
+     */
     public static final char OK[] = ("200 OK").toCharArray();
 
     /**
-         * Field NOCONTENT[]
-         */
+     * Field NOCONTENT[]
+     */
     public static final byte NOCONTENT[] = ("202 OK\n\n").getBytes();
 
     /**
-         * Field UNAUTH[]
-         */
+     * Field UNAUTH[]
+     */
     public static final byte UNAUTH[] = ("401 Unauthorized").getBytes();
 
     /**
-         * Field SENDER[]
-         */
+     * Field SENDER[]
+     */
     public static final byte SENDER[] = "400".getBytes();
 
     /**
-         * Field ISE[]
-         */
+     * Field ISE[]
+     */
     public static final byte ISE[] = ("500 Internal server error").getBytes();
 
     // HTTP prefix
 
     /**
-         * Field HTTP[]
-         */
+     * Field HTTP[]
+     */
     public static char HTTP[] = "HTTP/1.0 ".toCharArray();
-    
+
     /**
      * Field HTTP_REQ_TYPE
      */
     public static final String HTTP_REQ_TYPE = "HTTP_REQ_TYPE";
-    
+
     public static final String HTTPOutTransportInfo = "HTTPOutTransportInfo";
     public static final String MTOM_RECIVED_CONTENT_TYPE = "MTOM_RECEIVED";
 
-       /**
-        * Default content encoding chatset
-        */
-         public static final String HTTP_ELEMENT_CHARSET = "US-ASCII";
-
-    /**
-       * Method getBytes
-       * @param data
-       * @return
-       */
-       public static byte[] getBytes(final String data) {
-          if (data == null) {
-              throw new IllegalArgumentException("Parameter may not be null");
-          }
-
-          try {
-              return data.getBytes(HTTP_ELEMENT_CHARSET);
-          } catch (UnsupportedEncodingException e){
-
-          }
-              return data.getBytes();
-          }
+    /**
+     * Default content encoding chatset
+     */
+    public static final String HTTP_ELEMENT_CHARSET = "US-ASCII";
+
+    /**
+     * Method getBytes
+     *
+     * @param data
+     * @return
+     */
+    public static byte[] getBytes(final String data) {
+        if (data == null) {
+            throw new IllegalArgumentException("Parameter may not be null");
+        }
+
+        try {
+            return data.getBytes(HTTP_ELEMENT_CHARSET);
+        } catch (UnsupportedEncodingException e) {
+
+        }
+        return data.getBytes();
+    }
+
 
-    
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPOutTransportInfo.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPOutTransportInfo.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPOutTransportInfo.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPOutTransportInfo.java Mon Jul 11 08:49:30 2005
@@ -19,9 +19,9 @@
 
 /**
  * @author hemapani
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ *         <p/>
+ *         To change the template for this generated type comment go to
+ *         Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
  */
 public interface HTTPOutTransportInfo {
     public abstract void setContentType(String contentType);

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java Mon Jul 11 08:49:30 2005
@@ -155,7 +155,7 @@
      * @throws AxisFault
      */
     public HashMap parseTheHeaders(InputStream in, boolean serverSide)
-        throws AxisFault {
+            throws AxisFault {
         HashMap map = new HashMap();
         try {
             StringBuffer str = new StringBuffer();
@@ -166,19 +166,17 @@
             length = readLine(in, buf);
             if (serverSide) {
                 if ((buf[0] == 'P')
-                    && (buf[1] == 'O')
-                    && (buf[2] == 'S')
-                    && (buf[3] == 'T')) {
-                    map.put(
-                        HTTPConstants.HTTP_REQ_TYPE,
-                        HTTPConstants.HEADER_POST);
+                        && (buf[1] == 'O')
+                        && (buf[2] == 'S')
+                        && (buf[3] == 'T')) {
+                    map.put(HTTPConstants.HTTP_REQ_TYPE,
+                            HTTPConstants.HEADER_POST);
                     index = 5;
 
                 } else if (
-                    (buf[0] == 'G') && (buf[1] == 'E') && (buf[2] == 'T')) {
-                    map.put(
-                        HTTPConstants.HTTP_REQ_TYPE,
-                        HTTPConstants.HEADER_GET);
+                        (buf[0] == 'G') && (buf[1] == 'E') && (buf[2] == 'T')) {
+                    map.put(HTTPConstants.HTTP_REQ_TYPE,
+                            HTTPConstants.HEADER_GET);
                     index = 4;
 
                 } else {
@@ -211,7 +209,7 @@
                 }
                 for (int i = 0; i < length; i++) {
                     switch (state) {
-                        case BEFORE_SEPERATOR :
+                        case BEFORE_SEPERATOR:
                             if (buf[i] == ':') {
                                 key = str.toString();
                                 str = new StringBuffer();
@@ -223,7 +221,7 @@
                                 str.append((char) buf[i]);
                             }
                             break;
-                        case AFTER_SEPERATOR :
+                        case AFTER_SEPERATOR:
                             if (buf[i] == '\n') {
                                 value = str.toString();
                                 map.put(key, value);
@@ -246,8 +244,7 @@
                             // case END:
                             // break;
                         default :
-                            throw new AxisFault(
-                                "Error Occured Unknown state " + state);
+                            throw new AxisFault("Error Occured Unknown state " + state);
                     }
                 }
                 state = BEFORE_SEPERATOR;
@@ -384,17 +381,17 @@
     }
 
     /**
-         * Read a single line from the input stream
-         *
-         * @param is  inputstream to read from
-         * @param b   byte array to read into
-         * @param off starting offset into the byte array
-         * @param len maximum number of bytes to read
-         * @return
-         * @throws java.io.IOException
-         */
+     * Read a single line from the input stream
+     *
+     * @param is  inputstream to read from
+     * @param b   byte array to read into
+     * @param off starting offset into the byte array
+     * @param len maximum number of bytes to read
+     * @return
+     * @throws java.io.IOException
+     */
     protected int readLine(InputStream is, byte[] b)
-        throws java.io.IOException {
+            throws java.io.IOException {
         int count = 0, c;
 
         // System.out.println("inside here");
@@ -438,25 +435,25 @@
         }
     }
 
- 
 
     /**
      * Returns the HTML text for the list of services deployed
      * This can be delegated to another Class as well
      * where it will handle more options of GET messages :-?
+     *
      * @return
      */
     public static String getServicesHTML(ConfigurationContext configurationContext) {
         String temp = "";
         Map services =
-            configurationContext.getAxisConfiguration().getServices();
+                configurationContext.getAxisConfiguration().getServices();
         Hashtable erroneousServices =
-            configurationContext.getAxisConfiguration().getFaulytServices();
+                configurationContext.getAxisConfiguration().getFaulytServices();
         boolean status = false;
 
         if (services != null && !services.isEmpty()) {
             status = true;
-            Collection serviceCollection = services.values(); 
+            Collection serviceCollection = services.values();
             temp += "<h2>" + "Deployed services" + "</h2>";
             for (Iterator it = serviceCollection.iterator(); it.hasNext();) {
                 Map operations;
@@ -469,13 +466,13 @@
                 if (operationsList.size() > 0) {
                     temp += "Available operations <ul>";
                     for (Iterator iterator1 = operationsList.iterator();
-                        iterator1.hasNext();
-                        ) {
+                         iterator1.hasNext();
+                            ) {
                         OperationDescription axisOperation =
-                            (OperationDescription) iterator1.next();
+                                (OperationDescription) iterator1.next();
                         temp += "<li>"
-                            + axisOperation.getName().getLocalPart()
-                            + "</li>";
+                                + axisOperation.getName().getLocalPart()
+                                + "</li>";
                     }
                     temp += "</ul>";
                 } else {
@@ -491,10 +488,10 @@
             Enumeration faultyservices = erroneousServices.keys();
             while (faultyservices.hasMoreElements()) {
                 String faultyserviceName =
-                    (String) faultyservices.nextElement();
+                        (String) faultyservices.nextElement();
                 temp += "<h3><font color=\"blue\">"
-                    + faultyserviceName
-                    + "</font></h3>";
+                        + faultyserviceName
+                        + "</font></h3>";
             }
         }
 
@@ -503,7 +500,7 @@
         }
 
         temp =
-            "<html><head><title>Axis2: Services</title></head>"
+                "<html><head><title>Axis2: Services</title></head>"
                 + "<body>"
                 + temp
                 + "</body></html>";

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java Mon Jul 11 08:49:30 2005
@@ -43,53 +43,52 @@
     private String httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
     public static final String TRANSPORT_SENDER_INFO = "TRANSPORT_SENDER_INFO";
 
-    protected void writeTransportHeaders(
-        OutputStream out,
-        URL url,
-        MessageContext msgContext,
-        int contentLength)
-        throws AxisFault {
+    protected void writeTransportHeaders(OutputStream out,
+                                         URL url,
+                                         MessageContext msgContext,
+                                         int contentLength)
+            throws AxisFault {
         try {
-             
+
             String soapActionString = msgContext.getSoapAction();
-            if(soapActionString == null || soapActionString.length() == 0){
+            if (soapActionString == null || soapActionString.length() == 0) {
                 soapActionString = msgContext.getWSAAction();
             }
-            if(soapActionString == null){
+            if (soapActionString == null) {
                 soapActionString = "";
             }
-            
+
             boolean doMTOM = msgContext.isDoingMTOM();
             StringBuffer buf = new StringBuffer();
             buf.append(HTTPConstants.HEADER_POST).append(" ");
             buf.append(url.getFile()).append(" ").append(httpVersion).append("\n");
-            if(doMTOM){
+            if (doMTOM) {
                 buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ").append(OMOutput.getContentType(true)).append("\n");
-            }else{
+            } else {
                 String nsURI = msgContext.getEnvelope().getNamespace().getName();
-                           if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
-                               buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ").append(SOAP12Constants.SOAP_12_CONTENT_TYPE);
-                               buf.append("; charset=utf-8\n");
-                           } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
-                               buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": text/xml; charset=utf-8\n");
-                           }else {
-                               throw new AxisFault("Unknown SOAP Version. Current Axis handles only SOAP 1.1 and SOAP 1.2 messages");
-                           }
-                
+                if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
+                    buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ").append(SOAP12Constants.SOAP_12_CONTENT_TYPE);
+                    buf.append("; charset=utf-8\n");
+                } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
+                    buf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": text/xml; charset=utf-8\n");
+                } else {
+                    throw new AxisFault("Unknown SOAP Version. Current Axis handles only SOAP 1.1 and SOAP 1.2 messages");
+                }
+
             }
-            
+
             buf.append(HTTPConstants.HEADER_ACCEPT).append(": application/soap+xml, application/dime, multipart/related, text/*\n");
             buf.append(HTTPConstants.HEADER_HOST).append(": ").append(url.getHost()).append("\n");
             buf.append(HTTPConstants.HEADER_CACHE_CONTROL).append(": no-cache\n");
             buf.append(HTTPConstants.HEADER_PRAGMA).append(": no-cache\n");
             if (chuncked) {
                 buf
-                    .append(HTTPConstants.HEADER_TRANSFER_ENCODING)
-                    .append(": ")
-                    .append(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED)
-                    .append("\n");
-            } 
-            if(!chuncked && !msgContext.isDoingMTOM()) {
+                        .append(HTTPConstants.HEADER_TRANSFER_ENCODING)
+                        .append(": ")
+                        .append(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED)
+                        .append("\n");
+            }
+            if (!chuncked && !msgContext.isDoingMTOM()) {
                 buf.append(HTTPConstants.HEADER_CONTENT_LENGTH).append(": " + contentLength + "\n");
             }
             if (!msgContext.isDoingREST()) {
@@ -102,24 +101,22 @@
         }
     }
 
-    public void finalizeSendWithOutputStreamFromIncomingConnection(
-        MessageContext msgContext,
-        OutputStream out) {
+    public void finalizeSendWithOutputStreamFromIncomingConnection(MessageContext msgContext,
+                                                                   OutputStream out) {
     }
 
     private OutputStream openSocket(MessageContext msgContext)
-        throws AxisFault {
+            throws AxisFault {
         TransportSenderInfo transportInfo =
-            (TransportSenderInfo) msgContext.getProperty(TRANSPORT_SENDER_INFO);
+                (TransportSenderInfo) msgContext.getProperty(TRANSPORT_SENDER_INFO);
 
         EndpointReference toURL = msgContext.getTo();
         if (toURL != null) {
             try {
                 URL url = new URL(toURL.getAddress());
                 SocketAddress add =
-                    new InetSocketAddress(
-                        url.getHost(),
-                        url.getPort() == -1 ? 80 : url.getPort());
+                        new InetSocketAddress(url.getHost(),
+                                              url.getPort() == -1 ? 80 : url.getPort());
                 Socket socket = new Socket();
                 socket.connect(add);
                 transportInfo.url = url;
@@ -137,33 +134,30 @@
         }
     }
 
-    public void finalizeSendWithToAddress(
-        MessageContext msgContext,
-        OutputStream out)
-        throws AxisFault {
+    public void finalizeSendWithToAddress(MessageContext msgContext,
+                                          OutputStream out)
+            throws AxisFault {
         try {
             TransportSenderInfo transportInfo =
-                (TransportSenderInfo) msgContext.getProperty(
-                    TRANSPORT_SENDER_INFO);
+                    (TransportSenderInfo) msgContext.getProperty(TRANSPORT_SENDER_INFO);
             InputStream in = null;
-            if(chuncked || msgContext.isDoingMTOM()){
+            if (chuncked || msgContext.isDoingMTOM()) {
                 if (chuncked) {
                     ((ChunkedOutputStream) out).eos();
                     in = new ChunkedInputStream(transportInfo.in);
-                } 
+                }
                 in = transportInfo.in;
-            }else{                
+            } else {
                 openSocket(msgContext);
                 OutputStream outS = transportInfo.out;
                 in = transportInfo.in;
                 byte[] bytes = transportInfo.outputStream.toByteArray();
 
                 //write header to the out put stream
-                writeTransportHeaders(
-                    outS,
-                    transportInfo.url,
-                    msgContext,
-                    bytes.length);
+                writeTransportHeaders(outS,
+                                      transportInfo.url,
+                                      msgContext,
+                                      bytes.length);
                 outS.flush();
                 //write the content to the real output stream
                 outS.write(bytes);
@@ -173,72 +167,67 @@
             HTTPTransportReceiver tr = new HTTPTransportReceiver();
             Map map = tr.parseTheHeaders(transportInfo.in, false);
             if (!HTTPConstants
-                .RESPONSE_ACK_CODE_VAL
-                .equals(map.get(HTTPConstants.RESPONSE_CODE))) {
+                    .RESPONSE_ACK_CODE_VAL
+                    .equals(map.get(HTTPConstants.RESPONSE_CODE))) {
                 String transferEncoding =
-                    (String) map.get(HTTPConstants.HEADER_TRANSFER_ENCODING);
+                        (String) map.get(HTTPConstants.HEADER_TRANSFER_ENCODING);
                 if (transferEncoding != null
-                    && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(
-                        transferEncoding)) {
+                        && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(transferEncoding)) {
                     in = new ChunkedInputStream(transportInfo.in);
                 }
                 msgContext.setProperty(MessageContext.TRANSPORT_IN, in);
-                
-                String contentType = (String)map.get(HTTPConstants.HEADER_CONTENT_TYPE);
-                if (contentType != null && contentType.indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >= 0){
+
+                String contentType = (String) map.get(HTTPConstants.HEADER_CONTENT_TYPE);
+                if (contentType != null && contentType.indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >= 0) {
                     OperationContext opContext = msgContext.getOperationContext();
-                    if(opContext != null){
-                        opContext.setProperty(HTTPConstants.MTOM_RECIVED_CONTENT_TYPE,contentType);
+                    if (opContext != null) {
+                        opContext.setProperty(HTTPConstants.MTOM_RECIVED_CONTENT_TYPE, contentType);
                     }
                 }
             }
-        }catch (IOException e) {
+        } catch (IOException e) {
             throw new AxisFault(e);
         }
 
     }
 
-    protected OutputStream openTheConnection(
-        EndpointReference epr,
-        MessageContext msgctx)
-        throws AxisFault {
+    protected OutputStream openTheConnection(EndpointReference epr,
+                                             MessageContext msgctx)
+            throws AxisFault {
         msgctx.setProperty(TRANSPORT_SENDER_INFO, new TransportSenderInfo());
-        
-        if(msgctx.isDoingMTOM() || chuncked){
+
+        if (msgctx.isDoingMTOM() || chuncked) {
             return openSocket(msgctx);
         } else {
             TransportSenderInfo transportInfo =
-                (TransportSenderInfo) msgctx.getProperty(TRANSPORT_SENDER_INFO);
+                    (TransportSenderInfo) msgctx.getProperty(TRANSPORT_SENDER_INFO);
             transportInfo.outputStream = new ByteArrayOutputStream();
             return transportInfo.outputStream;
         }
     }
 
-    public OutputStream startSendWithOutputStreamFromIncomingConnection(
-        MessageContext msgContext,
-        OutputStream out)
-        throws AxisFault {
-        if(msgContext.isDoingMTOM()){
-            HTTPOutTransportInfo httpOutTransportInfo = (HTTPOutTransportInfo)msgContext.getProperty(HTTPConstants.HTTPOutTransportInfo);
-            if(httpOutTransportInfo != null){
+    public OutputStream startSendWithOutputStreamFromIncomingConnection(MessageContext msgContext,
+                                                                        OutputStream out)
+            throws AxisFault {
+        if (msgContext.isDoingMTOM()) {
+            HTTPOutTransportInfo httpOutTransportInfo = (HTTPOutTransportInfo) msgContext.getProperty(HTTPConstants.HTTPOutTransportInfo);
+            if (httpOutTransportInfo != null) {
                 httpOutTransportInfo.setContentType(OMOutput.getContentType(true));
-            }else{
-                throw new AxisFault("Property "+ HTTPConstants.HTTPOutTransportInfo + " not set by the Server");
+            } else {
+                throw new AxisFault("Property " + HTTPConstants.HTTPOutTransportInfo + " not set by the Server");
             }
-            
+
         }
         return out;
     }
 
-    public OutputStream startSendWithToAddress(
-        MessageContext msgContext,
-        OutputStream out)
-        throws AxisFault {
+    public OutputStream startSendWithToAddress(MessageContext msgContext,
+                                               OutputStream out)
+            throws AxisFault {
         try {
-            if(msgContext.isDoingMTOM() || chuncked){
+            if (msgContext.isDoingMTOM() || chuncked) {
                 TransportSenderInfo transportInfo =
-                    (TransportSenderInfo) msgContext.getProperty(
-                        TRANSPORT_SENDER_INFO);
+                        (TransportSenderInfo) msgContext.getProperty(TRANSPORT_SENDER_INFO);
                 writeTransportHeaders(out, transportInfo.url, msgContext, -1);
                 out.flush();
                 if (chuncked) {
@@ -246,7 +235,7 @@
                 } else {
                     return out;
                 }
-            }else {
+            } else {
                 return out;
             }
         } catch (IOException e) {
@@ -260,7 +249,7 @@
      */
     public void cleanUp(MessageContext msgContext) throws AxisFault {
         TransportSenderInfo transportInfo =
-            (TransportSenderInfo) msgContext.getProperty(TRANSPORT_SENDER_INFO);
+                (TransportSenderInfo) msgContext.getProperty(TRANSPORT_SENDER_INFO);
         try {
             if (transportInfo.socket != null) {
                 transportInfo.socket.close();
@@ -274,33 +263,29 @@
     /* (non-Javadoc)
      * @see org.apache.axis2.transport.TransportSender#init(org.apache.axis2.context.ConfigurationContext, org.apache.axis2.description.TransportOutDescription)
      */
-    public void init(
-        ConfigurationContext confContext,
-        TransportOutDescription transportOut)
-        throws AxisFault {
+    public void init(ConfigurationContext confContext,
+                     TransportOutDescription transportOut)
+            throws AxisFault {
         //<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.0</parameter> or 
         //<parameter name="PROTOCOL" locked="xsd:false">HTTP/1.1</parameter> is checked
         Parameter version =
-            transportOut.getParameter(HTTPConstants.PROTOCOL_VERSION);
+                transportOut.getParameter(HTTPConstants.PROTOCOL_VERSION);
         if (version != null) {
             if (HTTPConstants.HEADER_PROTOCOL_11.equals(version.getValue())) {
                 this.httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
                 Parameter transferEncoding =
-                    transportOut.getParameter(
-                        HTTPConstants.HEADER_TRANSFER_ENCODING);
+                        transportOut.getParameter(HTTPConstants.HEADER_TRANSFER_ENCODING);
                 if (transferEncoding != null
-                    && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(
-                        transferEncoding.getValue())) {
+                        && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(transferEncoding.getValue())) {
                     this.chuncked = true;
                 }
             } else if (
-                HTTPConstants.HEADER_PROTOCOL_10.equals(version.getValue())) {
+                    HTTPConstants.HEADER_PROTOCOL_10.equals(version.getValue())) {
                 //TODO HTTP1.0 specific parameters
             } else {
-                throw new AxisFault(
-                    "Parameter "
-                        + HTTPConstants.PROTOCOL_VERSION
-                        + " Can have values only HTTP/1.0 or HTTP/1.1");
+                throw new AxisFault("Parameter "
+                                    + HTTPConstants.PROTOCOL_VERSION
+                                    + " Can have values only HTTP/1.0 or HTTP/1.1");
             }
         }
 

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java Mon Jul 11 08:49:30 2005
@@ -48,192 +48,188 @@
 
 public class HTTPTransportUtils {
 
-	public static void processHTTPPostRequest(MessageContext msgContext,
-			InputStream in, OutputStream out, String contentType,
-			String soapAction, String requestURI,
-			ConfigurationContext configurationContext) throws AxisFault {
-		try {
-            if(soapAction != null && soapAction.startsWith("\"") && soapAction.endsWith("\"")){
-                soapAction = soapAction.substring(1,soapAction.length() -1);
-            }                
-			msgContext.setWSAAction(soapAction);
-			msgContext.setSoapAction(soapAction);
-			msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO,
-					requestURI));
-			msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
-			msgContext.setServerSide(true);
-
-			SOAPEnvelope envelope = null;
-			StAXBuilder builder = null;
-
-
-			if (contentType.indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >= 0){
-				builder = selectBuilderForMIME(msgContext, in, contentType);
-				envelope = (SOAPEnvelope) builder.getDocumentElement();
-			} else if (contentType != null
-					&& contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) {
-                 //If the content Type is text/xml (BTW which is the SOAP 1.1 Content type ) and
-                 //the SOAP Action is absent it is rest !!    
-                Object enable =  msgContext.getProperty(Constants.Configuration.ENABLE_REST);
-				if ((soapAction == null || soapAction.length() == 0)
-						&& Constants.VALUE_TRUE.equals(enable)) {
-					msgContext.setDoingREST(true);
-					SOAPFactory soapFactory = new SOAP11Factory();
+    public static void processHTTPPostRequest(MessageContext msgContext,
+                                              InputStream in, OutputStream out, String contentType,
+                                              String soapAction, String requestURI,
+                                              ConfigurationContext configurationContext) throws AxisFault {
+        try {
+            if (soapAction != null && soapAction.startsWith("\"") && soapAction.endsWith("\"")) {
+                soapAction = soapAction.substring(1, soapAction.length() - 1);
+            }
+            msgContext.setWSAAction(soapAction);
+            msgContext.setSoapAction(soapAction);
+            msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO,
+                                                   requestURI));
+            msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
+            msgContext.setServerSide(true);
+
+            SOAPEnvelope envelope = null;
+            StAXBuilder builder = null;
+
+
+            if (contentType.indexOf(HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED) >= 0) {
+                builder = selectBuilderForMIME(msgContext, in, contentType);
+                envelope = (SOAPEnvelope) builder.getDocumentElement();
+            } else if (contentType != null
+                    && contentType.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) {
+//If the content Type is text/xml (BTW which is the SOAP 1.1 Content type ) and
+//the SOAP Action is absent it is rest !!
+                Object enable = msgContext.getProperty(Constants.Configuration.ENABLE_REST);
+                if ((soapAction == null || soapAction.length() == 0)
+                        && Constants.VALUE_TRUE.equals(enable)) {
+                    msgContext.setDoingREST(true);
+                    SOAPFactory soapFactory = new SOAP11Factory();
                     Reader reader = new InputStreamReader(in);
                     XMLStreamReader xmlreader = XMLInputFactory.newInstance()
                             .createXMLStreamReader(reader);
-					builder = new StAXOMBuilder(xmlreader);
-					builder.setOmbuilderFactory(soapFactory);
-					envelope = soapFactory.getDefaultEnvelope();
-					envelope.getBody().addChild(builder.getDocumentElement());
-				}
-			}
+                    builder = new StAXOMBuilder(xmlreader);
+                    builder.setOmbuilderFactory(soapFactory);
+                    envelope = soapFactory.getDefaultEnvelope();
+                    envelope.getBody().addChild(builder.getDocumentElement());
+                }
+            }
 
-			if (envelope == null) {
+            if (envelope == null) {
                 Reader reader = new InputStreamReader(in);
                 XMLStreamReader xmlreader = XMLInputFactory.newInstance()
                         .createXMLStreamReader(reader);
-				builder = new StAXSOAPModelBuilder(xmlreader);
-				envelope = (SOAPEnvelope) builder.getDocumentElement();
-			}
-
-			msgContext.setEnvelope(envelope);
-			AxisEngine engine = new AxisEngine(configurationContext);
-			engine.receive(msgContext);
-		} catch (SOAPProcessingException e) {
-			throw new AxisFault(e);
-		} catch (OMException e) {
-			throw new AxisFault(e);
-		} catch (XMLStreamException e) {
-			throw new AxisFault(e);
-		}
-	}
-
-	public static boolean processHTTPGetRequest(MessageContext msgContext,
-			InputStream in, OutputStream out, String contentType,
-			String soapAction, String requestURI,
-			ConfigurationContext configurationContext, Map requestParameters)
-			throws AxisFault {
-        if(soapAction != null && soapAction.startsWith("\"") && soapAction.endsWith("\"")){
-            soapAction = soapAction.substring(1,soapAction.length() -1);
-        }                
-		msgContext.setWSAAction(soapAction);
-		msgContext.setSoapAction(soapAction);
-		msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO,
-				requestURI));
-		msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
-		msgContext.setServerSide(true);
-		try {
-			SOAPEnvelope envelope = HTTPTransportUtils
-					.createEnvelopeFromGetRequest(requestURI, requestParameters);
-			if (envelope == null) {
-				return false;
-			} else {
-				msgContext.setDoingREST(true);
-				msgContext.setEnvelope(envelope);
-				AxisEngine engine = new AxisEngine(configurationContext);
-				engine.receive(msgContext);
-				return true;
-			}
-		} catch (IOException e) {
-			throw new AxisFault(e);
-		}
-	}
-
-	public static final SOAPEnvelope createEnvelopeFromGetRequest(
-			String requestUrl, Map map) {
-		String[] values = Utils
-				.parseRequestURLForServiceAndOperation(requestUrl);
-
-		if (values[1] != null && values[0] != null) {
-			String operation = values[1];
-			SOAPFactory soapFactory = new SOAP11Factory();
-			SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
-
-			OMNamespace omNs = soapFactory.createOMNamespace(values[0],
-					"services");
-			OMNamespace defualtNs = new OMNamespaceImpl("", null);
-
-			OMElement opElement = soapFactory.createOMElement(operation, omNs);
-
-			Iterator it = map.keySet().iterator();
-			while (it.hasNext()) {
-				String name = (String) it.next();
-				String value = (String) map.get(name);
-				OMElement omEle = soapFactory.createOMElement(name, defualtNs);
-				omEle.setText(value);
-				opElement.addChild(omEle);
-			}
-
-			envelope.getBody().addChild(opElement);
-			return envelope;
-		} else {
-			return null;
-		}
-	}
-
-	public static StAXBuilder selectBuilderForMIME(MessageContext msgContext,
-			InputStream inStream, String contentTypeString) throws OMException,
-			XMLStreamException, FactoryConfigurationError {
-		StAXBuilder builder = null;
-
-		boolean fileCacheForAttachments = (Constants.VALUE_TRUE.equals(msgContext.getProperty(Constants.Configuration.CACHE_ATTACHMENTS)));
-		String attachmentRepoDir=null;
-		if (fileCacheForAttachments)
-		{
-			attachmentRepoDir = (String)msgContext.getProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR);
-		}
-			
-		MIMEHelper mimeHelper = new MIMEHelper(inStream, contentTypeString,fileCacheForAttachments,attachmentRepoDir);
-		XMLStreamReader reader = XMLInputFactory.newInstance()
-				.createXMLStreamReader(
-						new BufferedReader(new InputStreamReader(mimeHelper
-								.getSOAPPartInputStream())));
-		/*
-		 * put a reference to Attachments in to the message context
-		 */
-		msgContext.setProperty("Attachments", mimeHelper);
-		if (mimeHelper.getAttachmentSpecType().equals(MIMEHelper.MTOM_TYPE)) {
-			/*
-			 * Creates the MTOM specific MTOMStAXSOAPModelBuilder
-			 */
-			builder = new MTOMStAXSOAPModelBuilder(reader, mimeHelper);
-		} else if (mimeHelper.getAttachmentSpecType().equals(
-				MIMEHelper.SWA_TYPE)) {
-			builder = new StAXSOAPModelBuilder(reader);
-		}
-		return builder;
-	}
-
-	public static boolean checkEnvelopeForOptimise(SOAPEnvelope envelope) {
-		return isOptimised(envelope);
-	}
+                builder = new StAXSOAPModelBuilder(xmlreader);
+                envelope = (SOAPEnvelope) builder.getDocumentElement();
+            }
+
+            msgContext.setEnvelope(envelope);
+            AxisEngine engine = new AxisEngine(configurationContext);
+            engine.receive(msgContext);
+        } catch (SOAPProcessingException e) {
+            throw new AxisFault(e);
+        } catch (OMException e) {
+            throw new AxisFault(e);
+        } catch (XMLStreamException e) {
+            throw new AxisFault(e);
+        }
+    }
+
+    public static boolean processHTTPGetRequest(MessageContext msgContext,
+                                                InputStream in, OutputStream out, String contentType,
+                                                String soapAction, String requestURI,
+                                                ConfigurationContext configurationContext, Map requestParameters)
+            throws AxisFault {
+        if (soapAction != null && soapAction.startsWith("\"") && soapAction.endsWith("\"")) {
+            soapAction = soapAction.substring(1, soapAction.length() - 1);
+        }
+        msgContext.setWSAAction(soapAction);
+        msgContext.setSoapAction(soapAction);
+        msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO,
+                                               requestURI));
+        msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
+        msgContext.setServerSide(true);
+        try {
+            SOAPEnvelope envelope = HTTPTransportUtils
+                    .createEnvelopeFromGetRequest(requestURI, requestParameters);
+            if (envelope == null) {
+                return false;
+            } else {
+                msgContext.setDoingREST(true);
+                msgContext.setEnvelope(envelope);
+                AxisEngine engine = new AxisEngine(configurationContext);
+                engine.receive(msgContext);
+                return true;
+            }
+        } catch (IOException e) {
+            throw new AxisFault(e);
+        }
+    }
+
+    public static final SOAPEnvelope createEnvelopeFromGetRequest(String requestUrl, Map map) {
+        String[] values = Utils
+                .parseRequestURLForServiceAndOperation(requestUrl);
+
+        if (values[1] != null && values[0] != null) {
+            String operation = values[1];
+            SOAPFactory soapFactory = new SOAP11Factory();
+            SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
+
+            OMNamespace omNs = soapFactory.createOMNamespace(values[0],
+                                                             "services");
+            OMNamespace defualtNs = new OMNamespaceImpl("", null);
+
+            OMElement opElement = soapFactory.createOMElement(operation, omNs);
+
+            Iterator it = map.keySet().iterator();
+            while (it.hasNext()) {
+                String name = (String) it.next();
+                String value = (String) map.get(name);
+                OMElement omEle = soapFactory.createOMElement(name, defualtNs);
+                omEle.setText(value);
+                opElement.addChild(omEle);
+            }
+
+            envelope.getBody().addChild(opElement);
+            return envelope;
+        } else {
+            return null;
+        }
+    }
+
+    public static StAXBuilder selectBuilderForMIME(MessageContext msgContext,
+                                                   InputStream inStream, String contentTypeString) throws OMException,
+            XMLStreamException, FactoryConfigurationError {
+        StAXBuilder builder = null;
+
+        boolean fileCacheForAttachments = (Constants.VALUE_TRUE.equals(msgContext.getProperty(Constants.Configuration.CACHE_ATTACHMENTS)));
+        String attachmentRepoDir = null;
+        if (fileCacheForAttachments) {
+            attachmentRepoDir = (String) msgContext.getProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR);
+        }
+
+        MIMEHelper mimeHelper = new MIMEHelper(inStream, contentTypeString, fileCacheForAttachments, attachmentRepoDir);
+        XMLStreamReader reader = XMLInputFactory.newInstance()
+                .createXMLStreamReader(new BufferedReader(new InputStreamReader(mimeHelper
+                                                                                .getSOAPPartInputStream())));
+        /*
+         * put a reference to Attachments in to the message context
+         */
+        msgContext.setProperty("Attachments", mimeHelper);
+        if (mimeHelper.getAttachmentSpecType().equals(MIMEHelper.MTOM_TYPE)) {
+            /*
+             * Creates the MTOM specific MTOMStAXSOAPModelBuilder
+             */
+            builder = new MTOMStAXSOAPModelBuilder(reader, mimeHelper);
+        } else if (mimeHelper.getAttachmentSpecType().equals(MIMEHelper.SWA_TYPE)) {
+            builder = new StAXSOAPModelBuilder(reader);
+        }
+        return builder;
+    }
+
+    public static boolean checkEnvelopeForOptimise(SOAPEnvelope envelope) {
+        return isOptimised(envelope);
+    }
 
-	private static boolean isOptimised(OMElement element) {
-		Iterator childrenIter = element.getChildren();
+    private static boolean isOptimised(OMElement element) {
+        Iterator childrenIter = element.getChildren();
         boolean isOptimized = false;
-		while (childrenIter.hasNext()&& !isOptimized) {
-			OMNode node = (OMNode) childrenIter.next();
-			if (OMNode.TEXT_NODE == node.getType()
-					&& ((OMText) node).isOptimized()) {
-                        isOptimized =  true;
-			} else if (OMNode.ELEMENT_NODE == node.getType()) {
+        while (childrenIter.hasNext() && !isOptimized) {
+            OMNode node = (OMNode) childrenIter.next();
+            if (OMNode.TEXT_NODE == node.getType()
+                    && ((OMText) node).isOptimized()) {
+                isOptimized = true;
+            } else if (OMNode.ELEMENT_NODE == node.getType()) {
                 isOptimized = isOptimised((OMElement) node);
-			}
-		}
-		return isOptimized;
-	}
-
-	public static boolean doWriteMTOM(MessageContext msgContext) {
-		boolean enableMTOM = false;
-		if (msgContext.getProperty(Constants.Configuration.ENABLE_MTOM) != null) {
-			enableMTOM = Constants.VALUE_TRUE.equals(msgContext
-					.getProperty(Constants.Configuration.ENABLE_MTOM));
-		}
-		boolean envelopeContainsOptimise = HTTPTransportUtils
-				.checkEnvelopeForOptimise(msgContext.getEnvelope());
-		boolean doMTOM = enableMTOM && envelopeContainsOptimise;
-		msgContext.setDoingMTOM(doMTOM);
-		return doMTOM;
-	}
+            }
+        }
+        return isOptimized;
+    }
+
+    public static boolean doWriteMTOM(MessageContext msgContext) {
+        boolean enableMTOM = false;
+        if (msgContext.getProperty(Constants.Configuration.ENABLE_MTOM) != null) {
+            enableMTOM = Constants.VALUE_TRUE.equals(msgContext
+                                                     .getProperty(Constants.Configuration.ENABLE_MTOM));
+        }
+        boolean envelopeContainsOptimise = HTTPTransportUtils
+                .checkEnvelopeForOptimise(msgContext.getEnvelope());
+        boolean doMTOM = enableMTOM && envelopeContainsOptimise;
+        msgContext.setDoingMTOM(doMTOM);
+        return doMTOM;
+    }
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java?rev=210150&r1=210149&r2=210150&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java Mon Jul 11 08:49:30 2005
@@ -55,14 +55,11 @@
                 InputStream inStream = socket.getInputStream();
 
                 TransportOutDescription transportOut =
-                    configurationContext.getAxisConfiguration().getTransportOut(
-                        new QName(Constants.TRANSPORT_HTTP));
+                        configurationContext.getAxisConfiguration().getTransportOut(new QName(Constants.TRANSPORT_HTTP));
                 msgContext =
-                    new MessageContext(
-                        configurationContext,
-                        configurationContext.getAxisConfiguration().getTransportIn(
-                            new QName(Constants.TRANSPORT_HTTP)),
-                        transportOut);
+                        new MessageContext(configurationContext,
+                                           configurationContext.getAxisConfiguration().getTransportIn(new QName(Constants.TRANSPORT_HTTP)),
+                                           transportOut);
                 msgContext.setServerSide(true);
 
                 //parse the Transport Headers
@@ -73,7 +70,7 @@
 
                 String transferEncoding = (String) map.get(HTTPConstants.HEADER_TRANSFER_ENCODING);
                 if (transferEncoding != null
-                    && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(transferEncoding)) {
+                        && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(transferEncoding)) {
                     inStream = new ChunkedInputStream(inStream);
                     out = new SimpleHTTPOutputStream(socket.getOutputStream(), true);
                 } else {
@@ -82,39 +79,34 @@
                 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));
+                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,
-                            inStream,
-                            out,
-                            (String) map.get(HTTPConstants.HEADER_CONTENT_TYPE),
-                            (String) map.get(HTTPConstants.HEADER_SOAP_ACTION),
-                            (String) map.get(HTTPConstants.REQUEST_URI),
-                            configurationContext,
-                            HTTPTransportReceiver.getGetRequestParameters(
-                                (String) map.get(HTTPConstants.REQUEST_URI)));
+                            HTTPTransportUtils.processHTTPGetRequest(msgContext,
+                                                                     inStream,
+                                                                     out,
+                                                                     (String) map.get(HTTPConstants.HEADER_CONTENT_TYPE),
+                                                                     (String) map.get(HTTPConstants.HEADER_SOAP_ACTION),
+                                                                     (String) map.get(HTTPConstants.REQUEST_URI),
+                                                                     configurationContext,
+                                                                     HTTPTransportReceiver.getGetRequestParameters((String) map.get(HTTPConstants.REQUEST_URI)));
 
                     if (!processed) {
-                        out.write(
-                            HTTPTransportReceiver.getServicesHTML(configurationContext).getBytes());
+                        out.write(HTTPTransportReceiver.getServicesHTML(configurationContext).getBytes());
                         out.flush();
                     }
                 } else {
                     //It is POST, handle it
-                    HTTPTransportUtils.processHTTPPostRequest(
-                        msgContext,
-                        inStream,
-                        out,
-                        (String) map.get(HTTPConstants.HEADER_CONTENT_TYPE),
-                        (String) map.get(HTTPConstants.HEADER_SOAP_ACTION),
-                        (String) map.get(HTTPConstants.REQUEST_URI),
-                        configurationContext);
+                    HTTPTransportUtils.processHTTPPostRequest(msgContext,
+                                                              inStream,
+                                                              out,
+                                                              (String) map.get(HTTPConstants.HEADER_CONTENT_TYPE),
+                                                              (String) map.get(HTTPConstants.HEADER_SOAP_ACTION),
+                                                              (String) map.get(HTTPConstants.REQUEST_URI),
+                                                              configurationContext);
                 }
 
                 out.finalize();



Mime
View raw message