You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/12/16 18:18:08 UTC

svn commit: r357187 [14/25] - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: ./ addressing/ client/ client/async/ context/ deployment/ deployment/listener/ deployment/repository/util/ deployment/scheduler/ deployment/util/ descript...

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AbstractHTTPSender.java Fri Dec 16 09:13:57 2005
@@ -1,9 +1,9 @@
 /*
- * Created on Nov 28, 2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
+* Created on Nov 28, 2005
+*
+* TODO To change the template for this generated file go to
+* Window - Preferences - Java - Code Style - Code Templates
+*/
 package org.apache.axis2.transport.http;
 
 import org.apache.axis2.AxisFault;
@@ -16,7 +16,15 @@
 import org.apache.axis2.om.OMAttribute;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMOutputFormat;
-import org.apache.commons.httpclient.*;
+import org.apache.commons.httpclient.Credentials;
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HeaderElement;
+import org.apache.commons.httpclient.HostConfiguration;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.NTCredentials;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
 import org.apache.commons.httpclient.auth.AuthScope;
 import org.apache.commons.httpclient.methods.RequestEntity;
 import org.apache.commons.logging.Log;
@@ -33,94 +41,22 @@
 import java.net.URL;
 import java.util.Iterator;
 
-
 public abstract class AbstractHTTPSender {
+    protected static final String ANONYMOUS = "anonymous";
+    protected static final String PROXY_HOST_NAME = "proxy_host";
+    protected static final String PROXY_PORT = "proxy_port";
     protected boolean chuncked = false;
-
     protected String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
-
     protected Log log = LogFactory.getLog(getClass().getName());
-
-    protected HttpClient httpClient;
-
     int soTimeout = HTTPConstants.DEFAULT_SO_TIMEOUT;
 
-    int connectionTimeout = HTTPConstants.DEFAULT_CONNECTION_TIMEOUT;
-
-    protected static final String ANONYMOUS = "anonymous";
-
-    protected OMOutputFormat format = new OMOutputFormat();
-
     /**
      * proxydiscription
      */
     protected TransportOutDescription proxyOutSetting = null;
-
-    protected static final String PROXY_HOST_NAME = "proxy_host";
-
-    protected static final String PROXY_PORT = "proxy_port";
-
-    public void setFormat(OMOutputFormat format) {
-        this.format = format;
-    }
-
-    public abstract void send(MessageContext msgContext,
-                              OMElement dataout, URL url,
-                              String soapActionString)
-            throws MalformedURLException, AxisFault, IOException;
-
-    /**
-     * This is used to get the dynamically set time out values from the
-     * message context. If the values are not available or invalid then
-     * teh default values or the values set by teh configuration will be used
-     *
-     * @param msgContext
-     */
-    protected void getTimeoutValues(MessageContext msgContext) {
-        try {
-            // If the SO_TIMEOUT of CONNECTION_TIMEOUT is set by dynamically the
-            // override the static config
-            Integer tempSoTimeoutProperty = (Integer) msgContext
-                    .getProperty(HTTPConstants.SO_TIMEOUT);
-            Integer tempConnTimeoutProperty = (Integer) msgContext
-                    .getProperty(HTTPConstants.CONNECTION_TIMEOUT);
-
-            if (tempSoTimeoutProperty != null) {
-                soTimeout = tempSoTimeoutProperty.intValue();
-            }
-
-            if (tempConnTimeoutProperty != null) {
-                connectionTimeout = tempConnTimeoutProperty.intValue();
-            }
-        } catch (NumberFormatException nfe) {
-            //If there's a problem log it and use the default values
-            log.error("Invalid timeout value format: not a number", nfe);
-        }
-    }
-
-    /**
-     * getting host configuration to support standard http/s, proxy and NTLM support
-     */
-    protected HostConfiguration getHostConfiguration(HttpClient client,
-                                                     MessageContext msgCtx,
-                                                     URL targetURL)
-            throws AxisFault {
-        boolean isHostProxy = isProxyListed(msgCtx); //list the proxy
-        int port = targetURL.getPort();
-        if (port == -1)
-            port = 80;
-        // to see the host is a proxy and in the proxy list - available in axis2.xml
-        HostConfiguration config = new HostConfiguration();
-
-        if (!isHostProxy) {
-            config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
-        } else {
-            //proxy and NTLM configuration
-            this.configProxyAuthentication(client, proxyOutSetting, config,
-                    msgCtx);
-        }
-        return config;
-    }
+    protected OMOutputFormat format = new OMOutputFormat();
+    int connectionTimeout = HTTPConstants.DEFAULT_CONNECTION_TIMEOUT;
+    protected HttpClient httpClient;
 
     /**
      * Helper method to Proxy and NTLM authentication
@@ -129,179 +65,241 @@
      * @param proxySetting
      * @param config
      */
-
     protected void configProxyAuthentication(HttpClient client,
-                                             TransportOutDescription proxySetting,
-                                             HostConfiguration config,
-                                             MessageContext msgCtx)
+                                             TransportOutDescription proxySetting, HostConfiguration config, MessageContext msgCtx)
             throws AxisFault {
         Parameter proxyParam = proxySetting.getParameter(HTTPConstants.PROXY);
         String usrName = null;
         String domain = null;
         String passwd = null;
         Credentials proxyCred = null;
-
         String proxyHostName = null;
         int proxyPort = -1;
+
         if (proxyParam != null) {
             String value = (String) proxyParam.getValue();
             String split[] = value.split(":");
 
-            //values being hard coded due best practise
+            // values being hard coded due best practise
             usrName = split[0];
             domain = split[1];
             passwd = split[2];
+
             //
 
             OMElement proxyParamElement = proxyParam.getParameterElement();
             Iterator ite = proxyParamElement.getAllAttributes();
+
             while (ite.hasNext()) {
                 OMAttribute att = (OMAttribute) ite.next();
+
                 if (att.getLocalName().equalsIgnoreCase(PROXY_HOST_NAME)) {
                     proxyHostName = att.getAttributeValue();
                 }
+
                 if (att.getLocalName().equalsIgnoreCase(PROXY_PORT)) {
                     proxyPort = Integer.parseInt(att.getAttributeValue());
                 }
             }
 
-
             if (domain.equals("") || domain.equals(ANONYMOUS)) {
                 if (usrName.equals(ANONYMOUS) && passwd.equals(ANONYMOUS)) {
                     proxyCred = new UsernamePasswordCredentials("", "");
                 } else {
-                    proxyCred = new UsernamePasswordCredentials(usrName,
-                            passwd); //proxy
+                    proxyCred = new UsernamePasswordCredentials(usrName, passwd);    // proxy
                 }
             } else {
-                proxyCred = new NTCredentials(usrName, passwd, proxyHostName,
-                        domain); //NTLM authentication with additionals prams
+                proxyCred = new NTCredentials(usrName, passwd, proxyHostName, domain);    // NTLM authentication with additionals prams
             }
         }
 
         HttpTransportProperties.ProxyProperties proxyProperties =
-                (HttpTransportProperties.ProxyProperties) msgCtx
-                        .getProperty(HTTPConstants.PROXY);
+                (HttpTransportProperties.ProxyProperties) msgCtx.getProperty(HTTPConstants.PROXY);
+
         if (proxyProperties != null) {
             if (proxyProperties.getProxyPort() != -1) {
                 proxyPort = proxyProperties.getProxyPort();
             }
+
             if (!proxyProperties.getProxyHostName().equals("")
-                    || proxyProperties.getProxyHostName() != null) {
+                    || (proxyProperties.getProxyHostName() != null)) {
                 proxyHostName = proxyProperties.getProxyHostName();
             } else {
                 throw new AxisFault("Proxy Name is not valid");
             }
+
             if (proxyProperties.getUserName().equals(ANONYMOUS)
                     || proxyProperties.getPassWord().equals(ANONYMOUS)) {
                 proxyCred = new UsernamePasswordCredentials("", "");
             }
         }
+
         client.getState().setProxyCredentials(AuthScope.ANY, proxyCred);
         config.setProxy(proxyHostName, proxyPort);
     }
 
-    private boolean isProxyListed(MessageContext msgCtx) throws AxisFault {
-        boolean returnValue = false;
-        Parameter par = null;
-        proxyOutSetting =
-                msgCtx.getConfigurationContext().getAxisConfiguration()
-                        .getTransportOut(new QName(Constants.TRANSPORT_HTTP));
-        if (proxyOutSetting != null) {
-            par = proxyOutSetting.getParameter(HTTPConstants.PROXY);
-        }
-        OMElement hostElement = null;
-        if (par != null) {
-            hostElement = par.getParameterElement();
-        }
-
-        if (hostElement != null) {
-            Iterator ite = hostElement.getAllAttributes();
-            while (ite.hasNext()) {
-                OMAttribute attribute = (OMAttribute) ite.next();
-                if (attribute.getLocalName().equalsIgnoreCase(PROXY_HOST_NAME))
-                {
-                    returnValue = true;
-                }
-            }
-        }
-
-        HttpTransportProperties.ProxyProperties proxyProperties;
-        if ((proxyProperties = (HttpTransportProperties.ProxyProperties) msgCtx
-                .getProperty(HTTPConstants.PROXY)) != null) {
-            if (proxyProperties.getProxyHostName() != null) {
-                returnValue = true;
-            }
-        }
-        return returnValue;
-    }
-
     /**
      * Collect the HTTP header information and set them in the message context
      *
      * @param method
      * @param msgContext
      */
