axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r289289 [23/134] - in /webservices/axis2/trunk/java: ./ etc/ modules/addressing/ modules/addressing/src/META-INF/ modules/addressing/src/org/apache/axis2/handlers/addressing/ modules/addressing/test-resources/ modules/addressing/test/org/ap...
Date Thu, 15 Sep 2005 19:07:03 GMT
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedInputStream.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedInputStream.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedInputStream.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedInputStream.java Thu Sep 15 11:52:11 2005
@@ -1,188 +1,188 @@
-/*
- * Copyright 2001-2004 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.
- */
-package org.apache.axis2.transport.http;
-
-
-import java.io.IOException;
-import java.io.InputStream;
-
-
-/**
- * @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)).length();
-
-    private ChunkedInputStream() {
-        super(null);
-    }
-
-    public ChunkedInputStream(InputStream is) {
-        super(is);
-    }
-
-    public int read()
-            throws IOException {
-        byte[] d = new byte[1];
-        int rc = read(d, 0, 1);
-
-        return rc > 0 ? (d[0] & 0xFF) : rc;
-    }
-
-    public int read(byte[] b)
-            throws IOException {
-        return read(b, 0, b.length);
-    }
-
-    public synchronized int read(byte[] b,
-                                 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;
-
-        try {
-            do {
-                if (chunkSize < 1L) {
-                    if (0l == getChunked()) {
-                        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)));
-                if (bytesread > 0) {
-                    totalread += bytesread;
-                    chunkSize -= bytesread;
-                }
-            } while (len - totalread > 0 && bytesread > -1);
-        } catch (IOException e) {
-            closed = true;
-            throw e;
-        }
-        return totalread;
-    }
-
-    public long skip(final long n)
-            throws IOException {
-        if (closed) return 0;
-        long skipped = 0l;
-        byte[] b = new byte[1024];
-        int bread = -1;
-
-        do {
-            bread = read(b, 0, b.length);
-            if (bread > 0) skipped += bread;
-        } while (bread != -1 && skipped < n);
-        return skipped;
-    }
-
-    public int available()
-            throws IOException {
-        if (closed) return 0;
-        int rc = (int) Math.min(chunkSize, Integer.MAX_VALUE);
-
-        return Math.min(rc, in.available());
-    }
-
-    protected long getChunked() throws IOException {
-        //StringBuffer buf= new StringBuffer(1024);
-        byte[] buf = new byte[maxCharLong + 2];
-        int bufsz = 0;
-
-        chunkSize = -1L;
-        int c = -1;
-
-        do {
-            c = in.read();
-            if (c > -1) {
-                if (c != '\r' && c != '\n' && c != ' ' && c != '\t') {
-                    buf[bufsz++] = ((byte) c);
-                }
-            }
-        } while (c > -1 && (c != '\n' || bufsz == 0) && bufsz < buf.length);
-        if (c < 0) {
-            closed = true;
-        }
-        String sbuf = new String(buf, 0, bufsz);
-
-        if (bufsz > maxCharLong) {
-            closed = true;
-            throw new IOException(
-                    "Chunked input stream failed to receive valid chunk size:" +
-                    sbuf);
-        }
-        try {
-            chunkSize = Long.parseLong(sbuf, 16);
-        } catch (NumberFormatException ne) {
-            closed = true;
-            throw new IOException("'" + sbuf + "' " + ne.getMessage());
-        }
-        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;
-    }
-
-    public void close() throws IOException {
-
-        synchronized (this) {
-            if (closed) return;
-            closed = true;
-        }
-
-        byte[] b = new byte[1024];
-        int bread = -1;
-
-        do {
-            bread = read(b, 0, b.length);
-        } while (bread != -1);
-    }
-
-    /*
-     public void mark(int readlimit)
-     {
-     
-     }
-     */
-
-    public void reset()
-            throws IOException {
-        throw new IOException("Don't support marked streams");
-    }
-
-    public boolean markSupported() {
-        return false;
-    }
-
-}
+/*
+ * Copyright 2001-2004 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.
+ */
+package org.apache.axis2.transport.http;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+
+
+/**
+ * @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)).length();
+
+    private ChunkedInputStream() {
+        super(null);
+    }
+
+    public ChunkedInputStream(InputStream is) {
+        super(is);
+    }
+
+    public int read()
+            throws IOException {
+        byte[] d = new byte[1];
+        int rc = read(d, 0, 1);
+
+        return rc > 0 ? (d[0] & 0xFF) : rc;
+    }
+
+    public int read(byte[] b)
+            throws IOException {
+        return read(b, 0, b.length);
+    }
+
+    public synchronized int read(byte[] b,
+                                 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;
+
+        try {
+            do {
+                if (chunkSize < 1L) {
+                    if (0l == getChunked()) {
+                        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)));
+                if (bytesread > 0) {
+                    totalread += bytesread;
+                    chunkSize -= bytesread;
+                }
+            } while (len - totalread > 0 && bytesread > -1);
+        } catch (IOException e) {
+            closed = true;
+            throw e;
+        }
+        return totalread;
+    }
+
+    public long skip(final long n)
+            throws IOException {
+        if (closed) return 0;
+        long skipped = 0l;
+        byte[] b = new byte[1024];
+        int bread = -1;
+
+        do {
+            bread = read(b, 0, b.length);
+            if (bread > 0) skipped += bread;
+        } while (bread != -1 && skipped < n);
+        return skipped;
+    }
+
+    public int available()
+            throws IOException {
+        if (closed) return 0;
+        int rc = (int) Math.min(chunkSize, Integer.MAX_VALUE);
+
+        return Math.min(rc, in.available());
+    }
+
+    protected long getChunked() throws IOException {
+        //StringBuffer buf= new StringBuffer(1024);
+        byte[] buf = new byte[maxCharLong + 2];
+        int bufsz = 0;
+
+        chunkSize = -1L;
+        int c = -1;
+
+        do {
+            c = in.read();
+            if (c > -1) {
+                if (c != '\r' && c != '\n' && c != ' ' && c != '\t') {
+                    buf[bufsz++] = ((byte) c);
+                }
+            }
+        } while (c > -1 && (c != '\n' || bufsz == 0) && bufsz < buf.length);
+        if (c < 0) {
+            closed = true;
+        }
+        String sbuf = new String(buf, 0, bufsz);
+
+        if (bufsz > maxCharLong) {
+            closed = true;
+            throw new IOException(
+                    "Chunked input stream failed to receive valid chunk size:" +
+                    sbuf);
+        }
+        try {
+            chunkSize = Long.parseLong(sbuf, 16);
+        } catch (NumberFormatException ne) {
+            closed = true;
+            throw new IOException("'" + sbuf + "' " + ne.getMessage());
+        }
+        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;
+    }
+
+    public void close() throws IOException {
+
+        synchronized (this) {
+            if (closed) return;
+            closed = true;
+        }
+
+        byte[] b = new byte[1024];
+        int bread = -1;
+
+        do {
+            bread = read(b, 0, b.length);
+        } while (bread != -1);
+    }
+
+    /*
+     public void mark(int readlimit)
+     {
+     
+     }
+     */
+
+    public void reset()
+            throws IOException {
+        throw new IOException("Don't support marked streams");
+    }
+
+    public boolean markSupported() {
+        return false;
+    }
+
+}

Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedInputStream.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedOutputStream.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedOutputStream.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedOutputStream.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedOutputStream.java Thu Sep 15 11:52:11 2005
@@ -1,86 +1,86 @@
-/*
- * Copyright 2001-2004 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.
- */
-package org.apache.axis2.transport.http;
-
-
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-
-/**
- * @author Rick Rineholt
- */
-public class ChunkedOutputStream extends FilterOutputStream {
-
-    boolean eos = false;
-
-    private ChunkedOutputStream() {
-        super(null);
-    }
-
-    public ChunkedOutputStream(OutputStream os) {
-        super(os);
-    }
-
-    public void write(int b)
-            throws IOException {
-        write(new byte[]{(byte) b}, 0, 1);
-    }
-
-    public void write(byte[] b)
-
-            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 {
-        if (len == 0) return;
-
-        out.write((Integer.toHexString(len)).getBytes());
-        out.write(crlf);
-        out.write(b, off, len);
-        out.write(crlf);
-    }
-
-    /*
-     public void flush()
-     throws IOException {
-     out.flush();
-     }
-     */
-
-    public void eos() throws IOException {
-        synchronized (this) {
-            if (eos) return;
-            eos = true;
-        }
-        out.write("0\r\n\r\n".getBytes());
-        out.flush();
-    }
-
-    public void close()
-            throws IOException {
-        eos();
-        out.close();
-    }
-
-}
+/*
+ * Copyright 2001-2004 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.
+ */
+package org.apache.axis2.transport.http;
+
+
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+
+/**
+ * @author Rick Rineholt
+ */
+public class ChunkedOutputStream extends FilterOutputStream {
+
+    boolean eos = false;
+
+    private ChunkedOutputStream() {
+        super(null);
+    }
+
+    public ChunkedOutputStream(OutputStream os) {
+        super(os);
+    }
+
+    public void write(int b)
+            throws IOException {
+        write(new byte[]{(byte) b}, 0, 1);
+    }
+
+    public void write(byte[] b)
+
+            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 {
+        if (len == 0) return;
+
+        out.write((Integer.toHexString(len)).getBytes());
+        out.write(crlf);
+        out.write(b, off, len);
+        out.write(crlf);
+    }
+
+    /*
+     public void flush()
+     throws IOException {
+     out.flush();
+     }
+     */
+
+    public void eos() throws IOException {
+        synchronized (this) {
+            if (eos) return;
+            eos = true;
+        }
+        out.write("0\r\n\r\n".getBytes());
+        out.flush();
+    }
+
+    public void close()
+            throws IOException {
+        eos();
+        out.close();
+    }
+
+}

Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ChunkedOutputStream.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Thu Sep 15 11:52:11 2005
@@ -1,607 +1,607 @@
-/*
-* 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.
-*/
-
-package org.apache.axis2.transport.http;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.handlers.AbstractHandler;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.impl.OMOutputImpl;
-import org.apache.axis2.soap.SOAP11Constants;
-import org.apache.axis2.soap.SOAP12Constants;
-import org.apache.axis2.transport.TransportSender;
-import org.apache.commons.httpclient.*;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.RequestEntity;
-
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-public class CommonsHTTPTransportSender
-        extends AbstractHandler
-        implements TransportSender {
-    private boolean chuncked = false;
-
-    private String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
-
-    public static final String HTTP_METHOD = "HTTP_METHOD";
-
-    protected HttpClient httpClient;
-
-    protected OMElement outputMessage;
-
-    protected OMOutputImpl omOutput = new OMOutputImpl();
-
-    public CommonsHTTPTransportSender() {
-    } //default
-
-    public void invoke(MessageContext msgContext) throws AxisFault {
-        try {
-            String charSetEnc =
-                    (String) msgContext.getProperty(
-                            MessageContext.CHARACTER_SET_ENCODING);
-            if (charSetEnc != null) {
-                omOutput.setCharSetEncoding(charSetEnc);
-            } else {
-                OperationContext opctx = msgContext.getOperationContext();
-                if(opctx != null) {
-                    charSetEnc = (String)opctx.getProperty(MessageContext.CHARACTER_SET_ENCODING);
-                }
-            }
-            /**
-             * If the char set enc is still not found use the default
-             */
-            if(charSetEnc == null) {
-                charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
-            }
-            msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
-            omOutput.setSoap11(msgContext.isSOAP11());
-            omOutput.setDoOptimize(msgContext.isDoingMTOM());
-
-            omOutput.setCharSetEncoding(charSetEnc);
-            
-            //Check for the REST behaviour, if you desire rest beahaviour
-            //put a <parameter name="doREST" value="true"/> at the
-            // server.xml/client.xml file
-            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;
-            if (msgContext.isDoingREST()) {
-                dataOut = msgContext.getEnvelope().getBody().getFirstElement();
-            } else {
-                dataOut = msgContext.getEnvelope();
-            }
-
-            //TODO timeout, configuration
-            if (epr != null) {
-                writeMessageWithCommons(msgContext, epr, dataOut);
-            } else {
-                OutputStream out =
-                        (OutputStream) msgContext.getProperty(
-                                MessageContext.TRANSPORT_OUT);
-                if (msgContext.isServerSide()) {
-                    HTTPOutTransportInfo transportInfo =
-                            (HTTPOutTransportInfo) msgContext.getProperty(
-                                    HTTPConstants.HTTPOutTransportInfo);
-                    if (transportInfo != null) {
-                        omOutput.setSoap11(msgContext.isSOAP11());
-                        transportInfo.setCharacterEncoding(omOutput.getCharSetEncoding());
-                        transportInfo.setContentType(omOutput.getContentType());
-                    }else{
-                        throw new AxisFault(HTTPConstants.HTTPOutTransportInfo + " does not set");
-                    }
-                }
-                omOutput.setOutputStream(out, msgContext.isDoingMTOM());
-                dataOut.serialize(omOutput);
-                omOutput.flush();
-            }
-            if(msgContext.getOperationContext() != null){
-                msgContext.getOperationContext().setProperty(
-                        Constants.RESPONSE_WRITTEN,
-                        Constants.VALUE_TRUE);
-            }
-        } catch (XMLStreamException e) {
-            throw new AxisFault(e);
-        } catch (FactoryConfigurationError e) {
-            throw new AxisFault(e);
-        } catch (IOException 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());
-
-            String soapActionString = msgContext.getSoapAction();
-            if (soapActionString == null || soapActionString.length() == 0) {
-                soapActionString = msgContext.getWSAAction();
-            }
-            if (soapActionString == null) {
-                soapActionString = "";
-            }
-            //supporting RESTFacility..
-
-            if (!msgContext.isDoingREST()) {
-                this.transportConfigurationPOST(
-                        msgContext,
-                        dataout,
-                        url,
-                        soapActionString);
-            }
-            if (msgContext.isDoingREST()) {
-                if (msgContext.isRestThroughPOST()) {
-                    this.transportConfigurationPOST(
-                            msgContext,
-                            dataout,
-                            url,
-                            soapActionString);
-                } else {
-                    this.transportConfigurationGET(msgContext, url);
-                }
-            }
-        } 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 String charSetEnc;
-
-        private OMElement element;
-
-        private boolean chuncked;
-
-        private byte[] bytes;
-
-        private boolean doingMTOM = false;
-
-        private String soapActionString;
-
-        private MessageContext msgCtxt;
-
-        public AxisRequestEntity(
-                OMElement element,
-                boolean chuncked,
-                MessageContext msgCtxt,
-                String charSetEncoding,
-                String soapActionString) {
-            this.element = element;
-            this.chuncked = chuncked;
-            this.msgCtxt = msgCtxt;
-            this.doingMTOM = msgCtxt.isDoingMTOM();
-            this.charSetEnc = charSetEncoding;
-            this.soapActionString = soapActionString;
-        }
-
-        public boolean isRepeatable() {
-            return true;
-        }
-
-        public byte[] writeBytes() throws AxisFault {
-            try {
-                ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
-
-                if (!doingMTOM) {
-                    XMLStreamWriter outputWriter =
-                            XMLOutputFactory.newInstance()
-                            .createXMLStreamWriter(bytesOut,
-                                    charSetEnc);
-                    OMOutputImpl output = new OMOutputImpl(outputWriter);
-                    output.setCharSetEncoding(charSetEnc);
-                    element.serialize(output);
-                    output.flush();
-                    return bytesOut.toByteArray();
-                } else {
-                    omOutput.setCharSetEncoding(charSetEnc);
-                    omOutput.setOutputStream(bytesOut, true);  //changed...
-                    element.serialize(omOutput);
-                    omOutput.flush();
-                    return bytesOut.toByteArray();
-                }
-            } catch (XMLStreamException e) {
-                throw new AxisFault(e);
-            } catch (FactoryConfigurationError e) {
-                throw new AxisFault(e);
-            }
-        }
-
-        private void handleOMOutput(OutputStream out, boolean doingMTOM)
-                throws XMLStreamException {
-            omOutput.setOutputStream(out, doingMTOM);
-            element.serialize(omOutput);
-            omOutput.flush();
-        }
-
-        public void writeRequest(OutputStream out) throws IOException {
-            try {
-                if (doingMTOM) { //chagened ..
-                    if (chuncked) {
-                        this.handleOMOutput(out, doingMTOM);
-                    } else {
-                        if (bytes == null) {
-                            bytes = writeBytes();
-                        }
-                        out.write(bytes);
-                    }
-
-                } else {
-                    if (chuncked) {
-                        this.handleOMOutput(out, doingMTOM);
-                    } else {
-                        if (bytes == null) {
-                            bytes = writeBytes();
-                        }
-                        out.write(bytes);
-                    }
-                }
-                out.flush();
-            } 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 (doingMTOM) {    //chagened
-                        if (chuncked) {
-                            return -1;
-                        } else {
-                            if (bytes == null) {
-                                bytes = writeBytes();
-                            }
-                            return bytes.length;
-                        }
-                    } else {
-                        if (chuncked) {
-                            return -1;
-                        } else {
-                            if (bytes == null) {
-                                bytes = writeBytes();
-                            }
-                            return bytes.length;
-                        }
-                    }
-                } catch (AxisFault e) {
-                    return -1;
-                }
-        }
-
-        public String getContentType() {
-            String encoding = omOutput.getCharSetEncoding();
-            String contentType = omOutput.getContentType();
-            if(encoding != null){
-                contentType += ";charset=" + encoding;
-            }
-
-            // action header is not mandated in SOAP 1.2. So putting it, if available
-            if(!msgCtxt.isSOAP11() && soapActionString != null && !"".equals(soapActionString.trim())) {
-                contentType = contentType + ";action=" + soapActionString + ";";
-            }
-            return contentType;
-        }
-    }
-
-    /*
-    * (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="false">HTTP/1.0</parameter> or
-        //<parameter name="PROTOCOL" locked="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())) {
-                this.httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
-            } else {
-                throw new AxisFault(
-                        "Parameter "
-                        + HTTPConstants.PROTOCOL_VERSION
-                        + " Can have values only HTTP/1.0 or HTTP/1.1");
-            }
-        }
-
-    }
-
-    private void transportConfigurationPOST(
-            MessageContext msgContext,
-            OMElement dataout,
-            URL url,
-            String soapActionString)
-            throws MalformedURLException, AxisFault, IOException {
-
-        //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);
-
-        // SO_TIMEOUT -- timeout for blocking reads
-        httpClient.getHttpConnectionManager().getParams().setSoTimeout(60000);
-        // timeout for initial connection
-        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(60000);
-
-        PostMethod postMethod = new PostMethod(url.toString());
-        postMethod.setPath(url.getFile());
-
-        msgContext.setProperty(HTTP_METHOD, postMethod);
-
-        String charEncoding =
-                (String) msgContext.getProperty(
-                        MessageContext.CHARACTER_SET_ENCODING);
-        if(charEncoding == null){
-            charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
-        }
-
-        postMethod.setRequestEntity(
-                new AxisRequestEntity(
-                        dataout,
-                        chuncked,
-                        msgContext,
-                        charEncoding,
-                        soapActionString));
-
-
-        if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)
-                && chuncked) {
-            postMethod.setContentChunked(true);
-        }
-        postMethod.setRequestHeader(
-                HTTPConstants.HEADER_USER_AGENT,
-                "Axis/2.0");
-        if (msgContext.isSOAP11() && !msgContext.isDoingREST()) {
-            postMethod.setRequestHeader(
-                    HTTPConstants.HEADER_SOAP_ACTION,
-                    soapActionString);
-        }
-        postMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url.getHost());
-        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);
-                postMethod.setRequestHeader(
-                        HTTPConstants.HEADER_EXPECT,
-                        HTTPConstants.HEADER_EXPECT_100_Continue);
-            }
-        }
-        
-        this.httpClient.executeMethod(postMethod);
-
-        if (postMethod.getStatusCode() == HttpStatus.SC_OK) {
-            processResponse(postMethod, msgContext);
-        } else if (postMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
-            return;
-        } else  if (postMethod.getStatusCode() == HttpStatus.SC_INTERNAL_SERVER_ERROR){
-
-            Header contenttypeHheader = postMethod.getResponseHeader(
-                    HTTPConstants.HEADER_CONTENT_TYPE);
-
-            String value = contenttypeHheader.getValue();
-            if(value != null){
-                if(value.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE)>=0||
-                        value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >=0){
-                    processResponse(postMethod, msgContext);
-                }
-            }
-        }else{
-            throw new AxisFault(
-                    Messages.getMessage(
-                            "transportError",
-                            String.valueOf(postMethod.getStatusCode()),
-                            postMethod.getResponseBodyAsString()));
-        }
-
-    }
-
-    private void processResponse(HttpMethodBase httpMethod, MessageContext msgContext) throws IOException {
-        obatainHTTPHeaderInformation(httpMethod, msgContext);
-        InputStream in = httpMethod.getResponseBodyAsStream();
-        if (in == null) {
-            throw new AxisFault(
-                    Messages.getMessage("canNotBeNull", "InputStream"));
-        }
-        msgContext.getOperationContext().setProperty(
-                MessageContext.TRANSPORT_IN,
-                in);
-    }
-
-    private void transportConfigurationGET(MessageContext msgContext, URL url)
-            throws MalformedURLException, AxisFault, IOException {
-        GetMethod getMethod = new GetMethod();
-        getMethod.setPath(url.getFile());
-
-        String charEncoding =
-                (String) msgContext.getProperty(
-                        MessageContext.CHARACTER_SET_ENCODING);
-        if (charEncoding == null) //Default encoding scheme
-            getMethod.setRequestHeader(
-                    HTTPConstants.HEADER_CONTENT_TYPE,
-                    "text/xml; charset="
-                    + MessageContext.DEFAULT_CHAR_SET_ENCODING);
-        else
-            getMethod.setRequestHeader(
-                    HTTPConstants.HEADER_CONTENT_TYPE,
-                    "text/xml; charset=" + charEncoding);
-
-        this.httpClient = new HttpClient();
-        HostConfiguration hostConfig =
-                this.getHostConfiguration(msgContext, url);
-
-        this.httpClient.executeMethod(hostConfig, getMethod);
-
-        if (getMethod.getStatusCode() == HttpStatus.SC_OK) {
-            processResponse(getMethod, msgContext);
-
-//            obatainHTTPHeaderInformation(getMethod, msgContext);
-//
-//            InputStream in = getMethod.getResponseBodyAsStream();
-//            if (in == null) {
-//                throw new AxisFault(
-//                        Messages.getMessage("canNotBeNull", "InputStream"));
-//            }
-//            msgContext.getOperationContext().setProperty(
-//                    MessageContext.TRANSPORT_IN,
-//                    in);
-        } else if (getMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
-            return;
-        }else  if (getMethod.getStatusCode() == HttpStatus.SC_INTERNAL_SERVER_ERROR){
-
-            Header contenttypeHheader = getMethod.getResponseHeader(
-                    HTTPConstants.HEADER_CONTENT_TYPE);
-
-             String value = contenttypeHheader.getValue();
-            if(value != null){
-                if(value.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE)>=0||
-                        value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >=0){
-                    processResponse(getMethod, msgContext);
-                }
-
-            }
-        }else{
-            throw new AxisFault(
-                    Messages.getMessage(
-                            "transportError",
-                            String.valueOf(getMethod.getStatusCode()),
-                            getMethod.getResponseBodyAsString()));
-        }
-    }
-
-    /**
-     * Collect the HTTP header information and set them in the message context
-     * @param method
-     * @param msgContext
-     */
-    private void obatainHTTPHeaderInformation(HttpMethodBase method,MessageContext msgContext) {
-        Header header =
-                method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
-        if (header != null) {
-            HeaderElement[] headers = header.getElements();
-            for (int i = 0; i < headers.length; i++) {
-                NameValuePair charsetEnc = headers[i]
-                        .getParameterByName(HTTPConstants.CHAR_SET_ENCODING);
-                if (headers[i]
-                        .getName()
-                        .equalsIgnoreCase(
-                                HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED)) {
-                    OperationContext opContext =
-                            msgContext.getOperationContext();
-                    if (opContext != null) {
-                        opContext.setProperty(
-                                HTTPConstants.MTOM_RECIVED_CONTENT_TYPE,
-                                header.getValue());
-                    }
-                } else if (charsetEnc != null) {
-
-                    msgContext
-                            .setProperty(
-                                    MessageContext.CHARACTER_SET_ENCODING,
-                                    charsetEnc);
-                }
-            }
-        }
-
-    }
-
+/*
+* 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.
+*/
+
+package org.apache.axis2.transport.http;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.OMOutputImpl;
+import org.apache.axis2.soap.SOAP11Constants;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.transport.TransportSender;
+import org.apache.commons.httpclient.*;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.RequestEntity;
+
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class CommonsHTTPTransportSender
+        extends AbstractHandler
+        implements TransportSender {
+    private boolean chuncked = false;
+
+    private String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
+
+    public static final String HTTP_METHOD = "HTTP_METHOD";
+
+    protected HttpClient httpClient;
+
+    protected OMElement outputMessage;
+
+    protected OMOutputImpl omOutput = new OMOutputImpl();
+
+    public CommonsHTTPTransportSender() {
+    } //default
+
+    public void invoke(MessageContext msgContext) throws AxisFault {
+        try {
+            String charSetEnc =
+                    (String) msgContext.getProperty(
+                            MessageContext.CHARACTER_SET_ENCODING);
+            if (charSetEnc != null) {
+                omOutput.setCharSetEncoding(charSetEnc);
+            } else {
+                OperationContext opctx = msgContext.getOperationContext();
+                if(opctx != null) {
+                    charSetEnc = (String)opctx.getProperty(MessageContext.CHARACTER_SET_ENCODING);
+                }
+            }
+            /**
+             * If the char set enc is still not found use the default
+             */
+            if(charSetEnc == null) {
+                charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
+            }
+            msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
+            omOutput.setSoap11(msgContext.isSOAP11());
+            omOutput.setDoOptimize(msgContext.isDoingMTOM());
+
+            omOutput.setCharSetEncoding(charSetEnc);
+            
+            //Check for the REST behaviour, if you desire rest beahaviour
+            //put a <parameter name="doREST" value="true"/> at the
+            // server.xml/client.xml file
+            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;
+            if (msgContext.isDoingREST()) {
+                dataOut = msgContext.getEnvelope().getBody().getFirstElement();
+            } else {
+                dataOut = msgContext.getEnvelope();
+            }
+
+            //TODO timeout, configuration
+            if (epr != null) {
+                writeMessageWithCommons(msgContext, epr, dataOut);
+            } else {
+                OutputStream out =
+                        (OutputStream) msgContext.getProperty(
+                                MessageContext.TRANSPORT_OUT);
+                if (msgContext.isServerSide()) {
+                    HTTPOutTransportInfo transportInfo =
+                            (HTTPOutTransportInfo) msgContext.getProperty(
+                                    HTTPConstants.HTTPOutTransportInfo);
+                    if (transportInfo != null) {
+                        omOutput.setSoap11(msgContext.isSOAP11());
+                        transportInfo.setCharacterEncoding(omOutput.getCharSetEncoding());
+                        transportInfo.setContentType(omOutput.getContentType());
+                    }else{
+                        throw new AxisFault(HTTPConstants.HTTPOutTransportInfo + " does not set");
+                    }
+                }
+                omOutput.setOutputStream(out, msgContext.isDoingMTOM());
+                dataOut.serialize(omOutput);
+                omOutput.flush();
+            }
+            if(msgContext.getOperationContext() != null){
+                msgContext.getOperationContext().setProperty(
+                        Constants.RESPONSE_WRITTEN,
+                        Constants.VALUE_TRUE);
+            }
+        } catch (XMLStreamException e) {
+            throw new AxisFault(e);
+        } catch (FactoryConfigurationError e) {
+            throw new AxisFault(e);
+        } catch (IOException 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());
+
+            String soapActionString = msgContext.getSoapAction();
+            if (soapActionString == null || soapActionString.length() == 0) {
+                soapActionString = msgContext.getWSAAction();
+            }
+            if (soapActionString == null) {
+                soapActionString = "";
+            }
+            //supporting RESTFacility..
+
+            if (!msgContext.isDoingREST()) {
+                this.transportConfigurationPOST(
+                        msgContext,
+                        dataout,
+                        url,
+                        soapActionString);
+            }
+            if (msgContext.isDoingREST()) {
+                if (msgContext.isRestThroughPOST()) {
+                    this.transportConfigurationPOST(
+                            msgContext,
+                            dataout,
+                            url,
+                            soapActionString);
+                } else {
+                    this.transportConfigurationGET(msgContext, url);
+                }
+            }
+        } 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 String charSetEnc;
+
+        private OMElement element;
+
+        private boolean chuncked;
+
+        private byte[] bytes;
+
+        private boolean doingMTOM = false;
+
+        private String soapActionString;
+
+        private MessageContext msgCtxt;
+
+        public AxisRequestEntity(
+                OMElement element,
+                boolean chuncked,
+                MessageContext msgCtxt,
+                String charSetEncoding,
+                String soapActionString) {
+            this.element = element;
+            this.chuncked = chuncked;
+            this.msgCtxt = msgCtxt;
+            this.doingMTOM = msgCtxt.isDoingMTOM();
+            this.charSetEnc = charSetEncoding;
+            this.soapActionString = soapActionString;
+        }
+
+        public boolean isRepeatable() {
+            return true;
+        }
+
+        public byte[] writeBytes() throws AxisFault {
+            try {
+                ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
+
+                if (!doingMTOM) {
+                    XMLStreamWriter outputWriter =
+                            XMLOutputFactory.newInstance()
+                            .createXMLStreamWriter(bytesOut,
+                                    charSetEnc);
+                    OMOutputImpl output = new OMOutputImpl(outputWriter);
+                    output.setCharSetEncoding(charSetEnc);
+                    element.serialize(output);
+                    output.flush();
+                    return bytesOut.toByteArray();
+                } else {
+                    omOutput.setCharSetEncoding(charSetEnc);
+                    omOutput.setOutputStream(bytesOut, true);  //changed...
+                    element.serialize(omOutput);
+                    omOutput.flush();
+                    return bytesOut.toByteArray();
+                }
+            } catch (XMLStreamException e) {
+                throw new AxisFault(e);
+            } catch (FactoryConfigurationError e) {
+                throw new AxisFault(e);
+            }
+        }
+
+        private void handleOMOutput(OutputStream out, boolean doingMTOM)
+                throws XMLStreamException {
+            omOutput.setOutputStream(out, doingMTOM);
+            element.serialize(omOutput);
+            omOutput.flush();
+        }
+
+        public void writeRequest(OutputStream out) throws IOException {
+            try {
+                if (doingMTOM) { //chagened ..
+                    if (chuncked) {
+                        this.handleOMOutput(out, doingMTOM);
+                    } else {
+                        if (bytes == null) {
+                            bytes = writeBytes();
+                        }
+                        out.write(bytes);
+                    }
+
+                } else {
+                    if (chuncked) {
+                        this.handleOMOutput(out, doingMTOM);
+                    } else {
+                        if (bytes == null) {
+                            bytes = writeBytes();
+                        }
+                        out.write(bytes);
+                    }
+                }
+                out.flush();
+            } 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 (doingMTOM) {    //chagened
+                        if (chuncked) {
+                            return -1;
+                        } else {
+                            if (bytes == null) {
+                                bytes = writeBytes();
+                            }
+                            return bytes.length;
+                        }
+                    } else {
+                        if (chuncked) {
+                            return -1;
+                        } else {
+                            if (bytes == null) {
+                                bytes = writeBytes();
+                            }
+                            return bytes.length;
+                        }
+                    }
+                } catch (AxisFault e) {
+                    return -1;
+                }
+        }
+
+        public String getContentType() {
+            String encoding = omOutput.getCharSetEncoding();
+            String contentType = omOutput.getContentType();
+            if(encoding != null){
+                contentType += ";charset=" + encoding;
+            }
+
+            // action header is not mandated in SOAP 1.2. So putting it, if available
+            if(!msgCtxt.isSOAP11() && soapActionString != null && !"".equals(soapActionString.trim())) {
+                contentType = contentType + ";action=" + soapActionString + ";";
+            }
+            return contentType;
+        }
+    }
+
+    /*
+    * (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="false">HTTP/1.0</parameter> or
+        //<parameter name="PROTOCOL" locked="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())) {
+                this.httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
+            } else {
+                throw new AxisFault(
+                        "Parameter "
+                        + HTTPConstants.PROTOCOL_VERSION
+                        + " Can have values only HTTP/1.0 or HTTP/1.1");
+            }
+        }
+
+    }
+
+    private void transportConfigurationPOST(
+            MessageContext msgContext,
+            OMElement dataout,
+            URL url,
+            String soapActionString)
+            throws MalformedURLException, AxisFault, IOException {
+
+        //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);
+
+        // SO_TIMEOUT -- timeout for blocking reads
+        httpClient.getHttpConnectionManager().getParams().setSoTimeout(60000);
+        // timeout for initial connection
+        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(60000);
+
+        PostMethod postMethod = new PostMethod(url.toString());
+        postMethod.setPath(url.getFile());
+
+        msgContext.setProperty(HTTP_METHOD, postMethod);
+
+        String charEncoding =
+                (String) msgContext.getProperty(
+                        MessageContext.CHARACTER_SET_ENCODING);
+        if(charEncoding == null){
+            charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
+        }
+
+        postMethod.setRequestEntity(
+                new AxisRequestEntity(
+                        dataout,
+                        chuncked,
+                        msgContext,
+                        charEncoding,
+                        soapActionString));
+
+
+        if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)
+                && chuncked) {
+            postMethod.setContentChunked(true);
+        }
+        postMethod.setRequestHeader(
+                HTTPConstants.HEADER_USER_AGENT,
+                "Axis/2.0");
+        if (msgContext.isSOAP11() && !msgContext.isDoingREST()) {
+            postMethod.setRequestHeader(
+                    HTTPConstants.HEADER_SOAP_ACTION,
+                    soapActionString);
+        }
+        postMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url.getHost());
+        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);
+                postMethod.setRequestHeader(
+                        HTTPConstants.HEADER_EXPECT,
+                        HTTPConstants.HEADER_EXPECT_100_Continue);
+            }
+        }
+        
+        this.httpClient.executeMethod(postMethod);
+
+        if (postMethod.getStatusCode() == HttpStatus.SC_OK) {
+            processResponse(postMethod, msgContext);
+        } else if (postMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
+            return;
+        } else  if (postMethod.getStatusCode() == HttpStatus.SC_INTERNAL_SERVER_ERROR){
+
+            Header contenttypeHheader = postMethod.getResponseHeader(
+                    HTTPConstants.HEADER_CONTENT_TYPE);
+
+            String value = contenttypeHheader.getValue();
+            if(value != null){
+                if(value.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE)>=0||
+                        value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >=0){
+                    processResponse(postMethod, msgContext);
+                }
+            }
+        }else{
+            throw new AxisFault(
+                    Messages.getMessage(
+                            "transportError",
+                            String.valueOf(postMethod.getStatusCode()),
+                            postMethod.getResponseBodyAsString()));
+        }
+
+    }
+
+    private void processResponse(HttpMethodBase httpMethod, MessageContext msgContext) throws IOException {
+        obatainHTTPHeaderInformation(httpMethod, msgContext);
+        InputStream in = httpMethod.getResponseBodyAsStream();
+        if (in == null) {
+            throw new AxisFault(
+                    Messages.getMessage("canNotBeNull", "InputStream"));
+        }
+        msgContext.getOperationContext().setProperty(
+                MessageContext.TRANSPORT_IN,
+                in);
+    }
+
+    private void transportConfigurationGET(MessageContext msgContext, URL url)
+            throws MalformedURLException, AxisFault, IOException {
+        GetMethod getMethod = new GetMethod();
+        getMethod.setPath(url.getFile());
+
+        String charEncoding =
+                (String) msgContext.getProperty(
+                        MessageContext.CHARACTER_SET_ENCODING);
+        if (charEncoding == null) //Default encoding scheme
+            getMethod.setRequestHeader(
+                    HTTPConstants.HEADER_CONTENT_TYPE,
+                    "text/xml; charset="
+                    + MessageContext.DEFAULT_CHAR_SET_ENCODING);
+        else
+            getMethod.setRequestHeader(
+                    HTTPConstants.HEADER_CONTENT_TYPE,
+                    "text/xml; charset=" + charEncoding);
+
+        this.httpClient = new HttpClient();
+        HostConfiguration hostConfig =
+                this.getHostConfiguration(msgContext, url);
+
+        this.httpClient.executeMethod(hostConfig, getMethod);
+
+        if (getMethod.getStatusCode() == HttpStatus.SC_OK) {
+            processResponse(getMethod, msgContext);
+
+//            obatainHTTPHeaderInformation(getMethod, msgContext);
+//
+//            InputStream in = getMethod.getResponseBodyAsStream();
+//            if (in == null) {
+//                throw new AxisFault(
+//                        Messages.getMessage("canNotBeNull", "InputStream"));
+//            }
+//            msgContext.getOperationContext().setProperty(
+//                    MessageContext.TRANSPORT_IN,
+//                    in);
+        } else if (getMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
+            return;
+        }else  if (getMethod.getStatusCode() == HttpStatus.SC_INTERNAL_SERVER_ERROR){
+
+            Header contenttypeHheader = getMethod.getResponseHeader(
+                    HTTPConstants.HEADER_CONTENT_TYPE);
+
+             String value = contenttypeHheader.getValue();
+            if(value != null){
+                if(value.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE)>=0||
+                        value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >=0){
+                    processResponse(getMethod, msgContext);
+                }
+
+            }
+        }else{
+            throw new AxisFault(
+                    Messages.getMessage(
+                            "transportError",
+                            String.valueOf(getMethod.getStatusCode()),
+                            getMethod.getResponseBodyAsString()));
+        }
+    }
+
+    /**
+     * Collect the HTTP header information and set them in the message context
+     * @param method
+     * @param msgContext
+     */
+    private void obatainHTTPHeaderInformation(HttpMethodBase method,MessageContext msgContext) {
+        Header header =
+                method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+        if (header != null) {
+            HeaderElement[] headers = header.getElements();
+            for (int i = 0; i < headers.length; i++) {
+                NameValuePair charsetEnc = headers[i]
+                        .getParameterByName(HTTPConstants.CHAR_SET_ENCODING);
+                if (headers[i]
+                        .getName()
+                        .equalsIgnoreCase(
+                                HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED)) {
+                    OperationContext opContext =
+                            msgContext.getOperationContext();
+                    if (opContext != null) {
+                        opContext.setProperty(
+                                HTTPConstants.MTOM_RECIVED_CONTENT_TYPE,
+                                header.getValue());
+                    }
+                } else if (charsetEnc != null) {
+
+                    msgContext
+                            .setProperty(
+                                    MessageContext.CHARACTER_SET_ENCODING,
+                                    charsetEnc);
+                }
+            }
+        }
+
+    }
+
 }

Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java Thu Sep 15 11:52:11 2005
@@ -1,422 +1,422 @@
-
-/*
- * 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.
- */
-package org.apache.axis2.transport.http;
-
-import java.io.UnsupportedEncodingException;
-
-/**
- * HTTP protocol and message context constants.
- */
-public class HTTPConstants {
-
-    public static final String PROTOCOL_VERSION = "PROTOCOL";
-
-    /**
-     * Field REQUEST_URI
-     */
-    public static final String REQUEST_URI = "REQUEST_URI";
-
-    /**
-     * Field RESPONSE_CODE
-     */
-    public static final String RESPONSE_CODE = "RESPONSE_CODE";
-
-    /**
-     * Field RESPONSE_WORD
-     */
-    public static final String RESPONSE_WORD = "RESPONSE_WORD";
-
-    /**
-     * Field RESPONSE_ACK_CODE_VAL
-     */
-    public static final String RESPONSE_ACK_CODE_VAL = "202";
-
-    /**
-     * Field SOCKET
-     */
-    public static final String SOCKET = "SOCKET";
-
-    /**
-     * Field HEADER_PROTOCOL_10
-     */
-    public static final String HEADER_PROTOCOL_10 = "HTTP/1.0";
-
-    /**
-     * Field HEADER_PROTOCOL_11
-     */
-    public static final String HEADER_PROTOCOL_11 = "HTTP/1.1";
-
-    /**
-     * Field HEADER_PROTOCOL_V10
-     */
-    public static final String HEADER_PROTOCOL_V10 = "1.0".intern();
-
-    /**
-     * Field HEADER_PROTOCOL_V11
-     */
-    public static final String HEADER_PROTOCOL_V11 = "1.1".intern();
-    
-    /**
-     * Field CHAR_SET_ENCODING
-     */
-    public static String CHAR_SET_ENCODING = "charset";
-
-    /**
-     * Field HEADER_POST
-     */
-    public static final String HEADER_POST = "POST";
-
-    /**
-     * Field HEADER_GET
-     */
-    public static final String HEADER_GET = "GET";
-
-    /**
-     * Field HEADER_HOST
-     */
-    public static final String HEADER_HOST = "Host";
-
-    /**
-     * Field HEADER_CONTENT_DESCRIPTION
-     */
-    public static final String HEADER_CONTENT_DESCRIPTION =
-            "Content-Description";
-
-    /**
-     * Field HEADER_CONTENT_TYPE
-     */
-    public static final String HEADER_CONTENT_TYPE = "Content-Type";
-
-    /**
-     * Field HEADER_CONTENT_TRANSFER_ENCODING
-     */
-    public static final String HEADER_CONTENT_TRANSFER_ENCODING =
-            "Content-Transfer-Encoding";
-
-    /**
-     * Field HEADER_CONTENT_TYPE_JMS
-     */
-    public static final String HEADER_CONTENT_TYPE_JMS = "ContentType";
-
-    /**
-     * Field HEADER_CONTENT_LENGTH
-     */
-    public static final String HEADER_CONTENT_LENGTH = "Content-Length";
-
-    /**
-     * Field HEADER_CONTENT_LOCATION
-     */
-    public static final String HEADER_CONTENT_LOCATION = "Content-Location";
-
-    /**
-     * Field HEADER_CONTENT_ID
-     */
-    public static final String HEADER_CONTENT_ID = "Content-Id";
-
-    /**
-     * Field HEADER_SOAP_ACTION
-     */
-    public static final String HEADER_SOAP_ACTION = "SOAPAction";
-
-    /**
-     * Field HEADER_AUTHORIZATION
-     */
-    public static final String HEADER_AUTHORIZATION = "Authorization";
-
-    /**
-     * Field HEADER_PROXY_AUTHORIZATION
-     */
-    public static final String HEADER_PROXY_AUTHORIZATION =
-            "Proxy-Authorization";
-
-    /**
-     * Field HEADER_EXPECT
-     */
-    public static final String HEADER_EXPECT = "Expect";
-
-    /**
-     * Field HEADER_EXPECT_100_Continue
-     */
-    public static final String HEADER_EXPECT_100_Continue = "100-continue";
-
-    /**
-     * Field HEADER_USER_AGENT
-     */
-    public static final String HEADER_USER_AGENT = "User-Agent";
-
-    /**
-     * Field HEADER_CACHE_CONTROL
-     */
-    public static final String HEADER_CACHE_CONTROL = "Cache-Control";
-
-    /**
-     * Field HEADER_CACHE_CONTROL_NOCACHE
-     */
-    public static final String HEADER_CACHE_CONTROL_NOCACHE = "no-cache";
-
-    /**
-     * Field HEADER_PRAGMA
-     */
-    public static final String HEADER_PRAGMA = "Pragma";
-
-    /**
-     * Field HEADER_LOCATION
-     */
-    public static final String HEADER_LOCATION = "Location";
-
-    /**
-     * Field REQUEST_HEADERS
-     */
-    public static final String REQUEST_HEADERS = "HTTP-Request-Headers";
-
-    /**
-     * Field RESPONSE_HEADERS
-     */
-    public static final String RESPONSE_HEADERS = "HTTP-Response-Headers";
-
-    /* http 1.1 */
-
-    /**
-     * Field HEADER_TRANSFER_ENCODING
-     */
-    public static final String HEADER_TRANSFER_ENCODING =
-            "Transfer-Encoding".intern();
-
-    /**
-     * Field HEADER_TRANSFER_ENCODING_CHUNKED
-     */
-    public static final String HEADER_TRANSFER_ENCODING_CHUNKED =
-            "chunked".intern();
-
-    /**
-     * Field HEADER_CONNECTION
-     */
-    public static final String HEADER_CONNECTION = "Connection";
-
-    /**
-     * Field HEADER_CONNECTION_CLOSE
-     */
-    public static final String HEADER_CONNECTION_CLOSE = "close".intern();
-
-    /**
-     * Field HEADER_CONNECTION_KEEPALIVE
-     */
-    public static final String HEADER_CONNECTION_KEEPALIVE =
-            "Keep-Alive".intern();    // The default don't send.
-
-    /**
-     * Field HEADER_ACCEPT
-     */
-    public static final String HEADER_ACCEPT = "Accept";
-
-    /**
-     * Field HEADER_ACCEPT_TEXT_ALL
-     */
-    public static final String HEADER_ACCEPT_TEXT_ALL = "text/*";
-
-    /**
-     * Field HEADER_ACCEPT_APPL_SOAP
-     */
-    public static final String HEADER_ACCEPT_APPL_SOAP = "application/soap+xml";
-
-    /**
-     * Field HEADER_ACCEPT_MULTIPART_RELATED
-     */
-    public static final String HEADER_ACCEPT_MULTIPART_RELATED =
-            "multipart/related";
-
-    /**
-     * Field HEADER_ACCEPT_APPLICATION_DIME
-     */
-    public static final String HEADER_ACCEPT_APPLICATION_DIME =
-            "application/dime";
-
-    /**
-     * Cookie headers
-     */
-    public static final String HEADER_COOKIE = "Cookie";
-
-    /**
-     * Field HEADER_COOKIE2
-     */
-    public static final String HEADER_COOKIE2 = "Cookie2";
-
-    /**
-     * Field HEADER_SET_COOKIE
-     */
-    public static final String HEADER_SET_COOKIE = "Set-Cookie";
-
-    /**
-     * Field HEADER_SET_COOKIE2
-     */
-    public static final String HEADER_SET_COOKIE2 = "Set-Cookie2";
-
-    /**
-     * Integer
-     */
-    public static String MC_HTTP_STATUS_CODE = "transport.http.statusCode";
-
-    /**
-     * String
-     */
-    public static String MC_HTTP_STATUS_MESSAGE =
-            "transport.http.statusMessage";
-
-    /**
-     * HttpServlet
-     */
-    public static String MC_HTTP_SERVLET = "transport.http.servlet";
-
-    /**
-     * HttpServletRequest
-     */
-    public static String MC_HTTP_SERVLETREQUEST =
-            "transport.http.servletRequest";
-
-    /**
-     * HttpServletResponse
-     */
-    public static String MC_HTTP_SERVLETRESPONSE =
-            "transport.http.servletResponse";
-
-    /**
-     * Field MC_HTTP_SERVLETLOCATION
-     */
-    public static String MC_HTTP_SERVLETLOCATION =
-            "transport.http.servletLocation";
-
-    /**
-     * Field MC_HTTP_SERVLETPATHINFO
-     */
-    public static String MC_HTTP_SERVLETPATHINFO =
-            "transport.http.servletPathInfo";
-
-    /**
-     * HTTP header field values
-     */
-    public static final String HEADER_DEFAULT_CHAR_ENCODING = "iso-8859-1";
-
-    /**
-     * AXIS servlet plugin parameter names.
-     */
-    public static final String PLUGIN_NAME = "transport.http.plugin.pluginName";
-
-    /**
-     * Field PLUGIN_SERVICE_NAME
-     */
-    public static final String PLUGIN_SERVICE_NAME =
-            "transport.http.plugin.serviceName";
-
-    /**
-     * Field PLUGIN_IS_DEVELOPMENT
-     */
-    public static final String PLUGIN_IS_DEVELOPMENT =
-            "transport.http.plugin.isDevelopment";
-
-    /**
-     * Field PLUGIN_ENABLE_LIST
-     */
-    public static final String PLUGIN_ENABLE_LIST =
-            "transport.http.plugin.enableList";
-
-    /**
-     * Field PLUGIN_ENGINE
-     */
-    public static final String PLUGIN_ENGINE = "transport.http.plugin.engine";
-
-    /**
-     * Field PLUGIN_WRITER
-     */
-    public static final String PLUGIN_WRITER = "transport.http.plugin.writer";
-
-    /**
-     * Field PLUGIN_LOG
-     */
-    public static final String PLUGIN_LOG = "transport.http.plugin.log";
-
-    /**
-     * Field PLUGIN_EXCEPTION_LOG
-     */
-    public static final String PLUGIN_EXCEPTION_LOG =
-            "transport.http.plugin.exceptionLog";
-
-    /**
-     * Field OK[]
-     */
-    public static final char OK[] = ("200 OK").toCharArray();
-
-    /**
-     * Field NOCONTENT[]
-     */
-    public static final byte NOCONTENT[] = ("202 OK\n\n").getBytes();
-
-    /**
-     * Field UNAUTH[]
-     */
-    public static final byte UNAUTH[] = ("401 Unauthorized").getBytes();
-
-    /**
-     * Field SENDER[]
-     */
-    public static final byte SENDER[] = "400".getBytes();
-
-    /**
-     * Field ISE[]
-     */
-    public static final byte ISE[] = ("500 Internal server error").getBytes();
-
-    // HTTP prefix
-
-    /**
-     * 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();
-    }
-
-
-}
+
+/*
+ * 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.
+ */
+package org.apache.axis2.transport.http;
+
+import java.io.UnsupportedEncodingException;
+
+/**
+ * HTTP protocol and message context constants.
+ */
+public class HTTPConstants {
+
+    public static final String PROTOCOL_VERSION = "PROTOCOL";
+
+    /**
+     * Field REQUEST_URI
+     */
+    public static final String REQUEST_URI = "REQUEST_URI";
+
+    /**
+     * Field RESPONSE_CODE
+     */
+    public static final String RESPONSE_CODE = "RESPONSE_CODE";
+
+    /**
+     * Field RESPONSE_WORD
+     */
+    public static final String RESPONSE_WORD = "RESPONSE_WORD";
+
+    /**
+     * Field RESPONSE_ACK_CODE_VAL
+     */
+    public static final String RESPONSE_ACK_CODE_VAL = "202";
+
+    /**
+     * Field SOCKET
+     */
+    public static final String SOCKET = "SOCKET";
+
+    /**
+     * Field HEADER_PROTOCOL_10
+     */
+    public static final String HEADER_PROTOCOL_10 = "HTTP/1.0";
+
+    /**
+     * Field HEADER_PROTOCOL_11
+     */
+    public static final String HEADER_PROTOCOL_11 = "HTTP/1.1";
+
+    /**
+     * Field HEADER_PROTOCOL_V10
+     */
+    public static final String HEADER_PROTOCOL_V10 = "1.0".intern();
+
+    /**
+     * Field HEADER_PROTOCOL_V11
+     */
+    public static final String HEADER_PROTOCOL_V11 = "1.1".intern();
+    
+    /**
+     * Field CHAR_SET_ENCODING
+     */
+    public static String CHAR_SET_ENCODING = "charset";
+
+    /**
+     * Field HEADER_POST
+     */
+    public static final String HEADER_POST = "POST";
+
+    /**
+     * Field HEADER_GET
+     */
+    public static final String HEADER_GET = "GET";
+
+    /**
+     * Field HEADER_HOST
+     */
+    public static final String HEADER_HOST = "Host";
+
+    /**
+     * Field HEADER_CONTENT_DESCRIPTION
+     */
+    public static final String HEADER_CONTENT_DESCRIPTION =
+            "Content-Description";
+
+    /**
+     * Field HEADER_CONTENT_TYPE
+     */
+    public static final String HEADER_CONTENT_TYPE = "Content-Type";
+
+    /**
+     * Field HEADER_CONTENT_TRANSFER_ENCODING
+     */
+    public static final String HEADER_CONTENT_TRANSFER_ENCODING =
+            "Content-Transfer-Encoding";
+
+    /**
+     * Field HEADER_CONTENT_TYPE_JMS
+     */
+    public static final String HEADER_CONTENT_TYPE_JMS = "ContentType";
+
+    /**
+     * Field HEADER_CONTENT_LENGTH
+     */
+    public static final String HEADER_CONTENT_LENGTH = "Content-Length";
+
+    /**
+     * Field HEADER_CONTENT_LOCATION
+     */
+    public static final String HEADER_CONTENT_LOCATION = "Content-Location";
+
+    /**
+     * Field HEADER_CONTENT_ID
+     */
+    public static final String HEADER_CONTENT_ID = "Content-Id";
+
+    /**
+     * Field HEADER_SOAP_ACTION
+     */
+    public static final String HEADER_SOAP_ACTION = "SOAPAction";
+
+    /**
+     * Field HEADER_AUTHORIZATION
+     */
+    public static final String HEADER_AUTHORIZATION = "Authorization";
+
+    /**
+     * Field HEADER_PROXY_AUTHORIZATION
+     */
+    public static final String HEADER_PROXY_AUTHORIZATION =
+            "Proxy-Authorization";
+
+    /**
+     * Field HEADER_EXPECT
+     */
+    public static final String HEADER_EXPECT = "Expect";
+
+    /**
+     * Field HEADER_EXPECT_100_Continue
+     */
+    public static final String HEADER_EXPECT_100_Continue = "100-continue";
+
+    /**
+     * Field HEADER_USER_AGENT
+     */
+    public static final String HEADER_USER_AGENT = "User-Agent";
+
+    /**
+     * Field HEADER_CACHE_CONTROL
+     */
+    public static final String HEADER_CACHE_CONTROL = "Cache-Control";
+
+    /**
+     * Field HEADER_CACHE_CONTROL_NOCACHE
+     */
+    public static final String HEADER_CACHE_CONTROL_NOCACHE = "no-cache";
+
+    /**
+     * Field HEADER_PRAGMA
+     */
+    public static final String HEADER_PRAGMA = "Pragma";
+
+    /**
+     * Field HEADER_LOCATION
+     */
+    public static final String HEADER_LOCATION = "Location";
+
+    /**
+     * Field REQUEST_HEADERS
+     */
+    public static final String REQUEST_HEADERS = "HTTP-Request-Headers";
+
+    /**
+     * Field RESPONSE_HEADERS
+     */
+    public static final String RESPONSE_HEADERS = "HTTP-Response-Headers";
+
+    /* http 1.1 */
+
+    /**
+     * Field HEADER_TRANSFER_ENCODING
+     */
+    public static final String HEADER_TRANSFER_ENCODING =
+            "Transfer-Encoding".intern();
+
+    /**
+     * Field HEADER_TRANSFER_ENCODING_CHUNKED
+     */
+    public static final String HEADER_TRANSFER_ENCODING_CHUNKED =
+            "chunked".intern();
+
+    /**
+     * Field HEADER_CONNECTION
+     */
+    public static final String HEADER_CONNECTION = "Connection";
+
+    /**
+     * Field HEADER_CONNECTION_CLOSE
+     */
+    public static final String HEADER_CONNECTION_CLOSE = "close".intern();
+
+    /**
+     * Field HEADER_CONNECTION_KEEPALIVE
+     */
+    public static final String HEADER_CONNECTION_KEEPALIVE =
+            "Keep-Alive".intern();    // The default don't send.
+
+    /**
+     * Field HEADER_ACCEPT
+     */
+    public static final String HEADER_ACCEPT = "Accept";
+
+    /**
+     * Field HEADER_ACCEPT_TEXT_ALL
+     */
+    public static final String HEADER_ACCEPT_TEXT_ALL = "text/*";
+
+    /**
+     * Field HEADER_ACCEPT_APPL_SOAP
+     */
+    public static final String HEADER_ACCEPT_APPL_SOAP = "application/soap+xml";
+
+    /**
+     * Field HEADER_ACCEPT_MULTIPART_RELATED
+     */
+    public static final String HEADER_ACCEPT_MULTIPART_RELATED =
+            "multipart/related";
+
+    /**
+     * Field HEADER_ACCEPT_APPLICATION_DIME
+     */
+    public static final String HEADER_ACCEPT_APPLICATION_DIME =
+            "application/dime";
+
+    /**
+     * Cookie headers
+     */
+    public static final String HEADER_COOKIE = "Cookie";
+
+    /**
+     * Field HEADER_COOKIE2
+     */
+    public static final String HEADER_COOKIE2 = "Cookie2";
+
+    /**
+     * Field HEADER_SET_COOKIE
+     */
+    public static final String HEADER_SET_COOKIE = "Set-Cookie";
+
+    /**
+     * Field HEADER_SET_COOKIE2
+     */
+    public static final String HEADER_SET_COOKIE2 = "Set-Cookie2";
+
+    /**
+     * Integer
+     */
+    public static String MC_HTTP_STATUS_CODE = "transport.http.statusCode";
+
+    /**
+     * String
+     */
+    public static String MC_HTTP_STATUS_MESSAGE =
+            "transport.http.statusMessage";
+
+    /**
+     * HttpServlet
+     */
+    public static String MC_HTTP_SERVLET = "transport.http.servlet";
+
+    /**
+     * HttpServletRequest
+     */
+    public static String MC_HTTP_SERVLETREQUEST =
+            "transport.http.servletRequest";
+
+    /**
+     * HttpServletResponse
+     */
+    public static String MC_HTTP_SERVLETRESPONSE =
+            "transport.http.servletResponse";
+
+    /**
+     * Field MC_HTTP_SERVLETLOCATION
+     */
+    public static String MC_HTTP_SERVLETLOCATION =
+            "transport.http.servletLocation";
+
+    /**
+     * Field MC_HTTP_SERVLETPATHINFO
+     */
+    public static String MC_HTTP_SERVLETPATHINFO =
+            "transport.http.servletPathInfo";
+
+    /**
+     * HTTP header field values
+     */
+    public static final String HEADER_DEFAULT_CHAR_ENCODING = "iso-8859-1";
+
+    /**
+     * AXIS servlet plugin parameter names.
+     */
+    public static final String PLUGIN_NAME = "transport.http.plugin.pluginName";
+
+    /**
+     * Field PLUGIN_SERVICE_NAME
+     */
+    public static final String PLUGIN_SERVICE_NAME =
+            "transport.http.plugin.serviceName";
+
+    /**
+     * Field PLUGIN_IS_DEVELOPMENT
+     */
+    public static final String PLUGIN_IS_DEVELOPMENT =
+            "transport.http.plugin.isDevelopment";
+
+    /**
+     * Field PLUGIN_ENABLE_LIST
+     */
+    public static final String PLUGIN_ENABLE_LIST =
+            "transport.http.plugin.enableList";
+
+    /**
+     * Field PLUGIN_ENGINE
+     */
+    public static final String PLUGIN_ENGINE = "transport.http.plugin.engine";
+
+    /**
+     * Field PLUGIN_WRITER
+     */
+    public static final String PLUGIN_WRITER = "transport.http.plugin.writer";
+
+    /**
+     * Field PLUGIN_LOG
+     */
+    public static final String PLUGIN_LOG = "transport.http.plugin.log";
+
+    /**
+     * Field PLUGIN_EXCEPTION_LOG
+     */
+    public static final String PLUGIN_EXCEPTION_LOG =
+            "transport.http.plugin.exceptionLog";
+
+    /**
+     * Field OK[]
+     */
+    public static final char OK[] = ("200 OK").toCharArray();
+
+    /**
+     * Field NOCONTENT[]
+     */
+    public static final byte NOCONTENT[] = ("202 OK\n\n").getBytes();
+
+    /**
+     * Field UNAUTH[]
+     */
+    public static final byte UNAUTH[] = ("401 Unauthorized").getBytes();
+
+    /**
+     * Field SENDER[]
+     */
+    public static final byte SENDER[] = "400".getBytes();
+
+    /**
+     * Field ISE[]
+     */
+    public static final byte ISE[] = ("500 Internal server error").getBytes();
+
+    // HTTP prefix
+
+    /**
+     * 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();
+    }
+
+
+}

Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPOutTransportInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message