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 [18/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/server/SimpleConnManager.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnManager.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnManager.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnManager.java Fri Dec 16 09:13:57 2005
@@ -1,31 +1,32 @@
 /*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleConnManager.java,v 1.2 2004/11/20 17:56:40 olegk Exp $
- * $Revision: 224451 $
- * $Date: 2005-07-23 06:23:59 -0400 (Sat, 23 Jul 2005) $
- *
- * ====================================================================
- *
- *  Copyright 1999-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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
+* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleConnManager.java,v 1.2 2004/11/20 17:56:40 olegk Exp $
+* $Revision: 224451 $
+* $Date: 2005-07-23 06:23:59 -0400 (Sat, 23 Jul 2005) $
+*
+* ====================================================================
+*
+*  Copyright 1999-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.
+* ====================================================================
+*
+* This software consists of voluntary contributions made by many
+* individuals on behalf of the Apache Software Foundation.  For more
+* information on the Apache Software Foundation, please see
+* <http://www.apache.org/>.
+*
+*/
+
 
 package org.apache.axis2.transport.http.server;
 
@@ -39,50 +40,61 @@
  * A REALLY simple connection manager.
  */
 public class SimpleConnManager {
-    
     private Map connsets = new HashMap();
-    
+
     public SimpleConnManager() {
         super();
     }
 
     public synchronized SimpleHttpServerConnection openConnection(final SimpleHost host)
-        throws IOException {
+            throws IOException {
         if (host == null) {
             throw new IllegalArgumentException("Host may not be null");
         }
+
         SimpleHttpServerConnection conn = null;
-        SimpleConnList connlist = (SimpleConnList)this.connsets.get(host);
+        SimpleConnList connlist = (SimpleConnList) this.connsets.get(host);
+
         if (connlist != null) {
             conn = connlist.removeFirst();
-            if (conn != null && !conn.isOpen()) {
+
+            if ((conn != null) && !conn.isOpen()) {
                 conn = null;
             }
         }
+
         if (conn == null) {
             Socket socket = new Socket(host.getHostName(), host.getPort());
+
             conn = new SimpleHttpServerConnection(socket);
         }
+
         return conn;
     }
-    
-    public synchronized void releaseConnection(final SimpleHost host, 
-            final SimpleHttpServerConnection conn) throws IOException {
+
+    public synchronized void releaseConnection(final SimpleHost host,
+                                               final SimpleHttpServerConnection conn)
+            throws IOException {
         if (host == null) {
             throw new IllegalArgumentException("Host may not be null");
         }
+
         if (conn == null) {
             return;
         }
+
         if (!conn.isKeepAlive()) {
             conn.close();
         }
+
         if (conn.isOpen()) {
-            SimpleConnList connlist = (SimpleConnList)this.connsets.get(host);
+            SimpleConnList connlist = (SimpleConnList) this.connsets.get(host);
+
             if (connlist == null) {
                 connlist = new SimpleConnList();
                 this.connsets.put(host, connlist);
             }
+
             connlist.addConnection(conn);
         }
     }
@@ -90,9 +102,10 @@
     public synchronized void shutdown() {
         for (Iterator i = this.connsets.values().iterator(); i.hasNext();) {
             SimpleConnList connlist = (SimpleConnList) i.next();
+
             connlist.shutdown();
         }
+
         this.connsets.clear();
     }
-
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnSet.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnSet.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnSet.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnSet.java Fri Dec 16 09:13:57 2005
@@ -1,31 +1,32 @@
 /*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleConnSet.java,v 1.1 2004/11/13 12:21:28 olegk Exp $
- * $Revision: 224451 $
- * $Date: 2005-07-23 06:23:59 -0400 (Sat, 23 Jul 2005) $
- *
- * ====================================================================
- *
- *  Copyright 1999-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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
+* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleConnSet.java,v 1.1 2004/11/13 12:21:28 olegk Exp $
+* $Revision: 224451 $
+* $Date: 2005-07-23 06:23:59 -0400 (Sat, 23 Jul 2005) $
+*
+* ====================================================================
+*
+*  Copyright 1999-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.
+* ====================================================================
+*
+* This software consists of voluntary contributions made by many
+* individuals on behalf of the Apache Software Foundation.  For more
+* information on the Apache Software Foundation, please see
+* <http://www.apache.org/>.
+*
+*/
+
 
 package org.apache.axis2.transport.http.server;
 
@@ -37,9 +38,8 @@
  * A simple set of connections.
  */
 public class SimpleConnSet {
-    
     private Set connections = new HashSet();
-    
+
     public SimpleConnSet() {
         super();
     }
@@ -47,7 +47,7 @@
     public synchronized void addConnection(final SimpleHttpServerConnection conn) {
         this.connections.add(conn);
     }
-    
+
     public synchronized void removeConnection(final SimpleHttpServerConnection conn) {
         this.connections.remove(conn);
     }
@@ -55,8 +55,8 @@
     public synchronized void shutdown() {
         for (Iterator i = connections.iterator(); i.hasNext();) {
             SimpleHttpServerConnection conn = (SimpleHttpServerConnection) i.next();
+
             conn.close();
         }
     }
-
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnectionThread.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnectionThread.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnectionThread.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnectionThread.java Fri Dec 16 09:13:57 2005
@@ -1,31 +1,32 @@
 /*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleConnectionThread.java,v 1.3 2004/11/13 22:38:27 mbecke Exp $
- * $Revision: 224451 $
- * $Date: 2005-07-23 06:23:59 -0400 (Sat, 23 Jul 2005) $
- *
- * ====================================================================
- *
- *  Copyright 1999-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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
+* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleConnectionThread.java,v 1.3 2004/11/13 22:38:27 mbecke Exp $
+* $Revision: 224451 $
+* $Date: 2005-07-23 06:23:59 -0400 (Sat, 23 Jul 2005) $
+*
+* ====================================================================
+*
+*  Copyright 1999-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.
+* ====================================================================
+*
+* This software consists of voluntary contributions made by many
+* individuals on behalf of the Apache Software Foundation.  For more
+* information on the Apache Software Foundation, please see
+* <http://www.apache.org/>.
+*
+*/
+
 
 package org.apache.axis2.transport.http.server;
 
@@ -39,37 +40,36 @@
  * Simple HTTP connection thread.
  */
 public class SimpleConnectionThread implements Runnable {
-
-    private static final Log LOG = LogFactory.getLog(SimpleConnectionThread.class);
-    
+    private static final Log LOG =
+            LogFactory.getLog(SimpleConnectionThread.class);
     public static final String DEFAULT_CONTENT_CHARSET = "ISO-8859-1";
-
     private SimpleHttpServerConnection conn = null;
-    private SimpleConnSet connpool = null;    
+    private SimpleConnSet connpool = null;
     private HttpRequestHandler handler = null;
-    transient boolean stopped; 
     private String name = null;
+    transient boolean stopped;
 
-    public SimpleConnectionThread(
-            final String name,
-            final SimpleHttpServerConnection conn,
-            final SimpleConnSet connpool,
-            final HttpRequestHandler handler) 
-    throws IOException {
-        //super(tg, name);
+    public SimpleConnectionThread(final String name, final SimpleHttpServerConnection conn,
+                                  final SimpleConnSet connpool, final HttpRequestHandler handler)
+            throws IOException {
+
+        // super(tg, name);
         if (conn == null) {
             throw new IllegalArgumentException("Connection may not be null");
         }
+
         if (connpool == null) {
             throw new IllegalArgumentException("Connection pool not be null");
         }
+
         if (handler == null) {
             throw new IllegalArgumentException("Request handler may not be null");
         }
+
         this.conn = conn;
         this.connpool = connpool;
         this.handler = handler;
-        this.stopped = false; 
+        this.stopped = false;
         this.name = name;
     }
 
@@ -77,25 +77,31 @@
         if (this.stopped) {
             return;
         }
-        this.stopped = true; 
+
+        this.stopped = true;
+
         if (conn != null) {
             conn.close();
             conn = null;
         }
-        //interrupt();
+
+        // interrupt();
     }
 
     public void run() {
         try {
             do {
                 this.conn.setKeepAlive(false);
+
                 SimpleRequest request = this.conn.readRequest();
+
                 if (request != null) {
                     this.handler.processRequest(this.conn, request);
                 }
             } while (this.conn.isKeepAlive());
         } catch (InterruptedIOException e) {
-        } catch (IOException e) {
+        }
+        catch (IOException e) {
             if (!this.stopped && !Thread.interrupted() && LOG.isDebugEnabled()) {
                 LOG.debug("[" + this.name + "] I/O error: " + e.getMessage());
             }
@@ -104,6 +110,4 @@
             this.connpool.removeConnection(this.conn);
         }
     }
-
 }
-    
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHost.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHost.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHost.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHost.java Fri Dec 16 09:13:57 2005
@@ -1,91 +1,80 @@
 /*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleHost.java,v 1.1 2004/11/13 12:21:28 olegk Exp $
- * $Revision: 155418 $
- * $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
- *
- * ====================================================================
- *
- *  Copyright 2002-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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
+* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleHost.java,v 1.1 2004/11/13 12:21:28 olegk Exp $
+* $Revision: 155418 $
+* $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
+*
+* ====================================================================
+*
+*  Copyright 2002-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.
+* ====================================================================
+*
+* This software consists of voluntary contributions made by many
+* individuals on behalf of the Apache Software Foundation.  For more
+* information on the Apache Software Foundation, please see
+* <http://www.apache.org/>.
+*
+*/
+
 
 package org.apache.axis2.transport.http.server;
 
 public class SimpleHost implements Cloneable {
-
     private String hostname = null;
-
     private int port = -1;
 
+    public SimpleHost(final SimpleHost httphost) {
+        super();
+        this.hostname = httphost.hostname;
+        this.port = httphost.port;
+    }
+
     public SimpleHost(final String hostname, int port) {
         super();
+
         if (hostname == null) {
             throw new IllegalArgumentException("Host name may not be null");
         }
+
         if (port < 0) {
             throw new IllegalArgumentException("Port may not be negative");
         }
+
         this.hostname = hostname;
         this.port = port;
     }
 
-    public SimpleHost (final SimpleHost httphost) {
-        super();
-        this.hostname = httphost.hostname;
-        this.port = httphost.port;
-    }
-
     public Object clone() {
         return new SimpleHost(this);
-    }    
-    
-    public String getHostName() {
-        return this.hostname;
     }
 
-    public int getPort() {
-        return this.port;
-    }
-
-    public String toString() {
-        StringBuffer buffer = new StringBuffer(50);        
-        buffer.append(this.hostname);
-        buffer.append(':');
-        buffer.append(this.port);
-        return buffer.toString();
-    }    
-    
     public boolean equals(final Object o) {
-        
         if (o instanceof SimpleHost) {
-            if (o == this) { 
+            if (o == this) {
                 return true;
             }
+
             SimpleHost that = (SimpleHost) o;
+
             if (!this.hostname.equalsIgnoreCase(that.hostname)) {
                 return false;
             }
+
             if (this.port != that.port) {
                 return false;
             }
+
             return true;
         } else {
             return false;
@@ -96,4 +85,21 @@
         return this.hostname.hashCode() + this.port;
     }
 
+    public String toString() {
+        StringBuffer buffer = new StringBuffer(50);
+
+        buffer.append(this.hostname);
+        buffer.append(':');
+        buffer.append(this.port);
+
+        return buffer.toString();
+    }
+
+    public String getHostName() {
+        return this.hostname;
+    }
+
+    public int getPort() {
+        return this.port;
+    }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java Fri Dec 16 09:13:57 2005
@@ -1,31 +1,32 @@
 /*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleHttpServer.java,v 1.15 2004/12/11 22:35:26 olegk Exp $
- * $Revision: 155418 $
- * $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
- *
- * ====================================================================
- *
- *  Copyright 1999-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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
+* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleHttpServer.java,v 1.15 2004/12/11 22:35:26 olegk Exp $
+* $Revision: 155418 $
+* $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
+*
+* ====================================================================
+*
+*  Copyright 1999-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.
+* ====================================================================
+*
+* This software consists of voluntary contributions made by many
+* individuals on behalf of the Apache Software Foundation.  For more
+* information on the Apache Software Foundation, please see
+* <http://www.apache.org/>.
+*
+*/
+
 
 package org.apache.axis2.transport.http.server;
 
@@ -44,143 +45,87 @@
  */
 public class SimpleHttpServer implements Runnable {
     private static final Log LOG = LogFactory.getLog(SimpleHttpServer.class);
-    
     private String testname = "Simple test";
-    private long count = 0;
     private ServerSocket listener = null;
-    private Thread t;
-    private ThreadGroup tg;
+    private long count = 0;
     private ThreadFactory threadPool = null;
     private boolean stopped = false;
-
-    private SimpleConnSet connections = new SimpleConnSet();
-
     private HttpRequestHandler requestHandler = null;
+    private SimpleConnSet connections = new SimpleConnSet();
+    private Thread t;
+    private ThreadGroup tg;
 
     /**
      * Creates a new HTTP server instance, using an arbitrary free TCP port
-     * 
-     * @throws IOException  if anything goes wrong during initialization
+     *
+     * @throws IOException if anything goes wrong during initialization
      */
     public SimpleHttpServer() throws IOException {
-    	this(null, 0, null);
+        this(null, 0, null);
     }
 
     /**
-     * Creates a new HTTP server instance, using the specified socket
-     * factory and the TCP port
-     * 
-     * @param   port    Desired TCP port
-     * @throws IOException  if anything goes wrong during initialization
-     */
-    public SimpleHttpServer(SimpleSocketFactory socketfactory, int port) 
-        throws IOException {
-    	this(socketfactory, port, null);
-    }
-
-    
-      /**
-		 * Creates a new HTTP server instance, using the specified socket
-		 * factory and the TCP port that uses the given ThreadPool. If a
-		 * ThreadPool is not given then a new default axis2 ThreadPool will be
-		 * used.
-		 * 
-		 * @param port
-		 *            Desired TCP port
-		 * @param threadPool
-		 *            ThreadPool to be used inside the SimpleHttpServer. The
-		 *            threadPool object that is provided needs to implement
-		 *            tp.execute(Runnable r)
-		 * @throws IOException
-		 *             if anything goes wrong during initialization
-		 */
-	public SimpleHttpServer(SimpleSocketFactory socketfactory, int port,
-			ThreadFactory threadPool) throws IOException {
-		if (socketfactory == null) {
-			socketfactory = new SimplePlainSocketFactory();
-		}
-		if (threadPool == null) {
-			threadPool = new ThreadPool();
-		}
-		this.threadPool = threadPool;
-		listener = socketfactory.createServerSocket(port);
-		if (LOG.isDebugEnabled()) {
-			LOG.debug("Starting test HTTP server on port " + getLocalPort());
-		}
-		this.threadPool.execute(this);
-	}
-
-    /**
-	 * Creates a new HTTP server instance, using the specified TCP port
-	 * 
-	 * @param port
-	 *            Desired TCP port
-	 * @throws IOException
-	 *             if anything goes wrong during initialization
-	 */
+     * Creates a new HTTP server instance, using the specified TCP port
+     *
+     * @param port Desired TCP port
+     * @throws IOException if anything goes wrong during initialization
+     */
     public SimpleHttpServer(int port) throws IOException {
-    	this(null, port, null);
+        this(null, port, null);
     }
 
     /**
-	 * Creates a new HTTP server instance, using the specified TCP port
-	 * 
-	 * @param port
-	 *            Desired TCP port
-	 * @param threadPool
-	 *            ThreadPool to be used.
-	 * @throws IOException
-	 *             if anything goes wrong during initialization
-	 */
-    public SimpleHttpServer(int port,
-			ThreadFactory threadPool) throws IOException {
-    	this(null, port, threadPool);
-    }
-    public String getTestname() {
-        return this.testname;
+     * Creates a new HTTP server instance, using the specified TCP port
+     *
+     * @param port       Desired TCP port
+     * @param threadPool ThreadPool to be used.
+     * @throws IOException if anything goes wrong during initialization
+     */
+    public SimpleHttpServer(int port, ThreadFactory threadPool) throws IOException {
+        this(null, port, threadPool);
     }
 
-    public void setTestname(final String testname) {
-        this.testname = testname;
-    }
-    
     /**
-     * Returns the TCP port that this HTTP server instance is bound to.
+     * Creates a new HTTP server instance, using the specified socket
+     * factory and the TCP port
      *
-     * @return  TCP port, or -1 if not running
+     * @param port Desired TCP port
+     * @throws IOException if anything goes wrong during initialization
      */
-    public int getLocalPort() {
-        return listener.getLocalPort();
+    public SimpleHttpServer(SimpleSocketFactory socketfactory, int port) throws IOException {
+        this(socketfactory, port, null);
     }
-    
+
     /**
-     * Returns the IP address that this HTTP server instance is bound to.
-     * @return String representation of the IP address or <code>null</code> if not running
+     * Creates a new HTTP server instance, using the specified socket
+     * factory and the TCP port that uses the given ThreadPool. If a
+     * ThreadPool is not given then a new default axis2 ThreadPool will be
+     * used.
+     *
+     * @param port       Desired TCP port
+     * @param threadPool ThreadPool to be used inside the SimpleHttpServer. The
+     *                   threadPool object that is provided needs to implement
+     *                   tp.execute(Runnable r)
+     * @throws IOException if anything goes wrong during initialization
      */
-    public String getLocalAddress() {
-        InetAddress address = listener.getInetAddress();
-        // Ugly work-around for older JDKs
-        byte[] octets = address.getAddress();
-        if ((octets[0] == 0) 
-         && (octets[1] == 0) 
-         && (octets[2] == 0) 
-         && (octets[3] == 0)) {
-            return "localhost"; 
-        } else {
-            return address.getHostAddress();
+    public SimpleHttpServer(SimpleSocketFactory socketfactory, int port, ThreadFactory threadPool)
+            throws IOException {
+        if (socketfactory == null) {
+            socketfactory = new SimplePlainSocketFactory();
         }
-    }
 
-    /**
-     * Checks if this HTTP server instance is running.
-     * 
-     * @return  true/false
-     */
-    public boolean isRunning() {
-        if(t == null) {
-            return false;
+        if (threadPool == null) {
+            threadPool = new ThreadPool();
         }
-        return t.isAlive();
+
+        this.threadPool = threadPool;
+        listener = socketfactory.createServerSocket(port);
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Starting test HTTP server on port " + getLocalPort());
+        }
+
+        this.threadPool.execute(this);
     }
 
     /**
@@ -192,74 +137,126 @@
         }
 
         this.stopped = true;
-        if(LOG.isDebugEnabled()) {
+
+        if (LOG.isDebugEnabled()) {
             LOG.debug("Stopping test HTTP server on port " + getLocalPort());
         }
-        //tg.interrupt();
-        //threadPool.doStop();
-        
+
+        // tg.interrupt();
+        // threadPool.doStop();
+
         if (listener != null) {
             try {
                 listener.close();
-            } catch(IOException e) {
-                
+            } catch (IOException e) {
             }
         }
-        this.connections.shutdown();
-    }
-
-    /**
-     * Returns the currently used HttpRequestHandler by this SimpleHttpServer
-     * 
-     * @return The used HttpRequestHandler, or null.
-     */
-    public HttpRequestHandler getRequestHandler() {
-        return requestHandler;
-    }
 
-    /**
-     * Sets the HttpRequestHandler to be used for this SimpleHttpServer.
-     * 
-     * @param rh    Request handler to be used, or null to disable.
-     */
-    public void setRequestHandler(HttpRequestHandler rh) {
-        this.requestHandler = rh;
-    }
-
-    public void setHttpService(HttpService service) {
-        setRequestHandler(new HttpServiceHandler(service));
+        this.connections.shutdown();
     }
 
     public void run() {
         try {
             while (!this.stopped && !Thread.interrupted()) {
                 Socket socket = listener.accept();
+
                 try {
                     if (this.requestHandler == null) {
                         socket.close();
+
                         break;
                     }
-                    SimpleHttpServerConnection conn = new SimpleHttpServerConnection(socket); 
-                    this.connections.addConnection(conn);
 
-                    this.threadPool.execute(new SimpleConnectionThread(
-                            this.testname + " thread " + this.count,
-                            conn, 
-                            this.connections,
-                            this.requestHandler));
+                    SimpleHttpServerConnection conn = new SimpleHttpServerConnection(socket);
+
+                    this.connections.addConnection(conn);
+                    this.threadPool.execute(new SimpleConnectionThread(this.testname + " thread "
+                            + this.count, conn, this.connections, this.requestHandler));
                 } catch (IOException e) {
                     LOG.debug("I/O error: " + e.getMessage());
                 }
+
                 this.count++;
                 Thread.sleep(100);
             }
         } catch (InterruptedException accept) {
-        } catch (IOException e) {
+        }
+        catch (IOException e) {
             if (!stopped) {
                 LOG.debug("I/O error: " + e.getMessage());
             }
         } finally {
             destroy();
         }
+    }
+
+    /**
+     * Returns the IP address that this HTTP server instance is bound to.
+     *
+     * @return String representation of the IP address or <code>null</code> if not running
+     */
+    public String getLocalAddress() {
+        InetAddress address = listener.getInetAddress();
+
+        // Ugly work-around for older JDKs
+        byte[] octets = address.getAddress();
+
+        if ((octets[0] == 0) && (octets[1] == 0) && (octets[2] == 0) && (octets[3] == 0)) {
+            return "localhost";
+        } else {
+            return address.getHostAddress();
+        }
+    }
+
+    /**
+     * Returns the TCP port that this HTTP server instance is bound to.
+     *
+     * @return TCP port, or -1 if not running
+     */
+    public int getLocalPort() {
+        return listener.getLocalPort();
+    }
+
+    /**
+     * Returns the currently used HttpRequestHandler by this SimpleHttpServer
+     *
+     * @return The used HttpRequestHandler, or null.
+     */
+    public HttpRequestHandler getRequestHandler() {
+        return requestHandler;
+    }
+
+    public String getTestname() {
+        return this.testname;
+    }
+
+    /**
+     * Checks if this HTTP server instance is running.
+     *
+     * @return true/false
+     */
+    public boolean isRunning() {
+        if (t == null) {
+            return false;
+        }
+
+        return t.isAlive();
+    }
+
+    public void setHttpService(HttpService service) {
+        setRequestHandler(new HttpServiceHandler(service));
+    }
+
+    /**
+     * Sets the HttpRequestHandler to be used for this SimpleHttpServer.
+     *
+     * @param rh Request handler to be used, or null to disable.
+     */
+    public void setRequestHandler(HttpRequestHandler rh) {
+        this.requestHandler = rh;
+    }
+
+    public void setTestname(final String testname) {
+        this.testname = testname;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServerConnection.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServerConnection.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServerConnection.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServerConnection.java Fri Dec 16 09:13:57 2005
@@ -1,31 +1,32 @@
 /*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleHttpServerConnection.java,v 1.21 2004/12/11 22:35:26 olegk Exp $
- * $Revision: 224451 $
- * $Date: 2005-07-23 06:23:59 -0400 (Sat, 23 Jul 2005) $
- *
- * ====================================================================
- *
- *  Copyright 1999-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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
+* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleHttpServerConnection.java,v 1.21 2004/12/11 22:35:26 olegk Exp $
+* $Revision: 224451 $
+* $Date: 2005-07-23 06:23:59 -0400 (Sat, 23 Jul 2005) $
+*
+* ====================================================================
+*
+*  Copyright 1999-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.
+* ====================================================================
+*
+* This software consists of voluntary contributions made by many
+* individuals on behalf of the Apache Software Foundation.  For more
+* information on the Apache Software Foundation, please see
+* <http://www.apache.org/>.
+*
+*/
+
 
 package org.apache.axis2.transport.http.server;
 
@@ -46,20 +47,19 @@
  * A connection to the SimpleHttpServer.
  */
 public class SimpleHttpServerConnection {
-
     private static final String HTTP_ELEMENT_CHARSET = "US-ASCII";
-
     private Socket socket = null;
-    private InputStream in = null;
     private OutputStream out = null;
     private boolean keepAlive = false;
+    private InputStream in = null;
 
-    public SimpleHttpServerConnection(final Socket socket)
-    throws IOException {
+    public SimpleHttpServerConnection(final Socket socket) throws IOException {
         super();
+
         if (socket == null) {
             throw new IllegalArgumentException("Socket may not be null");
         }
+
         this.socket = socket;
         this.socket.setTcpNoDelay(true);
         this.socket.setSoTimeout(500);
@@ -79,53 +79,28 @@
         }
     }
 
-    public synchronized boolean isOpen() {
-        return this.socket != null;
-    }
-
-    public void setKeepAlive(boolean b) {
-        this.keepAlive = b;
-    }
-
-    public boolean isKeepAlive() {
-        return this.keepAlive;
-    }
-
-    public InputStream getInputStream() {
-        return this.in;
-    }
-
-    public OutputStream getOutputStream() {
-        return this.out;
-    }
-
-    /**
-     * Returns the ResponseWriter used to write the output to the socket.
-     *
-     * @return This connection's ResponseWriter
-     */
-    public ResponseWriter getWriter() throws UnsupportedEncodingException {
-        return new ResponseWriter(out);
-    }
-
     public SimpleRequest readRequest() throws IOException {
         try {
             String line = null;
+
             do {
                 line = HttpParser.readLine(in, HTTP_ELEMENT_CHARSET);
-            } while (line != null && line.length() == 0);
+            } while ((line != null) && (line.length() == 0));
 
             if (line == null) {
                 setKeepAlive(false);
+
                 return null;
             }
-            SimpleRequest request = new SimpleRequest(
-                    RequestLine.parseLine(line),
+
+            SimpleRequest request = new SimpleRequest(RequestLine.parseLine(line),
                     HttpParser.parseHeaders(this.in, HTTP_ELEMENT_CHARSET),
                     this.in);
+
             return request;
         } catch (IOException e) {
             close();
+
             throw e;
         }
     }
@@ -133,21 +108,25 @@
     public SimpleResponse readResponse() throws IOException {
         try {
             String line = null;
+
             do {
                 line = HttpParser.readLine(in, HTTP_ELEMENT_CHARSET);
-            } while (line != null && line.length() == 0);
+            } while ((line != null) && (line.length() == 0));
 
             if (line == null) {
                 setKeepAlive(false);
+
                 return null;
             }
-            SimpleResponse response = new SimpleResponse(
-                    new StatusLine(line),
+
+            SimpleResponse response = new SimpleResponse(new StatusLine(line),
                     HttpParser.parseHeaders(this.in, HTTP_ELEMENT_CHARSET),
                     this.in);
+
             return response;
         } catch (IOException e) {
             close();
+
             throw e;
         }
     }
@@ -156,36 +135,48 @@
         if (request == null) {
             return;
         }
+
         ResponseWriter writer = new ResponseWriter(this.out, HTTP_ELEMENT_CHARSET);
+
         writer.println(request.getRequestLine().toString());
+
         Iterator item = request.getHeaderIterator();
+
         while (item.hasNext()) {
             Header header = (Header) item.next();
+
             writer.print(header.toExternalForm());
         }
+
         writer.println();
         writer.flush();
 
         OutputStream outsream = this.out;
         InputStream content = request.getBody();
-        if (content != null) {
 
+        if (content != null) {
             Header transferenc = request.getFirstHeader("Transfer-Encoding");
+
             if (transferenc != null) {
                 request.removeHeaders("Content-Length");
+
                 if (transferenc.getValue().indexOf("chunked") != -1) {
                     outsream = new ChunkedOutputStream(outsream);
                 }
             }
+
             byte[] tmp = new byte[4096];
             int i = 0;
+
             while ((i = content.read(tmp)) >= 0) {
                 outsream.write(tmp, 0, i);
             }
+
             if (outsream instanceof ChunkedOutputStream) {
-                ((ChunkedOutputStream)outsream).finish();
+                ((ChunkedOutputStream) outsream).finish();
             }
         }
+
         outsream.flush();
     }
 
@@ -193,54 +184,93 @@
         if (response == null) {
             return;
         }
+
         ResponseWriter writer = new ResponseWriter(this.out, HTTP_ELEMENT_CHARSET);
+
         writer.println(response.getStatusLine());
+
         Iterator item = response.getHeaderIterator();
+
         while (item.hasNext()) {
             Header header = (Header) item.next();
+
             writer.print(header.toExternalForm());
         }
+
         writer.println();
         writer.flush();
 
         OutputStream outsream = this.out;
         InputStream content = response.getBody();
-        if (content != null) {
 
+        if (content != null) {
             Header transferenc = response.getFirstHeader("Transfer-Encoding");
+
             if (transferenc != null) {
                 response.removeHeaders("Content-Length");
+
                 if (transferenc.getValue().indexOf("chunked") != -1) {
                     outsream = new ChunkedOutputStream(outsream);
 
-
                     byte[] tmp = new byte[1024];
                     int i = 0;
+
                     while ((i = content.read(tmp)) >= 0) {
                         outsream.write(tmp, 0, i);
                     }
+
                     if (outsream instanceof ChunkedOutputStream) {
                         ((ChunkedOutputStream) outsream).finish();
                     }
                 }
             } else {
+
                 /**
                  * read the content when needed to embed content-length
                  */
                 byte[] tmp = new byte[1024];
                 int i = 0;
+
                 while ((i = content.read(tmp)) >= 0) {
                     outsream.write(tmp, 0, i);
                 }
-
             }
         }
 
         outsream.flush();
     }
 
+    public InputStream getInputStream() {
+        return this.in;
+    }
+
+    public OutputStream getOutputStream() {
+        return this.out;
+    }
+
     public int getSocketTimeout() throws SocketException {
         return this.socket.getSoTimeout();
+    }
+
+    /**
+     * Returns the ResponseWriter used to write the output to the socket.
+     *
+     * @return This connection's ResponseWriter
+     */
+    public ResponseWriter getWriter() throws UnsupportedEncodingException {
+        return new ResponseWriter(out);
+    }
+
+    public boolean isKeepAlive() {
+        return this.keepAlive;
+    }
+
+    public synchronized boolean isOpen() {
+        return this.socket != null;
+    }
+
+    public void setKeepAlive(boolean b) {
+        this.keepAlive = b;
     }
 
     public void setSocketTimeout(int timeout) throws SocketException {

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimplePlainSocketFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimplePlainSocketFactory.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimplePlainSocketFactory.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimplePlainSocketFactory.java Fri Dec 16 09:13:57 2005
@@ -1,31 +1,32 @@
 /*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimplePlainSocketFactory.java,v 1.1 2004/12/11 22:35:26 olegk Exp $
- * $Revision: 155418 $
- * $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
- *
- * ====================================================================
- *
- *  Copyright 1999-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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
+* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimplePlainSocketFactory.java,v 1.1 2004/12/11 22:35:26 olegk Exp $
+* $Revision: 155418 $
+* $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
+*
+* ====================================================================
+*
+*  Copyright 1999-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.
+* ====================================================================
+*
+* This software consists of voluntary contributions made by many
+* individuals on behalf of the Apache Software Foundation.  For more
+* information on the Apache Software Foundation, please see
+* <http://www.apache.org/>.
+*
+*/
+
 
 package org.apache.axis2.transport.http.server;
 
@@ -36,13 +37,11 @@
  * Defines a plain socket factory
  */
 public class SimplePlainSocketFactory implements SimpleSocketFactory {
-    
     public SimplePlainSocketFactory() {
-    	super();
+        super();
     }
-    
+
     public ServerSocket createServerSocket(int port) throws IOException {
         return new ServerSocket(port);
     }
-    
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleProxy.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleProxy.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleProxy.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleProxy.java Fri Dec 16 09:13:57 2005
@@ -1,31 +1,32 @@
 /*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleProxy.java,v 1.8 2004/12/11 22:35:26 olegk Exp $
- * $Revision: 155418 $
- * $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
- *
- * ====================================================================
- *
- *  Copyright 1999-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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
+* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleProxy.java,v 1.8 2004/12/11 22:35:26 olegk Exp $
+* $Revision: 155418 $
+* $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
+*
+* ====================================================================
+*
+*  Copyright 1999-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.
+* ====================================================================
+*
+* This software consists of voluntary contributions made by many
+* individuals on behalf of the Apache Software Foundation.  For more
+* information on the Apache Software Foundation, please see
+* <http://www.apache.org/>.
+*
+*/
+
 
 package org.apache.axis2.transport.http.server;
 
@@ -37,42 +38,43 @@
  * Simple server that registers default request handlers to act as a proxy.
  */
 public class SimpleProxy extends SimpleHttpServer {
-    
-    private SimpleConnManager connmanager = null; 
+    private SimpleConnManager connmanager = null;
     private HttpRequestHandlerChain stdchain = null;
 
+    public SimpleProxy() throws IOException {
+        this(0);
+    }
+
     public SimpleProxy(int port) throws IOException {
         super(port);
-        this.connmanager = new SimpleConnManager(); 
+        this.connmanager = new SimpleConnManager();
         this.stdchain = new HttpRequestHandlerChain();
         this.stdchain.appendHandler(new TransparentProxyRequestHandler());
         this.stdchain.appendHandler(new ProxyRequestHandler(this.connmanager));
         setRequestHandler(this.stdchain);
     }
 
-    public SimpleProxy() throws IOException {
-        this(0);
+    public void addHandler(final HttpRequestHandler handler) {
+        this.stdchain.prependHandler(handler);
     }
 
-    public void requireAuthentication(final Credentials creds, final String realm, boolean keepalive) {
-        HttpRequestHandlerChain chain = new HttpRequestHandlerChain(this.stdchain); 
-        chain.prependHandler(new ProxyAuthRequestHandler(creds ,realm, keepalive));
-        setRequestHandler(chain);
+    public void destroy() {
+        super.destroy();
+        this.connmanager.shutdown();
     }
 
     public void requireAuthentication(final Credentials creds) {
-        HttpRequestHandlerChain chain = new HttpRequestHandlerChain(this.stdchain); 
+        HttpRequestHandlerChain chain = new HttpRequestHandlerChain(this.stdchain);
+
         chain.prependHandler(new ProxyAuthRequestHandler(creds));
         setRequestHandler(chain);
     }
 
-    public void destroy() {
-        super.destroy();
-        this.connmanager.shutdown();
-    }
-    
-    public void addHandler(final HttpRequestHandler handler) {
-        this.stdchain.prependHandler(handler);
+    public void requireAuthentication(final Credentials creds, final String realm,
+                                      boolean keepalive) {
+        HttpRequestHandlerChain chain = new HttpRequestHandlerChain(this.stdchain);
+
+        chain.prependHandler(new ProxyAuthRequestHandler(creds, realm, keepalive));
+        setRequestHandler(chain);
     }
-    
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleRequest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleRequest.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleRequest.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleRequest.java Fri Dec 16 09:13:57 2005
@@ -1,31 +1,32 @@
 /*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleRequest.java,v 1.3 2004/11/13 12:21:28 olegk Exp $
- * $Revision: 155418 $
- * $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
- *
- * ====================================================================
- *
- *  Copyright 1999-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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
+* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleRequest.java,v 1.3 2004/11/13 12:21:28 olegk Exp $
+* $Revision: 155418 $
+* $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
+*
+* ====================================================================
+*
+*  Copyright 1999-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.
+* ====================================================================
+*
+* This software consists of voluntary contributions made by many
+* individuals on behalf of the Apache Software Foundation.  For more
+* information on the Apache Software Foundation, please see
+* <http://www.apache.org/>.
+*
+*/
+
 
 package org.apache.axis2.transport.http.server;
 
@@ -45,9 +46,7 @@
  * A generic HTTP request.
  */
 public class SimpleRequest {
-    
     public static final String DEFAULT_CONTENT_CHARSET = "ISO-8859-1";
-    
     private RequestLine requestLine = null;
     private HeaderGroup headers = new HeaderGroup();
     private InputStream entity = null;
@@ -56,128 +55,134 @@
         super();
     }
 
-    public SimpleRequest(
-        final RequestLine requestLine,
-        final Header[] headers,
-        final InputStream content) throws IOException
-    {
+    public SimpleRequest(final RequestLine requestLine, final Header[] headers) throws IOException {
+        this(requestLine, headers, null);
+    }
+
+    public SimpleRequest(final RequestLine requestLine, final Header[] headers,
+                         final InputStream content)
+            throws IOException {
         super();
+
         if (requestLine == null) {
             throw new IllegalArgumentException("Request line may not be null");
         }
+
         this.requestLine = requestLine;
+
         if (headers != null) {
             this.headers.setHeaders(headers);
         }
+
         if (content != null) {
+
             // only PUT and POST have content
-            String methodname = requestLine.getMethod(); 
+            String methodname = requestLine.getMethod();
+
             if ("POST".equalsIgnoreCase(methodname) || "PUT".equalsIgnoreCase(methodname)) {
                 Header contentLength = this.headers.getFirstHeader("Content-Length");
                 Header transferEncoding = this.headers.getFirstHeader("Transfer-Encoding");
                 InputStream in = content;
+
                 if (transferEncoding != null) {
                     if (transferEncoding.getValue().indexOf("chunked") != -1) {
                         in = new ChunkedInputStream(in);
                     }
                 } else if (contentLength != null) {
                     long len = getContentLength();
+
                     if (len >= 0) {
                         in = new ContentLengthInputStream(in, len);
                     }
                 }
+
                 this.entity = in;
             }
         }
     }
 
-    public SimpleRequest(final RequestLine requestLine, final Header[] headers)
-        throws IOException {
-        this(requestLine, headers, null);
-    }
-    
-    public RequestLine getRequestLine() {
-        return this.requestLine;
-    }
-
-    public void setRequestLine(final RequestLine requestline) {
-        if (requestline == null) {
-            throw new IllegalArgumentException("Request line may not be null");
+    public void addHeader(final Header header) {
+        if (header == null) {
+            return;
         }
-        this.requestLine = requestline;
+
+        this.headers.addHeader(header);
     }
 
     public boolean containsHeader(final String name) {
         return this.headers.containsHeader(name);
     }
 
-    public Header[] getHeaders() {
-        return this.headers.getAllHeaders();
-    }
-
-    public Header getFirstHeader(final String s) {
-        return this.headers.getFirstHeader(s);
-    }
-
     public void removeHeaders(final String s) {
         if (s == null) {
             return;
         }
+
         Header[] headers = this.headers.getHeaders(s);
+
         for (int i = 0; i < headers.length; i++) {
             this.headers.removeHeader(headers[i]);
         }
     }
 
-    public void addHeader(final Header header) {
-        if (header == null) {
-            return;
-        }
-        this.headers.addHeader(header);
+    public InputStream getBody() {
+        return this.entity;
     }
 
-    public void setHeader(final Header header) {
-        if (header == null) {
-            return;
+    public byte[] getBodyBytes() throws IOException {
+        InputStream in = getBody();
+
+        if (in != null) {
+            byte[]                tmp = new byte[4096];
+            int bytesRead = 0;
+            ByteArrayOutputStream buffer = new ByteArrayOutputStream(1024);
+
+            while ((bytesRead = in.read(tmp)) != -1) {
+                buffer.write(tmp, 0, bytesRead);
+            }
+
+            return buffer.toByteArray();
+        } else {
+            return null;
         }
-        removeHeaders(header.getName());
-        addHeader(header);
     }
 
-    public Iterator getHeaderIterator() {
-        return this.headers.getIterator();
-    }
+    public String getBodyString() throws IOException {
+        byte[] raw = getBodyBytes();
 
-    public String getContentType() {
-        Header contenttype = this.headers.getFirstHeader("Content-Type");
-        if (contenttype != null) {
-            return contenttype.getValue(); 
+        if (raw != null) {
+            return new String(raw, getCharset());
         } else {
-            return "text/plain"; 
+            return null;
         }
     }
-    
+
     public String getCharset() {
         String charset = null;
         Header contenttype = this.headers.getFirstHeader("Content-Type");
+
         if (contenttype != null) {
             HeaderElement values[] = contenttype.getElements();
+
             if (values.length == 1) {
                 NameValuePair param = values[0].getParameterByName("charset");
+
                 if (param != null) {
                     charset = param.getValue();
                 }
             }
         }
+
         if (charset != null) {
             return charset;
         } else {
             return DEFAULT_CONTENT_CHARSET;
         }
     }
-    
+
     public long getContentLength() {
         Header contentLength = this.headers.getFirstHeader("Content-Length");
+
         if (contentLength != null) {
             try {
                 return Long.parseLong(contentLength.getValue());
@@ -188,32 +193,47 @@
             return -1;
         }
     }
-    
-    public InputStream getBody() {
-        return this.entity;
-    }
-    
-    public byte[] getBodyBytes() throws IOException {
-        InputStream in = getBody();
-        if (in != null) {
-            byte[] tmp = new byte[4096];
-            int bytesRead = 0;
-            ByteArrayOutputStream buffer = new ByteArrayOutputStream(1024);
-            while ((bytesRead = in.read(tmp)) != -1) {
-                buffer.write(tmp, 0, bytesRead);
-            }
-            return buffer.toByteArray();
+
+    public String getContentType() {
+        Header contenttype = this.headers.getFirstHeader("Content-Type");
+
+        if (contenttype != null) {
+            return contenttype.getValue();
         } else {
-            return null;
+            return "text/plain";
         }
     }
-    
-    public String getBodyString() throws IOException {
-        byte[] raw = getBodyBytes();
-        if (raw != null) {
-            return new String(raw, getCharset());
-        } else {
-            return null;
+
+    public Header getFirstHeader(final String s) {
+        return this.headers.getFirstHeader(s);
+    }
+
+    public Iterator getHeaderIterator() {
+        return this.headers.getIterator();
+    }
+
+    public Header[] getHeaders() {
+        return this.headers.getAllHeaders();
+    }
+
+    public RequestLine getRequestLine() {
+        return this.requestLine;
+    }
+
+    public void setHeader(final Header header) {
+        if (header == null) {
+            return;
         }
+
+        removeHeaders(header.getName());
+        addHeader(header);
+    }
+
+    public void setRequestLine(final RequestLine requestline) {
+        if (requestline == null) {
+            throw new IllegalArgumentException("Request line may not be null");
+        }
+
+        this.requestLine = requestline;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleResponse.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleResponse.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleResponse.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleResponse.java Fri Dec 16 09:13:57 2005
@@ -1,31 +1,32 @@
 /*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleResponse.java,v 1.8 2004/11/13 12:21:28 olegk Exp $
- * $Revision: 155418 $
- * $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
- *
- * ====================================================================
- *
- *  Copyright 1999-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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
+* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleResponse.java,v 1.8 2004/11/13 12:21:28 olegk Exp $
+* $Revision: 155418 $
+* $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
+*
+* ====================================================================
+*
+*  Copyright 1999-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.
+* ====================================================================
+*
+* This software consists of voluntary contributions made by many
+* individuals on behalf of the Apache Software Foundation.  For more
+* information on the Apache Software Foundation, please see
+* <http://www.apache.org/>.
+*
+*/
+
 
 package org.apache.axis2.transport.http.server;
 
@@ -50,9 +51,7 @@
  * A generic HTTP response.
  */
 public class SimpleResponse {
-    
     public static final String DEFAULT_CONTENT_CHARSET = "ISO-8859-1";
-    
     private HttpVersion ver = HttpVersion.HTTP_1_1;
     private int statuscode = HttpStatus.SC_OK;
     private String phrase = HttpStatus.getStatusText(HttpStatus.SC_OK);
@@ -63,18 +62,19 @@
         super();
     }
 
-    public SimpleResponse(
-            final StatusLine statusline, 
-            final Header[] headers, 
-            final InputStream content) 
+    public SimpleResponse(final StatusLine statusline, final Header[] headers,
+                          final InputStream content)
             throws IOException {
         super();
+
         if (statusline == null) {
             throw new IllegalArgumentException("Status line may not be null");
         }
-        setStatusLine(HttpVersion.parse(statusline.getHttpVersion()),
-                statusline.getStatusCode(), statusline.getReasonPhrase());
+
+        setStatusLine(HttpVersion.parse(statusline.getHttpVersion()), statusline.getStatusCode(),
+                statusline.getReasonPhrase());
         setHeaders(headers);
+
         if (content != null) {
             InputStream in = content;
             Header contentLength = this.headers.getFirstHeader("Content-Length");
@@ -86,124 +86,94 @@
                 }
             } else if (contentLength != null) {
                 long len = getContentLength();
+
                 if (len >= 0) {
                     in = new ContentLengthInputStream(in, len);
                 }
             }
+
             this.entity = in;
         }
     }
 
-
-    public void setStatusLine(final HttpVersion ver, int statuscode, final String phrase) {
-        if (ver == null) {
-            throw new IllegalArgumentException("HTTP version may not be null");
-        }
-        if (statuscode <= 0) {
-            throw new IllegalArgumentException("Status code may not be negative or zero");
-        }
-        this.ver = ver;
-        this.statuscode = statuscode;
-        if (phrase != null) {
-            this.phrase = phrase;
-        } else {
-            this.phrase = HttpStatus.getStatusText(statuscode);
+    public void addHeader(final Header header) {
+        if (header == null) {
+            return;
         }
-    }
 
-    public void setStatusLine(final HttpVersion ver, int statuscode) {
-        setStatusLine(ver, statuscode, null);
-    }
-
-    public String getPhrase() {
-        return this.phrase;
-    }
-
-    public int getStatuscode() {
-        return this.statuscode;
-    }
-
-    public HttpVersion getHttpVersion() {
-        return this.ver;
-    }
-
-    public String getStatusLine() {
-        StringBuffer buffer = new StringBuffer();
-        buffer.append(this.ver);
-        buffer.append(' ');
-        buffer.append(this.statuscode);
-        if (this.phrase != null) {
-            buffer.append(' ');
-            buffer.append(this.phrase);
-        }
-        return buffer.toString();
+        this.headers.addHeader(header);
     }
 
     public boolean containsHeader(final String name) {
         return this.headers.containsHeader(name);
     }
 
-    public Header[] getHeaders() {
-        return this.headers.getAllHeaders();
-    }
-
-    public Header getFirstHeader(final String name) {
-        return this.headers.getFirstHeader(name);
-    }
-
     public void removeHeaders(final String s) {
         if (s == null) {
             return;
         }
+
         Header[] headers = this.headers.getHeaders(s);
+
         for (int i = 0; i < headers.length; i++) {
             this.headers.removeHeader(headers[i]);
         }
     }
 
-    public void addHeader(final Header header) {
-        if (header == null) {
-            return;
-        }
-        this.headers.addHeader(header);
+    public InputStream getBody() {
+        return this.entity;
     }
 
-    public void setHeader(final Header header) {
-        if (header == null) {
-            return;
+    public byte[] getBodyBytes() throws IOException {
+        InputStream in = getBody();
+
+        if (in != null) {
+            byte[]                tmp = new byte[4096];
+            int bytesRead = 0;
+            ByteArrayOutputStream buffer = new ByteArrayOutputStream(1024);
+
+            while ((bytesRead = in.read(tmp)) != -1) {
+                buffer.write(tmp, 0, bytesRead);
+            }
+
+            return buffer.toByteArray();
+        } else {
+            return null;
         }
-        removeHeaders(header.getName());
-        addHeader(header);
     }
 
-    public void setHeaders(final Header[] headers) {
-        if (headers == null) {
-            return;
+    public String getBodyString() throws IOException {
+        byte[] raw = getBodyBytes();
+
+        if (raw != null) {
+            return new String(raw, getCharset());
+        } else {
+            return null;
         }
-        this.headers.setHeaders(headers);
     }
 
-    public Iterator getHeaderIterator() {
-        return this.headers.getIterator();
-    }
-    
     public String getCharset() {
         String charset = DEFAULT_CONTENT_CHARSET;
         Header contenttype = this.headers.getFirstHeader("Content-Type");
+
         if (contenttype != null) {
             HeaderElement values[] = contenttype.getElements();
+
             if (values.length == 1) {
                 NameValuePair param = values[0].getParameterByName("charset");
+
                 if (param != null) {
                     charset = param.getValue();
                 }
             }
         }
+
         return charset;
     }
 
     public long getContentLength() {
         Header contentLength = this.headers.getFirstHeader("Content-Length");
+
         if (contentLength != null) {
             try {
                 return Long.parseLong(contentLength.getValue());
@@ -214,54 +184,109 @@
             return -1;
         }
     }
-    
+
+    public Header getFirstHeader(final String name) {
+        return this.headers.getFirstHeader(name);
+    }
+
+    public Iterator getHeaderIterator() {
+        return this.headers.getIterator();
+    }
+
+    public Header[] getHeaders() {
+        return this.headers.getAllHeaders();
+    }
+
+    public HttpVersion getHttpVersion() {
+        return this.ver;
+    }
+
+    public String getPhrase() {
+        return this.phrase;
+    }
+
+    public String getStatusLine() {
+        StringBuffer buffer = new StringBuffer();
+
+        buffer.append(this.ver);
+        buffer.append(' ');
+        buffer.append(this.statuscode);
+
+        if (this.phrase != null) {
+            buffer.append(' ');
+            buffer.append(this.phrase);
+        }
+
+        return buffer.toString();
+    }
+
+    public int getStatuscode() {
+        return this.statuscode;
+    }
+
+    public void setBody(final InputStream instream) {
+        this.entity = instream;
+    }
+
     public void setBodyString(final String string) {
         if (string != null) {
             byte[] raw = null;
+
             try {
                 raw = string.getBytes(DEFAULT_CONTENT_CHARSET);
             } catch (UnsupportedEncodingException e) {
                 raw = string.getBytes();
             }
+
             this.entity = new ByteArrayInputStream(raw);
+
             if (!containsHeader("Content-Type")) {
                 setHeader(new Header("Content-Type", "text/plain"));
             }
+
             setHeader(new Header("Content-Length", Long.toString(raw.length)));
         } else {
             this.entity = null;
         }
     }
-    
-    public void setBody(final InputStream instream) {
-        this.entity = instream;
-    }
-    
-    public InputStream getBody() {
-        return this.entity;
+
+    public void setHeader(final Header header) {
+        if (header == null) {
+            return;
+        }
+
+        removeHeaders(header.getName());
+        addHeader(header);
     }
-    
-    public byte[] getBodyBytes() throws IOException {
-        InputStream in = getBody();
-        if (in != null) {
-            byte[] tmp = new byte[4096];
-            int bytesRead = 0;
-            ByteArrayOutputStream buffer = new ByteArrayOutputStream(1024);
-            while ((bytesRead = in.read(tmp)) != -1) {
-                buffer.write(tmp, 0, bytesRead);
-            }
-            return buffer.toByteArray();
-        } else {
-            return null;
+
+    public void setHeaders(final Header[] headers) {
+        if (headers == null) {
+            return;
         }
+
+        this.headers.setHeaders(headers);
     }
-    
-    public String getBodyString() throws IOException {
-        byte[] raw = getBodyBytes();
-        if (raw != null) {
-            return new String(raw, getCharset());
+
+    public void setStatusLine(final HttpVersion ver, int statuscode) {
+        setStatusLine(ver, statuscode, null);
+    }
+
+    public void setStatusLine(final HttpVersion ver, int statuscode, final String phrase) {
+        if (ver == null) {
+            throw new IllegalArgumentException("HTTP version may not be null");
+        }
+
+        if (statuscode <= 0) {
+            throw new IllegalArgumentException("Status code may not be negative or zero");
+        }
+
+        this.ver = ver;
+        this.statuscode = statuscode;
+
+        if (phrase != null) {
+            this.phrase = phrase;
         } else {
-            return null;
+            this.phrase = HttpStatus.getStatusText(statuscode);
         }
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleSocketFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleSocketFactory.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleSocketFactory.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleSocketFactory.java Fri Dec 16 09:13:57 2005
@@ -1,31 +1,32 @@
 /*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleSocketFactory.java,v 1.1 2004/12/11 22:35:26 olegk Exp $
- * $Revision: 155418 $
- * $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
- *
- * ====================================================================
- *
- *  Copyright 1999-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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
+* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/server/SimpleSocketFactory.java,v 1.1 2004/12/11 22:35:26 olegk Exp $
+* $Revision: 155418 $
+* $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
+*
+* ====================================================================
+*
+*  Copyright 1999-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.
+* ====================================================================
+*
+* This software consists of voluntary contributions made by many
+* individuals on behalf of the Apache Software Foundation.  For more
+* information on the Apache Software Foundation, please see
+* <http://www.apache.org/>.
+*
+*/
+
 
 package org.apache.axis2.transport.http.server;
 
@@ -36,7 +37,5 @@
  * Defines a socket factory interface
  */
 public interface SimpleSocketFactory {
-    
     ServerSocket createServerSocket(int port) throws IOException;
-    
 }