-    protected void obatainHTTPHeaderInformation(HttpMethodBase method,
-                                                MessageContext msgContext) {
-        Header header = method
-                .getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+    protected 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);
-                OperationContext opContext = msgContext
-                        .getOperationContext();
+                NameValuePair charsetEnc =
+                        headers[i].getParameterByName(HTTPConstants.CHAR_SET_ENCODING);
+                OperationContext opContext = msgContext.getOperationContext();
+
                 if (headers[i].getName().equalsIgnoreCase(
                         HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED)) {
                     if (opContext != null) {
-                        opContext.setProperty(
-                                HTTPConstants.MTOM_RECIVED_CONTENT_TYPE, header
-                                .getValue());
+                        opContext.setProperty(HTTPConstants.MTOM_RECIVED_CONTENT_TYPE,
+                                header.getValue());
                     }
                 } else if (charsetEnc != null) {
-
-                    opContext.setProperty(
-                            MessageContext.CHARACTER_SET_ENCODING, charsetEnc
-                            .getValue()); //change to the value, which is text/xml or application/xml+soap
+                    opContext.setProperty(MessageContext.CHARACTER_SET_ENCODING,
+                            charsetEnc.getValue());    // change to the value, which is text/xml or application/xml+soap
                 }
             }
         }
     }
 
-    protected void processResponse(HttpMethodBase httpMethod,
-                                   MessageContext msgContext)
+    protected 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"));
+            throw new AxisFault(Messages.getMessage("canNotBeNull", "InputStream"));
         }
-        msgContext.getOperationContext().setProperty(
-                MessageContext.TRANSPORT_IN, in);
+
+        msgContext.getOperationContext().setProperty(MessageContext.TRANSPORT_IN, in);
     }
 
-    public class AxisRequestEntity implements RequestEntity {
+    public abstract void send(MessageContext msgContext, OMElement dataout, URL url,
+                              String soapActionString)
+            throws MalformedURLException, AxisFault, IOException;
 
-        private String charSetEnc;
+    /**
+     * getting host configuration to support standard http/s, proxy and NTLM support
+     */
+    protected HostConfiguration getHostConfiguration(HttpClient client, MessageContext msgCtx,
+                                                     URL targetURL)
+            throws AxisFault {
+        boolean isHostProxy = isProxyListed(msgCtx);    // list the proxy
+        int port = targetURL.getPort();
 
-        private OMElement element;
+        if (port == -1) {
+            port = 80;
+        }
 
-        private boolean chuncked;
+        // to see the host is a proxy and in the proxy list - available in axis2.xml
+        HostConfiguration config = new HostConfiguration();
 
-        private byte[] bytes;
+        if (!isHostProxy) {
+            config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
+        } else {
 
-        private boolean doingMTOM = false;
+            // proxy and NTLM configuration
+            this.configProxyAuthentication(client, proxyOutSetting, config, msgCtx);
+        }
 
-        private String soapActionString;
+        return config;
+    }
+
+    /**
+     * This is used to get the dynamically set time out values from the
+     * message context. If the values are not available or invalid then
+     * teh default values or the values set by teh configuration will be used
+     *
+     * @param msgContext
+     */
+    protected void getTimeoutValues(MessageContext msgContext) {
+        try {
+
+            // If the SO_TIMEOUT of CONNECTION_TIMEOUT is set by dynamically the
+            // override the static config
+            Integer tempSoTimeoutProperty =
+                    (Integer) msgContext.getProperty(HTTPConstants.SO_TIMEOUT);
+            Integer tempConnTimeoutProperty =
+                    (Integer) msgContext.getProperty(HTTPConstants.CONNECTION_TIMEOUT);
+
+            if (tempSoTimeoutProperty != null) {
+                soTimeout = tempSoTimeoutProperty.intValue();
+            }
+
+            if (tempConnTimeoutProperty != null) {
+                connectionTimeout = tempConnTimeoutProperty.intValue();
+            }
+        } catch (NumberFormatException nfe) {
+
+            // If there's a problem log it and use the default values
+            log.error("Invalid timeout value format: not a number", nfe);
+        }
+    }
+
+    private boolean isProxyListed(MessageContext msgCtx) throws AxisFault {
+        boolean returnValue = false;
+        Parameter par = null;
+
+        proxyOutSetting = msgCtx.getConfigurationContext().getAxisConfiguration().getTransportOut(
+                new QName(Constants.TRANSPORT_HTTP));
 
+        if (proxyOutSetting != null) {
+            par = proxyOutSetting.getParameter(HTTPConstants.PROXY);
+        }
+
+        OMElement hostElement = null;
+
+        if (par != null) {
+            hostElement = par.getParameterElement();
+        }
+
+        if (hostElement != null) {
+            Iterator ite = hostElement.getAllAttributes();
+
+            while (ite.hasNext()) {
+                OMAttribute attribute = (OMAttribute) ite.next();
+
+                if (attribute.getLocalName().equalsIgnoreCase(PROXY_HOST_NAME)) {
+                    returnValue = true;
+                }
+            }
+        }
+
+        HttpTransportProperties.ProxyProperties proxyProperties;
+
+        if ((proxyProperties = (HttpTransportProperties.ProxyProperties) msgCtx.getProperty(
+                HTTPConstants.PROXY)) != null) {
+            if (proxyProperties.getProxyHostName() != null) {
+                returnValue = true;
+            }
+        }
+
+        return returnValue;
+    }
+
+    public void setFormat(OMOutputFormat format) {
+        this.format = format;
+    }
+
+    public class AxisRequestEntity implements RequestEntity {
+        private boolean doingMTOM = false;
+        private byte[] bytes;
+        private String charSetEnc;
+        private boolean chuncked;
+        private OMElement element;
         private MessageContext msgCtxt;
+        private String soapActionString;
 
-        public AxisRequestEntity(OMElement element, boolean chuncked,
-                                 MessageContext msgCtxt, String charSetEncoding,
-                                 String soapActionString) {
+        public AxisRequestEntity(OMElement element, boolean chuncked, MessageContext msgCtxt,
+                                 String charSetEncoding, String soapActionString) {
             this.element = element;
             this.chuncked = chuncked;
             this.msgCtxt = msgCtxt;
@@ -310,8 +308,9 @@
             this.soapActionString = soapActionString;
         }
 
-        public boolean isRepeatable() {
-            return true;
+        private void handleOMOutput(OutputStream out, boolean doingMTOM) throws XMLStreamException {
+            format.setDoOptimize(doingMTOM);
+            element.serializeAndConsume(out, format);
         }
 
         public byte[] writeBytes() throws AxisFault {
@@ -320,14 +319,16 @@
 
                 if (!doingMTOM) {
                     OMOutputFormat format2 = new OMOutputFormat();
+
                     format2.setCharSetEncoding(charSetEnc);
                     element.serializeAndConsume(bytesOut, format2);
-                    return bytesOut.toByteArray();
 
+                    return bytesOut.toByteArray();
                 } else {
                     format.setCharSetEncoding(charSetEnc);
                     format.setDoOptimize(true);
                     element.serializeAndConsume(bytesOut, format);
+
                     return bytesOut.toByteArray();
                 }
             } catch (XMLStreamException e) {
@@ -337,24 +338,18 @@
             }
         }
 
-        private void handleOMOutput(OutputStream out, boolean doingMTOM)
-                throws XMLStreamException {
-            format.setDoOptimize(doingMTOM);
-            element.serializeAndConsume(out, format);
-        }
-
         public void writeRequest(OutputStream out) throws IOException {
             try {
-                if (doingMTOM) { //chagened ..
+                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);
@@ -362,9 +357,11 @@
                         if (bytes == null) {
                             bytes = writeBytes();
                         }
+
                         out.write(bytes);
                     }
                 }
+
                 out.flush();
             } catch (XMLStreamException e) {
                 throw new AxisFault(e);
@@ -377,13 +374,14 @@
 
         public long getContentLength() {
             try {
-                if (doingMTOM) { //chagened
+                if (doingMTOM) {    // chagened
                     if (chuncked) {
                         return -1;
                     } else {
                         if (bytes == null) {
                             bytes = writeBytes();
                         }
+
                         return bytes.length;
                     }
                 } else {
@@ -393,6 +391,7 @@
                         if (bytes == null) {
                             bytes = writeBytes();
                         }
+
                         return bytes.length;
                     }
                 }
@@ -404,17 +403,22 @@
         public String getContentType() {
             String encoding = format.getCharSetEncoding();
             String contentType = format.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
+            if (!msgCtxt.isSOAP11() && (soapActionString != null)
                     && !"".equals(soapActionString.trim())) {
-                contentType = contentType + ";action=\"" + soapActionString
-                        + "\";";
+                contentType = contentType + ";action=\"" + soapActionString + "\";";
             }
+
             return contentType;
         }
+
+        public boolean isRepeatable() {
+            return true;
+        }
     }
-}
\ No newline at end of file
+}

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
 /*
- * 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.
- */
+* 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;
 
@@ -42,33 +43,32 @@
  * Class AxisServlet
  */
 public class AxisServlet extends HttpServlet {
-    private ListingAgent lister;
     private static final String CONFIGURATION_CONTEXT = "CONFIGURATION_CONTEXT";
-    private ConfigurationContext configContext;
     public static final String SESSION_ID = "SessionId";
-    /**
-     * Method init
-     *
-     * @param config
-     * @throws ServletException
-     */
-    public void init(ServletConfig config) throws ServletException {
-        try {
-            ServletContext context = config.getServletContext();
-            String repoDir = context.getRealPath("/WEB-INF");
-            ConfigurationContextFactory erfac =
-                    new ConfigurationContextFactory();
-            configContext =
-                    erfac.buildConfigurationContext(repoDir);
-            configContext.setProperty(Constants.CONTAINER_MANAGED,
-                    Constants.VALUE_TRUE);
-            configContext.setRootDir(new File(context.getRealPath("/WEB-INF")));
-            lister = new ListingAgent(configContext);
-            context.setAttribute(CONFIGURATION_CONTEXT, configContext);
-//            servletContext = getServletContext();
-        } catch (Exception e) {
-            throw new ServletException(e);
-        }
+    private ConfigurationContext configContext;
+    private ListingAgent lister;
+
+    private MessageContext createAndSetInitialParamsToMsgCtxt(Object sessionContext,
+                                                              MessageContext msgContext, HttpServletResponse httpServletResponse,
+                                                              HttpServletRequest httpServletRequest)
+            throws AxisFault {
+        msgContext =
+                new MessageContext(configContext, (SessionContext) sessionContext,
+                        configContext.getAxisConfiguration()
+                                .getTransportIn(new QName(Constants
+                                .TRANSPORT_HTTP)), configContext.getAxisConfiguration()
+                        .getTransportOut(new QName(Constants.TRANSPORT_HTTP)));
+        msgContext.setProperty(Constants.OUT_TRANSPORT_INFO,
+                new ServletBasedOutTransportInfo(httpServletResponse));
+        msgContext.setProperty(MessageContext.TRANSPORT_HEADERS,
+                getTransportHeaders(httpServletRequest));
+        msgContext.setProperty(SESSION_ID, httpServletRequest.getSession().getId());
+
+        return msgContext;
+    }
+
+    public void destroy() {
+        super.destroy();
     }
 
     /**
@@ -82,27 +82,26 @@
     protected void doGet(HttpServletRequest httpServletRequest,
                          HttpServletResponse httpServletResponse)
             throws ServletException, IOException {
-
         MessageContext msgContext = null;
         OutputStream out = null;
+
         try {
             Object sessionContext = getSessionContext(httpServletRequest);
             HashMap map = getHTTPParameters(httpServletRequest);
+
             msgContext = createAndSetInitialParamsToMsgCtxt(sessionContext, msgContext,
                     httpServletResponse, httpServletRequest);
-
             msgContext.setDoingREST(true);
             msgContext.setServerSide(true);
             out = httpServletResponse.getOutputStream();
-            boolean processed =
-                    HTTPTransportUtils.processHTTPGetRequest(msgContext,
-                            httpServletRequest.getInputStream(),
-                            out,
-                            httpServletRequest.getContentType(),
-                            httpServletRequest.getHeader(HTTPConstants.HEADER_SOAP_ACTION),
-                            httpServletRequest.getRequestURL().toString(),
-                            configContext,
-                            map);
+
+            boolean processed = HTTPTransportUtils.processHTTPGetRequest(msgContext,
+                    httpServletRequest.getInputStream(), out,
+                    httpServletRequest.getContentType(),
+                    httpServletRequest.getHeader(HTTPConstants.HEADER_SOAP_ACTION),
+                    httpServletRequest.getRequestURL().toString(), configContext,
+                    map);
+
             if (!processed) {
                 lister.handle(httpServletRequest, httpServletResponse, out);
             }
@@ -115,49 +114,12 @@
         } catch (Exception e) {
             throw new ServletException(e);
         }
-
-    }
-
-    private MessageContext createAndSetInitialParamsToMsgCtxt(Object sessionContext, MessageContext msgContext, HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest) throws AxisFault {
-        msgContext =
-                new MessageContext(configContext,
-                        (SessionContext) sessionContext,
-                        configContext.getAxisConfiguration().getTransportIn(new QName(Constants.TRANSPORT_HTTP)),
-                        configContext.getAxisConfiguration().getTransportOut(new QName(Constants.TRANSPORT_HTTP)));
-        msgContext.setProperty(Constants.OUT_TRANSPORT_INFO,
-                new ServletBasedOutTransportInfo(httpServletResponse));
-        msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, getTransportHeaders(httpServletRequest));
-        msgContext.setProperty(SESSION_ID, httpServletRequest.getSession().getId());
-        return msgContext;
-    }
-
-    private HashMap getHTTPParameters(HttpServletRequest httpServletRequest) {
-        HashMap map = new HashMap();
-        Enumeration enu = httpServletRequest.getParameterNames();
-        while (enu.hasMoreElements()) {
-            String name = (String) enu.nextElement();
-            String value = httpServletRequest.getParameter(name);
-            map.put(name, value);
-        }
-
-        return map;
-    }
-
-    private Object getSessionContext(HttpServletRequest httpServletRequest) {
-        Object sessionContext =
-                httpServletRequest.getSession().getAttribute(Constants.SESSION_CONTEXT_PROPERTY);
-        if (sessionContext == null) {
-            sessionContext = new SessionContext(null);
-            httpServletRequest.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY,
-                    sessionContext);
-        }
-        return sessionContext;
     }
 
     /*
-    * (non-Javadoc)
-    * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
-    */
+     * (non-Javadoc)
+     * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
 
     /**
      * Method doPost
@@ -171,31 +133,27 @@
             throws ServletException, IOException {
         MessageContext msgContext = null;
         OutputStream out = null;
+
         try {
             Object sessionContext = getSessionContext(req);
+
             msgContext = createAndSetInitialParamsToMsgCtxt(sessionContext, msgContext, res, req);
-            //adding ServletContext into msgContext;
-            msgContext.setProperty(Constants.SERVLET_CONTEXT,sessionContext);
 
+            // adding ServletContext into msgContext;
+            msgContext.setProperty(Constants.SERVLET_CONTEXT, sessionContext);
             out = res.getOutputStream();
-            HTTPTransportUtils.processHTTPPostRequest(msgContext,
-                    req.getInputStream(),
-                    out,
-                    req.getContentType(),
-                    req.getHeader(HTTPConstants.HEADER_SOAP_ACTION),
-                    req.getRequestURL().toString()
-            );
+            HTTPTransportUtils.processHTTPPostRequest(msgContext, req.getInputStream(), out,
+                    req.getContentType(), req.getHeader(HTTPConstants.HEADER_SOAP_ACTION),
+                    req.getRequestURL().toString());
 
             Object contextWritten =
                     msgContext.getOperationContext().getProperty(Constants.RESPONSE_WRITTEN);
 
-            //Getting the 
-            res.setContentType("text/xml; charset=" +
-                    msgContext
-                            .getProperty(MessageContext.CHARACTER_SET_ENCODING));
+            // Getting the
+            res.setContentType("text/xml; charset="
+                    + msgContext.getProperty(MessageContext.CHARACTER_SET_ENCODING));
 
-            if (contextWritten == null
-                    || !Constants.VALUE_TRUE.equals(contextWritten)) {
+            if ((contextWritten == null) || !Constants.VALUE_TRUE.equals(contextWritten)) {
                 res.setStatus(HttpServletResponse.SC_ACCEPTED);
             }
         } catch (AxisFault e) {
@@ -208,27 +166,78 @@
         }
     }
 
-    private void handleFault(MessageContext msgContext, OutputStream out, AxisFault e) throws AxisFault {
-        msgContext.setProperty(MessageContext.TRANSPORT_OUT,out);
+    private void handleFault(MessageContext msgContext, OutputStream out, AxisFault e)
+            throws AxisFault {
+        msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
+
         AxisEngine engine = new AxisEngine(configContext);
-        MessageContext faultContext =
-                engine.createFaultMessageContext(msgContext, e);
+        MessageContext faultContext = engine.createFaultMessageContext(msgContext, e);
+
         engine.sendFault(faultContext);
     }
 
+    /**
+     * Method init
+     *
+     * @param config
+     * @throws ServletException
+     */
+    public void init(ServletConfig config) throws ServletException {
+        try {
+            ServletContext context = config.getServletContext();
+            String repoDir = context.getRealPath("/WEB-INF");
+            ConfigurationContextFactory erfac = new ConfigurationContextFactory();
+
+            configContext = erfac.buildConfigurationContext(repoDir);
+            configContext.setProperty(Constants.CONTAINER_MANAGED, Constants.VALUE_TRUE);
+            configContext.setRootDir(new File(context.getRealPath("/WEB-INF")));
+            lister = new ListingAgent(configContext);
+            context.setAttribute(CONFIGURATION_CONTEXT, configContext);
+
+//          servletContext = getServletContext();
+        } catch (Exception e) {
+            throw new ServletException(e);
+        }
+    }
+
+    private HashMap getHTTPParameters(HttpServletRequest httpServletRequest) {
+        HashMap map = new HashMap();
+        Enumeration enu = httpServletRequest.getParameterNames();
+
+        while (enu.hasMoreElements()) {
+            String name = (String) enu.nextElement();
+            String value = httpServletRequest.getParameter(name);
+
+            map.put(name, value);
+        }
+
+        return map;
+    }
+
+    private Object getSessionContext(HttpServletRequest httpServletRequest) {
+        Object sessionContext =
+                httpServletRequest.getSession().getAttribute(Constants.SESSION_CONTEXT_PROPERTY);
+
+        if (sessionContext == null) {
+            sessionContext = new SessionContext(null);
+            httpServletRequest.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY,
+                    sessionContext);
+        }
+
+        return sessionContext;
+    }
+
     private Map getTransportHeaders(HttpServletRequest req) {
         HashMap headerMap = new HashMap();
         Enumeration headerNames = req.getHeaderNames();
+
         while (headerNames.hasMoreElements()) {
             String key = (String) headerNames.nextElement();
             String value = req.getHeader(key);
+
             headerMap.put(key, value);
         }
-        return headerMap;
-    }
 
-    public void destroy() {
-        super.destroy();
+        return headerMap;
     }
-
 }

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=357187&r1=357186&r2=357187&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 Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
 /*
- * 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.
- */
+* 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;
 
@@ -45,91 +46,136 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 
-public class CommonsHTTPTransportSender extends AbstractHandler implements
-        TransportSender {
+public class CommonsHTTPTransportSender extends AbstractHandler implements TransportSender {
+    protected static final String PROXY_HOST_NAME = "proxy_host";
+    protected static final String PROXY_PORT = "proxy_port";
+    public static final String HTTP_METHOD = "HTTP_METHOD";
+    private static final String ANONYMOUS = "anonymous";
     private boolean chuncked = false;
-
     int soTimeout = HTTPConstants.DEFAULT_SO_TIMEOUT;
 
+    /**
+     * proxydiscription
+     */
+    protected TransportOutDescription proxyOutSetting = null;
+    protected Log log = LogFactory.getLog(getClass().getName());
+    protected String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
+    protected OMOutputFormat format = new OMOutputFormat();
     int connectionTimeout = HTTPConstants.DEFAULT_CONNECTION_TIMEOUT;
-
     protected HttpClient httpClient;
-
     protected OMElement outputMessage;
 
-    protected OMOutputFormat format = new OMOutputFormat();
+    public CommonsHTTPTransportSender() {
+    }    // default
 
-    /**
-     * proxydiscription
-     */
-    protected TransportOutDescription proxyOutSetting = null;
+    public void cleanUp(MessageContext msgContext) throws AxisFault {
+        HttpMethod httpMethod = (HttpMethod) msgContext.getProperty(HTTP_METHOD);
 
-    protected static final String PROXY_HOST_NAME = "proxy_host";
+        if (httpMethod != null) {
+            httpMethod.releaseConnection();
+        }
+    }
 
-    protected static final String PROXY_PORT = "proxy_port";
+    public void init(ConfigurationContext confContext, TransportOutDescription transportOut)
+            throws AxisFault {
 
-    protected String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
+        // <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);
 
-    protected Log log = LogFactory.getLog(getClass().getName());
+        if (version != null) {
+            if (HTTPConstants.HEADER_PROTOCOL_11.equals(version.getValue())) {
+                httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
 
-    private static final String ANONYMOUS = "anonymous";
+                Parameter transferEncoding =
+                        transportOut.getParameter(HTTPConstants.HEADER_TRANSFER_ENCODING);
 
-    public static final String HTTP_METHOD = "HTTP_METHOD";
+                if ((transferEncoding != null)
+                        && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(
+                        transferEncoding.getValue())) {
+                    this.chuncked = true;
+                }
+            } else if (HTTPConstants.HEADER_PROTOCOL_10.equals(version.getValue())) {
+                httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
+            } else {
+                throw new AxisFault("Parameter " + HTTPConstants.PROTOCOL_VERSION
+                        + " Can have values only HTTP/1.0 or HTTP/1.1");
+            }
+        }
 
-    public CommonsHTTPTransportSender() {
-    } //default
+        // Get the timeout values from the configuration
+        try {
+            Parameter tempSoTimeoutParam = transportOut.getParameter(HTTPConstants.SO_TIMEOUT);
+            Parameter tempConnTimeoutParam =
+                    transportOut.getParameter(HTTPConstants.CONNECTION_TIMEOUT);
+
+            if (tempSoTimeoutParam != null) {
+                soTimeout = Integer.parseInt((String) tempSoTimeoutParam.getValue());
+            }
+
+            if (tempConnTimeoutParam != null) {
+                connectionTimeout = Integer.parseInt((String) tempConnTimeoutParam.getValue());
+            }
+        } catch (NumberFormatException nfe) {
+
+            // If there's a problem log it and use the default values
+            log.error("Invalid timeout value format: not a number", nfe);
+        }
+    }
 
     public synchronized void invoke(MessageContext msgContext) throws AxisFault {
         try {
             String charSetEnc =
-                    (String) msgContext.getProperty(
-                            MessageContext.CHARACTER_SET_ENCODING);
+                    (String) msgContext.getProperty(MessageContext.CHARACTER_SET_ENCODING);
+
             if (charSetEnc != null) {
                 format.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));
             msgContext.setDoingREST(HTTPTransportUtils.isDoingREST(msgContext));
             format.setSOAP11(msgContext.isSOAP11());
             format.setDoOptimize(msgContext.isDoingMTOM());
-
             format.setCharSetEncoding(charSetEnc);
 
             // Trasnport URL can be different from the WSA-To. So processing
             // that now.
             EndpointReference epr = null;
-            String transportURL = (String) msgContext.getProperty(MessageContextConstants.TRANSPORT_URL);
+            String transportURL =
+                    (String) msgContext.getProperty(MessageContextConstants.TRANSPORT_URL);
+
             if (transportURL != null) {
                 epr = new EndpointReference(transportURL);
-            } else if (msgContext.getTo() != null
-                    && !AddressingConstants.Submission.WSA_ANONYMOUS_URL.equals(
-                    msgContext.getTo().getAddress())
-                    && !AddressingConstants.Final.WSA_ANONYMOUS_URL.equals(
-                    msgContext.getTo().getAddress())) {
-
+            } else 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();
             }
 
-            //Check for the REST behaviour, if you desire rest beahaviour
-            //put a <parameter name="doREST" value="true"/> at the
+            // Check for the REST behaviour, if you desire rest beahaviour
+            // put a <parameter name="doREST" value="true"/> at the
             // server.xml/client.xml file
-
             // ######################################################
-            //Change this place to change the wsa:toepr
-            //epr = something
+            // Change this place to change the wsa:toepr
+            // epr = something
             // ######################################################
-
             OMElement dataOut;
+
             /**
              * Figuringout the REST properties/parameters
              */
@@ -139,33 +185,39 @@
                 dataOut = msgContext.getEnvelope();
             }
 
-            //TODO timeout, configuration
+            // TODO timeout, configuration
             if (epr != null) {
                 writeMessageWithCommons(msgContext, epr, dataOut);
             } else {
                 OutputStream out =
-                        (OutputStream) msgContext.getProperty(
-                                MessageContext.TRANSPORT_OUT);
+                        (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);
+
                 if (msgContext.isServerSide()) {
                     OutTransportInfo transportInfo =
-                            (OutTransportInfo) msgContext.getProperty(
-                                    Constants.OUT_TRANSPORT_INFO);
+                            (OutTransportInfo) msgContext.getProperty(Constants.OUT_TRANSPORT_INFO);
+
                     if (transportInfo != null) {
                         boolean soap11 = msgContext.isSOAP11();
+
                         format.setSOAP11(soap11);
+
                         String contentType = format.getContentType();
-                        String encoding = contentType + "; charset=" + format.getCharSetEncoding();
+                        String encoding = contentType + "; charset="
+                                + format.getCharSetEncoding();
+
                         transportInfo.setContentType(encoding);
                     } else {
                         throw new AxisFault(Constants.OUT_TRANSPORT_INFO + " has not been set");
                     }
                 }
+
                 format.setDoOptimize(msgContext.isDoingMTOM());
-                ((OMNodeEx)dataOut).serializeAndConsume(out, format);
+                ((OMNodeEx) dataOut).serializeAndConsume(out, format);
             }
+
             if (msgContext.getOperationContext() != null) {
-                msgContext.getOperationContext().setProperty(
-                        Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
+                msgContext.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN,
+                        Constants.VALUE_TRUE);
             }
         } catch (XMLStreamException e) {
             throw new AxisFault(e);
@@ -176,25 +228,24 @@
         }
     }
 
-    public void writeMessageWithToOutPutStream(MessageContext msgContext,
-                                               OutputStream out) {
-    }
-
-    public void writeMessageWithCommons(MessageContext msgContext,
-                                        EndpointReference toURL, OMElement dataout) throws AxisFault {
+    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) {
+
+            if ((soapActionString == null) || (soapActionString.length() == 0)) {
                 soapActionString = msgContext.getWSAAction();
             }
+
             if (soapActionString == null) {
                 soapActionString = "";
             }
 
-            //select the Message Sender depending on the REST status
+            // select the Message Sender depending on the REST status
             AbstractHTTPSender sender = null;
+
             if (!msgContext.isDoingREST()) {
                 sender = new SOAPOverHTTPSender();
             } else {
@@ -202,9 +253,7 @@
             }
 
             sender.setFormat(this.format);
-            sender.send(msgContext, dataout, url,
-                    soapActionString);
-
+            sender.send(msgContext, dataout, url, soapActionString);
         } catch (MalformedURLException e) {
             throw new AxisFault(e);
         } catch (HttpException e) {
@@ -214,62 +263,6 @@
         }
     }
 
-    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())) {
-                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())) {
-                httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
-            } else {
-                throw new AxisFault("Parameter "
-                        + HTTPConstants.PROTOCOL_VERSION
-                        + " Can have values only HTTP/1.0 or HTTP/1.1");
-            }
-        }
-
-        //Get the timeout values from the configuration
-        try {
-            Parameter tempSoTimeoutParam = transportOut
-                    .getParameter(HTTPConstants.SO_TIMEOUT);
-            Parameter tempConnTimeoutParam = transportOut
-                    .getParameter(HTTPConstants.CONNECTION_TIMEOUT);
-
-            if (tempSoTimeoutParam != null) {
-                soTimeout = Integer.parseInt((String) tempSoTimeoutParam
-                        .getValue());
-            }
-
-            if (tempConnTimeoutParam != null) {
-                connectionTimeout = Integer
-                        .parseInt((String) tempConnTimeoutParam.getValue());
-            }
-
-        } catch (NumberFormatException nfe) {
-            //If there's a problem log it and use the default values
-            log.error("Invalid timeout value format: not a number", nfe);
-        }
-
+    public void writeMessageWithToOutPutStream(MessageContext msgContext, OutputStream out) {
     }
 }

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=357187&r1=357186&r2=357187&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 Fri Dec 16 09:13:57 2005
@@ -1,18 +1,18 @@
 /*
- * 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.
- */
+* 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;
@@ -23,20 +23,17 @@
  * HTTP protocol and message context constants.
  */
 public class HTTPConstants {
-
     public static final String HTTP_CONTENT_TYPE = "HTTP_CONTENT_TYPE";
-
     public static final String PROTOCOL_VERSION = "PROTOCOL";
-
-    public static final String MEDIA_TYPE_APPLICATION_XML = "application/xml";
+    public static final String MEDIA_TYPE_X_WWW_FORM =
+            "application/x-www-form-urlencoded";
     public static final String MEDIA_TYPE_TEXT_XML = "text/xml";
     public static final String MEDIA_TYPE_MULTIPART_RELATED = "multipart/related";
-    public static final String MEDIA_TYPE_X_WWW_FORM = "application/x-www-form-urlencoded";
+    public static final String MEDIA_TYPE_APPLICATION_XML = "application/xml";
     public static final String MEDIA_TYPE_APPLICATION_SOAP_XML = "application/soap+xml";
 
-    //public static final String HTTP_GET = "HTTP_GET";
-    //public static final String HTTP_POST = "HTTP_POST";
-
+    // public static final String HTTP_GET = "HTTP_GET";
+    // public static final String HTTP_POST = "HTTP_POST";
 
     /**
      * Field REQUEST_URI
@@ -64,107 +61,99 @@
     public static final String SOCKET = "SOCKET";
 
     /**
-     * Field HEADER_PROTOCOL_10
-     */
-    public static final String HEADER_PROTOCOL_10 = "HTTP/1.0";
-
-    /**
-     * Field HEADER_PROTOCOL_11
+     * Field RESPONSE_HEADERS
      */
-    public static final String HEADER_PROTOCOL_11 = "HTTP/1.1";
+    public static final String RESPONSE_HEADERS = "HTTP-Response-Headers";
 
     /**
-     * Field HEADER_PROTOCOL_V10
+     * Field REQUEST_HEADERS
      */
-    public static final String HEADER_PROTOCOL_V10 = "1.0".intern();
+    public static final String REQUEST_HEADERS = "HTTP-Request-Headers";
 
     /**
-     * Field HEADER_PROTOCOL_V11
+     * Field PLUGIN_WRITER
      */
-    public static final String HEADER_PROTOCOL_V11 = "1.1".intern();
+    public static final String PLUGIN_WRITER = "transport.http.plugin.writer";
 
     /**
-     * Field CHAR_SET_ENCODING
+     * Field PLUGIN_SERVICE_NAME
      */
-    public static String CHAR_SET_ENCODING = "charset";
+    public static final String PLUGIN_SERVICE_NAME = "transport.http.plugin.serviceName";
 
     /**
-     * Field HEADER_POST
+     * AXIS servlet plugin parameter names.
      */
-    public static final String HEADER_POST = "POST";
+    public static final String PLUGIN_NAME = "transport.http.plugin.pluginName";
 
     /**
-     * Field HEADER_GET
+     * Field PLUGIN_LOG
      */
-    public static final String HEADER_GET = "GET";
+    public static final String PLUGIN_LOG = "transport.http.plugin.log";
 
     /**
-     * Field HEADER_HOST
+     * Field PLUGIN_IS_DEVELOPMENT
      */
-    public static final String HEADER_HOST = "Host";
+    public static final String PLUGIN_IS_DEVELOPMENT = "transport.http.plugin.isDevelopment";
 
     /**
-     * Field HEADER_CONTENT_DESCRIPTION
+     * Field PLUGIN_EXCEPTION_LOG
      */
-    public static final String HEADER_CONTENT_DESCRIPTION =
-            "Content-Description";
+    public static final String PLUGIN_EXCEPTION_LOG = "transport.http.plugin.exceptionLog";
 
     /**
-     * Field HEADER_CONTENT_TYPE
+     * Field PLUGIN_ENGINE
      */
-    public static final String HEADER_CONTENT_TYPE = "Content-Type";
+    public static final String PLUGIN_ENGINE = "transport.http.plugin.engine";
 
     /**
-     * Field HEADER_CONTENT_TRANSFER_ENCODING
+     * Field PLUGIN_ENABLE_LIST
      */
-    public static final String HEADER_CONTENT_TRANSFER_ENCODING =
-            "Content-Transfer-Encoding";
+    public static final String PLUGIN_ENABLE_LIST = "transport.http.plugin.enableList";
 
     /**
-     * Field HEADER_CONTENT_TYPE_JMS
+     * Field OK[]
      */
-    public static final String HEADER_CONTENT_TYPE_JMS = "ContentType";
+    public static final char OK[] = ("200 OK").toCharArray();
 
     /**
-     * Field HEADER_CONTENT_LENGTH
+     * Field NOCONTENT[]
      */
-    public static final String HEADER_CONTENT_LENGTH = "Content-Length";
+    public static final byte NOCONTENT[] = ("202 OK\n\n").getBytes();
 
     /**
-     * Field HEADER_CONTENT_LOCATION
+     * String
      */
-    public static final String HEADER_CONTENT_LOCATION = "Content-Location";
+    public static String MC_HTTP_STATUS_MESSAGE = "transport.http.statusMessage";
 
     /**
-     * Field HEADER_CONTENT_ID
+     * Integer
      */
-    public static final String HEADER_CONTENT_ID = "Content-Id";
+    public static String MC_HTTP_STATUS_CODE = "transport.http.statusCode";
 
     /**
-     * Field HEADER_SOAP_ACTION
+     * HttpServletResponse
      */
-    public static final String HEADER_SOAP_ACTION = "SOAPAction";
+    public static String MC_HTTP_SERVLETRESPONSE = "transport.http.servletResponse";
 
     /**
-     * Field HEADER_AUTHORIZATION
+     * HttpServletRequest
      */
-    public static final String HEADER_AUTHORIZATION = "Authorization";
+    public static String MC_HTTP_SERVLETREQUEST = "transport.http.servletRequest";
 
     /**
-     * Field HEADER_PROXY_AUTHORIZATION
+     * Field MC_HTTP_SERVLETPATHINFO
      */
-    public static final String HEADER_PROXY_AUTHORIZATION =
-            "Proxy-Authorization";
+    public static String MC_HTTP_SERVLETPATHINFO = "transport.http.servletPathInfo";
 
     /**
-     * Field HEADER_EXPECT
+     * Field MC_HTTP_SERVLETLOCATION
      */
-    public static final String HEADER_EXPECT = "Expect";
+    public static String MC_HTTP_SERVLETLOCATION = "transport.http.servletLocation";
 
     /**
-     * Field HEADER_EXPECT_100_Continue
+     * HttpServlet
      */
-    public static final String HEADER_EXPECT_100_Continue = "100-continue";
+    public static String MC_HTTP_SERVLET = "transport.http.servlet";
 
     /**
      * Field HEADER_USER_AGENT
@@ -172,96 +161,96 @@
     public static final String HEADER_USER_AGENT = "User-Agent";
 
     /**
-     * Field HEADER_CACHE_CONTROL
+     * Field HEADER_TRANSFER_ENCODING_CHUNKED
      */
-    public static final String HEADER_CACHE_CONTROL = "Cache-Control";
+    public static final String HEADER_TRANSFER_ENCODING_CHUNKED = "chunked".intern();
+
+    /* http 1.1 */
 
     /**
-     * Field HEADER_CACHE_CONTROL_NOCACHE
+     * Field HEADER_TRANSFER_ENCODING
      */
-    public static final String HEADER_CACHE_CONTROL_NOCACHE = "no-cache";
+    public static final String HEADER_TRANSFER_ENCODING = "Transfer-Encoding".intern();
 
     /**
-     * Field HEADER_PRAGMA
+     * Field HEADER_SOAP_ACTION
      */
-    public static final String HEADER_PRAGMA = "Pragma";
+    public static final String HEADER_SOAP_ACTION = "SOAPAction";
 
     /**
-     * Field HEADER_LOCATION
+     * Field HEADER_SET_COOKIE2
      */
-    public static final String HEADER_LOCATION = "Location";
+    public static final String HEADER_SET_COOKIE2 = "Set-Cookie2";
 
     /**
-     * Field REQUEST_HEADERS
+     * Field HEADER_SET_COOKIE
      */
-    public static final String REQUEST_HEADERS = "HTTP-Request-Headers";
+    public static final String HEADER_SET_COOKIE = "Set-Cookie";
 
     /**
-     * Field RESPONSE_HEADERS
+     * Field HEADER_PROXY_AUTHORIZATION
      */
-    public static final String RESPONSE_HEADERS = "HTTP-Response-Headers";
+    public static final String HEADER_PROXY_AUTHORIZATION = "Proxy-Authorization";
 
-    /* http 1.1 */
+    /**
+     * Field HEADER_PROTOCOL_V11
+     */
+    public static final String HEADER_PROTOCOL_V11 = "1.1".intern();
 
     /**
-     * Field HEADER_TRANSFER_ENCODING
+     * Field HEADER_PROTOCOL_V10
      */
-    public static final String HEADER_TRANSFER_ENCODING =
-            "Transfer-Encoding".intern();
+    public static final String HEADER_PROTOCOL_V10 = "1.0".intern();
 
     /**
-     * Field HEADER_TRANSFER_ENCODING_CHUNKED
+     * Field HEADER_PROTOCOL_11
      */
-    public static final String HEADER_TRANSFER_ENCODING_CHUNKED =
-            "chunked".intern();
+    public static final String HEADER_PROTOCOL_11 = "HTTP/1.1";
 
     /**
-     * Field HEADER_CONNECTION
+     * Field HEADER_PROTOCOL_10
      */
-    public static final String HEADER_CONNECTION = "Connection";
+    public static final String HEADER_PROTOCOL_10 = "HTTP/1.0";
 
     /**
-     * Field HEADER_CONNECTION_CLOSE
+     * Field HEADER_PRAGMA
      */
-    public static final String HEADER_CONNECTION_CLOSE = "close".intern();
+    public static final String HEADER_PRAGMA = "Pragma";
 
     /**
-     * Field HEADER_CONNECTION_KEEPALIVE
+     * Field HEADER_POST
      */
-    public static final String HEADER_CONNECTION_KEEPALIVE =
-            "Keep-Alive".intern();    // The default don't send.
+    public static final String HEADER_POST = "POST";
 
     /**
-     * Field HEADER_ACCEPT
+     * Field HEADER_LOCATION
      */
-    public static final String HEADER_ACCEPT = "Accept";
+    public static final String HEADER_LOCATION = "Location";
 
     /**
-     * Field HEADER_ACCEPT_TEXT_ALL
+     * Field HEADER_HOST
      */
-    public static final String HEADER_ACCEPT_TEXT_ALL = "text/*";
+    public static final String HEADER_HOST = "Host";
 
     /**
-     * Field HEADER_ACCEPT_APPL_SOAP
+     * Field HEADER_GET
      */
-    public static final String HEADER_ACCEPT_APPL_SOAP = "application/soap+xml";
+    public static final String HEADER_GET = "GET";
 
     /**
-     * Field HEADER_ACCEPT_MULTIPART_RELATED
+     * Field HEADER_EXPECT_100_Continue
      */
-    public static final String HEADER_ACCEPT_MULTIPART_RELATED =
-            "multipart/related";
+    public static final String HEADER_EXPECT_100_Continue = "100-continue";
 
     /**
-     * Field HEADER_ACCEPT_APPLICATION_DIME
+     * Field HEADER_EXPECT
      */
-    public static final String HEADER_ACCEPT_APPLICATION_DIME =
-            "application/dime";
+    public static final String HEADER_EXPECT = "Expect";
 
     /**
-     * Cookie headers
+     * HTTP header field values
      */
-    public static final String HEADER_COOKIE = "Cookie";
+    public static final String HEADER_DEFAULT_CHAR_ENCODING = "iso-8859-1";
 
     /**
      * Field HEADER_COOKIE2
@@ -269,113 +258,104 @@
     public static final String HEADER_COOKIE2 = "Cookie2";
 
     /**
-     * Field HEADER_SET_COOKIE
+     * Cookie headers
      */
-    public static final String HEADER_SET_COOKIE = "Set-Cookie";
+    public static final String HEADER_COOKIE = "Cookie";
 
     /**
-     * Field HEADER_SET_COOKIE2
+     * Field HEADER_CONTENT_TYPE_JMS
      */
-    public static final String HEADER_SET_COOKIE2 = "Set-Cookie2";
+    public static final String HEADER_CONTENT_TYPE_JMS = "ContentType";
 
     /**
-     * Integer
+     * Field HEADER_CONTENT_TYPE
      */
-    public static String MC_HTTP_STATUS_CODE = "transport.http.statusCode";
+    public static final String HEADER_CONTENT_TYPE = "Content-Type";
 
     /**
-     * String
+     * Field HEADER_CONTENT_TRANSFER_ENCODING
      */
-    public static String MC_HTTP_STATUS_MESSAGE =
-            "transport.http.statusMessage";
+    public static final String HEADER_CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
 
     /**
-     * HttpServlet
+     * Field HEADER_CONTENT_LOCATION
      */
-    public static String MC_HTTP_SERVLET = "transport.http.servlet";
+    public static final String HEADER_CONTENT_LOCATION = "Content-Location";
 
     /**
-     * HttpServletRequest
+     * Field HEADER_CONTENT_LENGTH
      */
-    public static String MC_HTTP_SERVLETREQUEST =
-            "transport.http.servletRequest";
+    public static final String HEADER_CONTENT_LENGTH = "Content-Length";
 
     /**
-     * HttpServletResponse
+     * Field HEADER_CONTENT_ID
      */
-    public static String MC_HTTP_SERVLETRESPONSE =
-            "transport.http.servletResponse";
+    public static final String HEADER_CONTENT_ID = "Content-Id";
 
     /**
-     * Field MC_HTTP_SERVLETLOCATION
+     * Field HEADER_CONTENT_DESCRIPTION
      */
-    public static String MC_HTTP_SERVLETLOCATION =
-            "transport.http.servletLocation";
+    public static final String HEADER_CONTENT_DESCRIPTION = "Content-Description";
 
     /**
-     * Field MC_HTTP_SERVLETPATHINFO
+     * Field HEADER_CONNECTION_KEEPALIVE
      */
-    public static String MC_HTTP_SERVLETPATHINFO =
-            "transport.http.servletPathInfo";
+    public static final String HEADER_CONNECTION_KEEPALIVE = "Keep-Alive".intern();    // The default don't send.
 
     /**
-     * HTTP header field values
+     * Field HEADER_CONNECTION_CLOSE
      */
-    public static final String HEADER_DEFAULT_CHAR_ENCODING = "iso-8859-1";
+    public static final String HEADER_CONNECTION_CLOSE = "close".intern();
 
     /**
-     * AXIS servlet plugin parameter names.
+     * Field HEADER_CONNECTION
      */
-    public static final String PLUGIN_NAME = "transport.http.plugin.pluginName";
+    public static final String HEADER_CONNECTION = "Connection";
 
     /**
-     * Field PLUGIN_SERVICE_NAME
+     * Field HEADER_CACHE_CONTROL_NOCACHE
      */
-    public static final String PLUGIN_SERVICE_NAME =
-            "transport.http.plugin.serviceName";
+    public static final String HEADER_CACHE_CONTROL_NOCACHE = "no-cache";
 
     /**
-     * Field PLUGIN_IS_DEVELOPMENT
+     * Field HEADER_CACHE_CONTROL
      */
-    public static final String PLUGIN_IS_DEVELOPMENT =
-            "transport.http.plugin.isDevelopment";
+    public static final String HEADER_CACHE_CONTROL = "Cache-Control";
 
     /**
-     * Field PLUGIN_ENABLE_LIST
+     * Field HEADER_AUTHORIZATION
      */
-    public static final String PLUGIN_ENABLE_LIST =
-            "transport.http.plugin.enableList";
+    public static final String HEADER_AUTHORIZATION = "Authorization";
 
     /**
-     * Field PLUGIN_ENGINE
+     * Field HEADER_ACCEPT_TEXT_ALL
      */
-    public static final String PLUGIN_ENGINE = "transport.http.plugin.engine";
+    public static final String HEADER_ACCEPT_TEXT_ALL = "text/*";
 
     /**
-     * Field PLUGIN_WRITER
+     * Field HEADER_ACCEPT_MULTIPART_RELATED
      */
-    public static final String PLUGIN_WRITER = "transport.http.plugin.writer";
+    public static final String HEADER_ACCEPT_MULTIPART_RELATED = "multipart/related";
 
     /**
-     * Field PLUGIN_LOG
+     * Field HEADER_ACCEPT_APPL_SOAP
      */
-    public static final String PLUGIN_LOG = "transport.http.plugin.log";
+    public static final String HEADER_ACCEPT_APPL_SOAP = "application/soap+xml";
 
     /**
-     * Field PLUGIN_EXCEPTION_LOG
+     * Field HEADER_ACCEPT_APPLICATION_DIME
      */
-    public static final String PLUGIN_EXCEPTION_LOG =
-            "transport.http.plugin.exceptionLog";
+    public static final String HEADER_ACCEPT_APPLICATION_DIME = "application/dime";
 
     /**
-     * Field OK[]
+     * Field HEADER_ACCEPT
      */
-    public static final char OK[] = ("200 OK").toCharArray();
+    public static final String HEADER_ACCEPT = "Accept";
 
     /**
-     * Field NOCONTENT[]
+     * Field CHAR_SET_ENCODING
      */
-    public static final byte NOCONTENT[] = ("202 OK\n\n").getBytes();
+    public static String CHAR_SET_ENCODING = "charset";
 
     /**
      * Field UNAUTH[]
@@ -383,43 +363,38 @@
     public static final byte UNAUTH[] = ("401 Unauthorized").getBytes();
 
     /**
+     * Field SO_TIMEOUT
+     */
+    public static final String SO_TIMEOUT = "SO_TIMEOUT";
+
+    /**
      * Field SENDER[]
      */
     public static final byte SENDER[] = "400".getBytes();
+    public static final String PROXY = "PROXY";
+    public static final String MTOM_RECIVED_CONTENT_TYPE = "MTOM_RECEIVED";
 
     /**
      * 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 MTOM_RECIVED_CONTENT_TYPE = "MTOM_RECEIVED";
-
     /**
      * Default content encoding chatset
      */
     public static final String HTTP_ELEMENT_CHARSET = "US-ASCII";
 
-    /**
-     * Field SO_TIMEOUT
-     */
-    public static final String SO_TIMEOUT = "SO_TIMEOUT";
+    // HTTP prefix
 
     /**
-     * Field CONNECTION_TIMEOUT
+     * Field HTTP[]
      */
-    public static final String CONNECTION_TIMEOUT = "CONNECTION_TIMEOUT";
+    public static char HTTP[] = "HTTP/1.0 ".toCharArray();
 
     /**
      * Field DEFAULT_SO_TIMEOUT
@@ -431,6 +406,10 @@
      */
     public static final int DEFAULT_CONNECTION_TIMEOUT = 60000;
 
+    /**
+     * Field CONNECTION_TIMEOUT
+     */
+    public static final String CONNECTION_TIMEOUT = "CONNECTION_TIMEOUT";
 
     /**
      * Method getBytes
@@ -446,12 +425,8 @@
         try {
             return data.getBytes(HTTP_ELEMENT_CHARSET);
         } catch (UnsupportedEncodingException e) {
-
         }
+
         return data.getBytes();
     }
-
-    public static final String PROXY = "PROXY";
-
-
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
 /*
- * 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.
- */
+* 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;
 
@@ -35,6 +36,7 @@
  * Class HTTPTransportReceiver
  */
 public class HTTPTransportReceiver {
+
     /**
      * Field BEFORE_SEPERATOR
      */
@@ -51,14 +53,14 @@
     private int lastRead = -1;
 
     /**
-     * Field buf
+     * Field index
      */
-    private byte[] buf = new byte[1024];
+    int index = 0;
 
     /**
-     * Field index
+     * Field buf
      */
-    int index = 0;
+    private byte[] buf = new byte[1024];
 
     /**
      * Field length
@@ -70,9 +72,6 @@
      */
     private boolean done = false;
 
-
-
-
     /**
      * parses following two styles of HTTP stuff
      * Server Side
@@ -96,30 +95,24 @@
      * @return
      * @throws AxisFault
      */
-    public HashMap parseTheHeaders(InputStream in, boolean serverSide)
-            throws AxisFault {
+    public HashMap parseTheHeaders(InputStream in, boolean serverSide) throws AxisFault {
         HashMap map = new HashMap();
+
         try {
             StringBuffer str = new StringBuffer();
             int state = BEFORE_SEPERATOR;
             String key = null;
             String value = null;
+
             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);
+                if ((buf[0] == 'P') && (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);
+                } else if ((buf[0] == 'G') && (buf[1] == 'E') && (buf[2] == 'T')) {
+                    map.put(HTTPConstants.HTTP_REQ_TYPE, HTTPConstants.HEADER_GET);
                     index = 4;
-
                 } else {
                     throw new AxisFault(
                             "Unsupported HTTP request type: Only GET and POST is supported");
@@ -132,7 +125,8 @@
             } else {
                 index = 0;
                 value = readFirstLineArg(' ');
-                if (value != null && value.indexOf("HTTP") >= 0) {
+
+                if ((value != null) && (value.indexOf("HTTP") >= 0)) {
                     map.put(HTTPConstants.PROTOCOL_VERSION, value);
                     value = readFirstLineArg(' ');
                     map.put(HTTPConstants.RESPONSE_CODE, value);
@@ -143,27 +137,34 @@
                 value = readFirstLineArg('\n');
                 map.put(HTTPConstants.RESPONSE_WORD, value);
             }
+
             state = BEFORE_SEPERATOR;
+
             while (!done) {
                 length = readLine(in, buf);
+
                 if (length <= 0) {
                     throw new AxisFault(Messages.getMessage("preatureEOS"));
                 }
+
                 for (int i = 0; i < length; i++) {
                     switch (state) {
-                        case BEFORE_SEPERATOR:
+                        case BEFORE_SEPERATOR :
                             if (buf[i] == ':') {
                                 key = str.toString();
                                 str = new StringBuffer();
                                 state = AFTER_SEPERATOR;
+
                                 if (buf[i + 1] == ' ') {
-                                    i++; // ignore next space
+                                    i++;    // ignore next space
                                 }
                             } else {
                                 str.append((char) buf[i]);
                             }
+
                             break;
-                        case AFTER_SEPERATOR:
+
+                        case AFTER_SEPERATOR :
                             if (buf[i] == '\n') {
                                 value = str.toString();
                                 map.put(key, value);
@@ -172,6 +173,7 @@
                             } else {
                                 str.append((char) buf[i]);
                             }
+
                             break;
 
                             // case END_OF_LINE :
@@ -186,19 +188,19 @@
                             // case END:
                             // break;
                         default :
-                            throw new AxisFault(
-                                    "Error Occured Unknown state " + state);
+                            throw new AxisFault("Error Occured Unknown state " + state);
                     }
                 }
+
                 state = BEFORE_SEPERATOR;
             }
         } catch (IOException e) {
             throw new AxisFault(e.getMessage(), e);
         }
+
         return map;
     }
 
-
     /**
      * Method readFirstLineArg
      *
@@ -208,12 +210,15 @@
      */
     private String readFirstLineArg(char terminal) throws AxisFault {
         StringBuffer str = new StringBuffer();
+
         try {
             while ((buf[index] != terminal) && (index < length)) {
                 str.append((char) buf[index]);
                 index++;
             }
+
             index++;
+
             return str.toString();
         } catch (Exception e) {
             throw new AxisFault(e.getMessage(), e);
@@ -223,13 +228,12 @@
     /**
      * Read a single line from the input stream
      *
-     * @param is  inputstream to read from
-     * @param b   byte array to read into
+     * @param is inputstream to read from
+     * @param b  byte array to read into
      * @return
      * @throws java.io.IOException
      */
-    protected int readLine(InputStream is, byte[] b)
-            throws java.io.IOException {
+    protected int readLine(InputStream is, byte[] b) throws java.io.IOException {
         int count = 0, c;
 
         // System.out.println("inside here");
@@ -238,7 +242,9 @@
         } else {
             c = lastRead;
         }
+
         int off = 0;
+
         while (c != -1) {
             if ((c != '\n') && (c != '\r')) {
                 b[off++] = (byte) c;
@@ -247,6 +253,7 @@
             } else {
                 if ('\n' == c) {
                     c = is.read();
+
                     if (c == '\r') {
                         c = is.read();
                     }
@@ -256,9 +263,11 @@
                         if (c == '\n') {
                             done = true;
                         }
+
                         lastRead = c;
                         b[off++] = '\n';
                         count++;
+
                         break;
                     }
                 } else {
@@ -266,14 +275,55 @@
                 }
             }
         }
+
         if (c == -1) {
-            throw new AxisFault(
-                    "Every line should ends with the \\n, unexpected End of stream");
+            throw new AxisFault("Every line should ends with the \\n, unexpected End of stream");
         } else {
-            return (count > 0) ? count : -1;
+            return (count > 0)
+                    ? count
+                    : -1;
         }
     }
 
+    public static Map getGetRequestParameters(String requestURI) {
+        Map map = new HashMap();
+        char[]       chars = requestURI.toCharArray();
+        final int NOT_BEGUN = 1500;
+        final int INSIDE_NAME = 1501;
+        final int INSIDE_VALUE = 1502;
+        int state = NOT_BEGUN;
+        StringBuffer name = new StringBuffer();
+        StringBuffer value = new StringBuffer();
+
+        for (int index = 0; index < chars.length; index++) {
+            if (state == NOT_BEGUN) {
+                if (chars[index] == '?') {
+                    state = INSIDE_NAME;
+                }
+            } else if (state == INSIDE_NAME) {
+                if (chars[index] == '=') {
+                    state = INSIDE_VALUE;
+                } else {
+                    name.append(chars[index]);
+                }
+            } else if (state == INSIDE_VALUE) {
+                if (chars[index] == ',') {
+                    state = INSIDE_NAME;
+                    map.put(name.toString(), value.toString());
+                    name.delete(0, name.length());
+                    value.delete(0, value.length());
+                } else {
+                    value.append(chars[index]);
+                }
+            }
+        }
+
+        if (name.length() + value.length() > 0) {
+            map.put(name.toString(), value.toString());
+        }
+
+        return map;
+    }
 
     /**
      * Returns the HTML text for the list of services deployed
@@ -282,39 +332,38 @@
      *
      * @return
      */
-    public static String getServicesHTML(
-            ConfigurationContext configurationContext) {
+    public static String getServicesHTML(ConfigurationContext configurationContext) {
         String temp = "";
-        Map services =
-                configurationContext.getAxisConfiguration().getServices();
+        Map services = configurationContext.getAxisConfiguration().getServices();
         Hashtable erroneousServices =
                 configurationContext.getAxisConfiguration().getFaultyServices();
         boolean status = false;
 
-        if (services != null && !services.isEmpty()) {
+        if ((services != null) && !services.isEmpty()) {
             status = true;
+
             Collection serviceCollection = services.values();
+
             temp += "<h2>" + "Deployed services" + "</h2>";
+
             for (Iterator it = serviceCollection.iterator(); it.hasNext();) {
                 Map operations;
                 Collection operationsList;
                 AxisService axisService = (AxisService) it.next();
+
                 operations = axisService.getOperations();
                 operationsList = operations.values();
+                temp += "<h3>" + axisService.getName() + "</h3>";
 
-                temp += "<h3>" + axisService.getName() +
-                        "</h3>";
                 if (operationsList.size() > 0) {
                     temp += "Available operations <ul>";
-                    for (Iterator iterator1 = operationsList.iterator();
-                         iterator1.hasNext();
-                            ) {
-                        AxisOperation axisOperation =
-                                (AxisOperation) iterator1.next();
-                        temp += "<li>"
-                                + axisOperation.getName().getLocalPart()
-                                + "</li>";
+
+                    for (Iterator iterator1 = operationsList.iterator(); iterator1.hasNext();) {
+                        AxisOperation axisOperation = (AxisOperation) iterator1.next();
+
+                        temp += "<li>" + axisOperation.getName().getLocalPart() + "</li>";
                     }
+
                     temp += "</ul>";
                 } else {
                     temp += "No operations speficied for this service";
@@ -322,17 +371,16 @@
             }
         }
 
-        if (erroneousServices != null && !erroneousServices.isEmpty()) {
-
+        if ((erroneousServices != null) && !erroneousServices.isEmpty()) {
             temp += "<hr><h2><font color=\"blue\">Faulty Services</font></h2>";
             status = true;
+
             Enumeration faultyservices = erroneousServices.keys();
+
             while (faultyservices.hasMoreElements()) {
-                String faultyserviceName =
-                        (String) faultyservices.nextElement();
-                temp += "<h3><font color=\"blue\">"
-                        + faultyserviceName
-                        + "</font></h3>";
+                String faultyserviceName = (String) faultyservices.nextElement();
+
+                temp += "<h3><font color=\"blue\">" + faultyserviceName + "</font></h3>";
             }
         }
 
@@ -340,53 +388,9 @@
             temp = "<h2>There are no services deployed</h2>";
         }
 
-        temp =
-                "<html><head><title>Axis2: Services</title></head>"
-                        + "<body>"
-                        + temp
-                        + "</body></html>";
+        temp = "<html><head><title>Axis2: Services</title></head>" + "<body>" + temp
+                + "</body></html>";
 
         return temp;
     }
-
-    public static Map getGetRequestParameters(String requestURI) {
-        Map map = new HashMap();
-
-        char[] chars = requestURI.toCharArray();
-        final int NOT_BEGUN = 1500;
-        final int INSIDE_NAME = 1501;
-        final int INSIDE_VALUE = 1502;
-
-        int state = NOT_BEGUN;
-        StringBuffer name = new StringBuffer();
-        StringBuffer value = new StringBuffer();
-
-        for (int index = 0; index < chars.length; index++) {
-            if (state == NOT_BEGUN) {
-                if (chars[index] == '?') {
-                    state = INSIDE_NAME;
-                }
-            } else if (state == INSIDE_NAME) {
-                if (chars[index] == '=') {
-                    state = INSIDE_VALUE;
-                } else {
-                    name.append(chars[index]);
-                }
-            } else if (state == INSIDE_VALUE) {
-                if (chars[index] == ',') {
-                    state = INSIDE_NAME;
-                    map.put(name.toString(), value.toString());
-                    name.delete(0, name.length());
-                    value.delete(0, value.length());
-                } else {
-                    value.append(chars[index]);
-                }
-            }
-        }
-        if (name.length() + value.length() > 0) {
-            map.put(name.toString(), value.toString());
-        }
-        return map;
-    }
-
 }