axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r671127 [7/8] - in /webservices/axis2/trunk/java: ./ modules/addressing/ modules/clustering/ modules/clustering/test/org/apache/axis2/clustering/ modules/integration/ modules/integration/test-resources/deployment/ modules/integration/test/o...
Date Tue, 24 Jun 2008 11:07:10 GMT
Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/DefaultConnectionListenerFailureHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/DefaultConnectionListenerFailureHandler.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/DefaultConnectionListenerFailureHandler.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/DefaultConnectionListenerFailureHandler.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.server;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Default hander for failures in connection listener IOProcessors.
+ * Supports configuration of number retries, delay per retry, and uptime interval considered a success (resets number retries to zero).
+ */
+public class DefaultConnectionListenerFailureHandler implements ConnectionListenerFailureHandler {
+
+    private static final Log LOG = LogFactory.getLog(DefaultConnectionListenerFailureHandler.class);
+
+    protected int retryDelay;
+    protected int successInterval;
+    protected int maxRetries;
+
+    private long lastFailure;
+    private long lastFirstFailure;
+    private int numRetries;
+
+    /**
+     * Create a new DefaultConnectionListenerFailureHandler with default settings.
+     * retryDelay is 1 second, successInterval is 60 seconds, maxRetries is 10
+     */
+    public DefaultConnectionListenerFailureHandler() {
+        this(1000, 60000, 10);
+    }
+
+    /**
+     * Create a new DefaultConnectionListenerFailureHandler
+     *
+     * @param retryDelay      millis to wait before retrying
+     * @param successInterval millis after which an initial or retry attempt will be deemed a success, resetting retry count to 0
+     * @param maxRetries      maximum number of retries allowed without a success, after which the listener will terminate
+     */
+    public DefaultConnectionListenerFailureHandler(int retryDelay, int successInterval,
+                                                   int maxRetries) {
+        this.retryDelay = retryDelay;
+        this.successInterval = successInterval;
+        this.maxRetries = maxRetries;
+        this.lastFailure = this.lastFirstFailure = Long.MIN_VALUE;
+        this.numRetries = 0;
+    }
+
+    /**
+     * Default behavior is to log a warning and attempt retry per constructor config, eventually failing with a logged error and notification.
+     * May subclass and override this method to change the behavior.
+     */
+    public boolean failed(IOProcessor connectionListener, Throwable cause) {
+        long now = System.currentTimeMillis();
+        if (now > lastFailure + successInterval) {
+            numRetries = 0;
+            lastFirstFailure = now;
+        }
+        lastFailure = now;
+        if (numRetries >= maxRetries) {
+            notifyAbnormalTermination(
+                    connectionListener,
+                    "Terminating connection listener " + connectionListener + " after " +
+                            numRetries + "retries in " + (now - lastFirstFailure) / 1000 +
+                            " seconds.",
+                    cause);
+            return false;
+        } else {
+            numRetries++;
+            if (LOG.isWarnEnabled()) {
+                LOG.warn("Attempt number " + numRetries + " of " + maxRetries +
+                        " to reestalish connection listener " + connectionListener +
+                        " due to failure ",
+                         cause);
+            }
+            return true;
+        }
+    }
+
+    /**
+     * Default bevarior is to log the error.
+     * May subclass and override this method to change behavior.
+     */
+    public void notifyAbnormalTermination(IOProcessor connectionListener, String message,
+                                          Throwable cause) {
+        LOG.error(message, cause);
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/DefaultHttpConnectionManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/DefaultHttpConnectionManager.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/DefaultHttpConnectionManager.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/DefaultHttpConnectionManager.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.server;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.ConnectionReuseStrategy;
+import org.apache.http.HttpResponseFactory;
+import org.apache.http.impl.DefaultConnectionReuseStrategy;
+import org.apache.http.impl.DefaultHttpResponseFactory;
+import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.BasicHttpProcessor;
+import org.apache.http.protocol.HttpProcessor;
+import org.apache.http.protocol.ResponseConnControl;
+import org.apache.http.protocol.ResponseContent;
+import org.apache.http.protocol.ResponseDate;
+import org.apache.http.protocol.ResponseServer;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.Executor;
+
+public class DefaultHttpConnectionManager implements HttpConnectionManager {
+
+    private static Log LOG = LogFactory.getLog(DefaultHttpConnectionManager.class);
+
+    private final ConfigurationContext configurationContext;
+
+    /** The thread pool used to execute processors. */
+    private final Executor executor;
+
+    private final WorkerFactory workerfactory;
+
+    private final HttpParams params;
+
+    /** The list of processors. */
+    // XXX: is this list really needed?
+    private final List processors;
+
+    private HttpFactory httpFactory = null;
+
+
+    public DefaultHttpConnectionManager(final ConfigurationContext configurationContext,
+            final Executor executor, final WorkerFactory workerfactory,
+            final HttpParams params) {
+        super();
+        if (configurationContext == null) {
+            throw new IllegalArgumentException("Configuration context may not be null");
+        }
+        if (executor == null) {
+            throw new IllegalArgumentException("Executor may not be null");
+        }
+        if (workerfactory == null) {
+            throw new IllegalArgumentException("Worker factory may not be null");
+        }
+        if (params == null) {
+            throw new IllegalArgumentException("HTTP parameters may not be null");
+        }
+        this.configurationContext = configurationContext;
+        this.executor = executor;
+        this.workerfactory = workerfactory;
+        this.params = params;
+        this.processors = new LinkedList();
+    }
+
+	public DefaultHttpConnectionManager(
+            final ConfigurationContext configurationContext,
+            final Executor executor,
+            final WorkerFactory workerfactory,
+            final HttpParams params,
+            final HttpFactory httpFactory) {
+        this(configurationContext, executor, workerfactory, params);
+        this.httpFactory = httpFactory;
+    }
+
+
+    /**
+     * Removes the destroyed processors.
+     * 
+     * @see IOProcessor#destroy()
+     */
+    //XXX: is this method really needed? Processors are removed as soon as they complete
+    private synchronized void cleanup() {
+        for (Iterator i = this.processors.iterator(); i.hasNext();) {
+            IOProcessor processor = (IOProcessor) i.next();
+            if (processor.isDestroyed()) {
+                i.remove();
+            }
+        }
+    }
+
+
+    /**
+     * Adds the specified {@linkplain IOProcessor} to the list of processors in 
+     * progress.
+     * 
+     * @param processor The processor to add.
+     * @throws NullPointerException If processor is <code>null</code>.
+     */
+    private synchronized void addProcessor(final IOProcessor processor) {
+        if (processor == null) {
+            throw new NullPointerException("The processor can't be null");
+        }
+        this.processors.add(processor);
+    }
+
+
+    /**
+     * Removes the specified {@linkplain IOProcessor} from the list of
+     * processors.
+     * 
+     * @param processor The processor to remove.
+     * @throws NullPointerException If processor is <code>null</code>.
+     */
+    synchronized void removeProcessor(final IOProcessor processor)
+        throws NullPointerException {
+        if (processor == null) {
+            throw new NullPointerException("The processor can't be null");
+        }
+        this.processors.remove(processor);
+    }
+
+
+    public void process(final AxisHttpConnection conn) {
+        if (conn == null) {
+            throw new IllegalArgumentException("HTTP connection may not be null");
+        }
+        // Evict destroyed processors
+        cleanup();
+
+        // Assemble new Axis HTTP service
+        HttpProcessor httpProcessor;
+        ConnectionReuseStrategy connStrategy;
+        HttpResponseFactory responseFactory;
+
+        if (httpFactory != null) {
+            httpProcessor = httpFactory.newHttpProcessor();
+            connStrategy = httpFactory.newConnStrategy();
+            responseFactory = httpFactory.newResponseFactory();
+        } else {
+            BasicHttpProcessor p = new BasicHttpProcessor();
+            p.addInterceptor(new RequestSessionCookie());
+            p.addInterceptor(new ResponseDate());
+            p.addInterceptor(new ResponseServer());
+            p.addInterceptor(new ResponseContent());
+            p.addInterceptor(new ResponseConnControl());
+            p.addInterceptor(new ResponseSessionCookie());
+            httpProcessor = p;
+            connStrategy = new DefaultConnectionReuseStrategy();
+            responseFactory = new DefaultHttpResponseFactory();
+        }
+
+        AxisHttpService httpService = new AxisHttpService(httpProcessor, connStrategy,
+            responseFactory, this.configurationContext, this.workerfactory.newWorker());
+        httpService.setParams(this.params);
+
+        // Create I/O processor to execute HTTP service
+        IOProcessorCallback callback = new IOProcessorCallback() {
+
+            public void completed(final IOProcessor processor) {
+                removeProcessor(processor);
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug(processor + " terminated");
+                }
+            }
+
+        };
+        IOProcessor processor = new HttpServiceProcessor(httpService, conn, callback);
+
+        addProcessor(processor);
+        this.executor.execute(processor);
+    }
+
+
+    public synchronized void shutdown() {
+        for (int i = 0; i < this.processors.size(); i++) {
+            IOProcessor processor = (IOProcessor) this.processors.get(i);
+            processor.destroy();
+        }
+        this.processors.clear();
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/DefaultThreadFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/DefaultThreadFactory.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/DefaultThreadFactory.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/DefaultThreadFactory.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.server;
+
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class DefaultThreadFactory implements ThreadFactory {
+
+    final ThreadGroup group;
+    final AtomicInteger count;
+    final String namePrefix;
+
+    public DefaultThreadFactory(final ThreadGroup group, final String namePrefix) {
+        super();
+        this.count = new AtomicInteger(1);
+        this.group = group;
+        this.namePrefix = namePrefix;
+    }
+
+    public Thread newThread(final Runnable runnable) {
+        StringBuffer buffer = new StringBuffer();
+        buffer.append(this.namePrefix);
+        buffer.append('-');
+        buffer.append(this.count.getAndIncrement());
+        Thread t = new Thread(group, runnable, buffer.toString(), 0);
+        t.setDaemon(false);
+        t.setPriority(Thread.NORM_PRIORITY);
+        return t;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpConnectionManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpConnectionManager.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpConnectionManager.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpConnectionManager.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.server;
+
+public interface HttpConnectionManager {
+
+    void process(AxisHttpConnection incoming);
+
+    void shutdown();
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpFactory.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpFactory.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpFactory.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,484 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.server;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.engine.ListenerManager;
+import org.apache.axis2.transport.http.HTTPWorkerFactory;
+import org.apache.http.ConnectionReuseStrategy;
+import org.apache.http.HttpResponseFactory;
+import org.apache.http.impl.DefaultConnectionReuseStrategy;
+import org.apache.http.impl.DefaultHttpResponseFactory;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
+import org.apache.http.params.HttpProtocolParams;
+import org.apache.http.protocol.BasicHttpProcessor;
+import org.apache.http.protocol.HttpProcessor;
+import org.apache.http.protocol.ResponseConnControl;
+import org.apache.http.protocol.ResponseContent;
+import org.apache.http.protocol.ResponseDate;
+import org.apache.http.protocol.ResponseServer;
+
+import java.io.IOException;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Factory used to configure and create the various instances required in http transports.
+ * Either configure this class in axis2.xml, or in code via the setters, or subclass it and specialize some factory methods to gain more control.
+ */
+public class HttpFactory {
+
+    /**
+     * Name of axis2.xml port parameter for SimpleHTTPServer configuration
+     */
+    public static final String PARAMETER_PORT = "port";
+
+    /**
+     * Name of axis2.xml hostname parameter for SimpleHTTPServer configuration
+     */
+    public static final String PARAMETER_HOST_ADDRESS = "hostname";
+
+    /**
+     * Name of axis2.xml originServer parameter for SimpleHTTPServer configuration
+     */
+    public static final String PARAMETER_ORIGIN_SERVER = "originServer";
+
+    /**
+     * Name of axis2.xml requestTimeout parameter for SimpleHTTPServer configuration
+     */
+    public static final String PARAMETER_REQUEST_SOCKET_TIMEOUT = "requestTimeout";
+
+    /**
+     * Name of axis2.xml requestTcpNoDelay parameter for SimpleHTTPServer configuration
+     */
+    public static final String PARAMETER_REQUEST_TCP_NO_DELAY = "requestTcpNoDelay";
+
+    /**
+     * Name of axis2.xml requestCoreThreadPoolSize parameter for SimpleHTTPServer configuration
+     */
+    public static final String PARAMETER_REQUEST_CORE_THREAD_POOL_SIZE =
+            "requestCoreThreadPoolSize";
+
+    /**
+     * Name of axis2.xml requestMaxThreadPoolSize parameter for SimpleHTTPServer configuration
+     */
+    public static final String PARAMETER_REQUEST_MAX_THREAD_POOL_SIZE = "requestMaxThreadPoolSize";
+
+    /**
+     * Name of axis2.xml threadKeepAliveTime parameter for SimpleHTTPServer configuration
+     */
+    public static final String PARAMETER_THREAD_KEEP_ALIVE_TIME = "threadKeepAliveTime";
+
+    /**
+     * Name of axis2.xml threadKeepAliveTimeUnit parameter for SimpleHTTPServer configuration
+     */
+    public static final String PARAMETER_THREAD_KEEP_ALIVE_TIME_UNIT = "threadKeepAliveTimeUnit";
+
+    private ConfigurationContext configurationContext;
+    private TransportInDescription httpConfiguration;
+    private int port;
+    private String hostAddress;
+    private String originServer;
+    private int requestSocketTimeout;
+    private boolean requestTcpNoDelay;
+    private int requestCoreThreadPoolSize;
+    private int requestMaxThreadPoolSize;
+    private long threadKeepAliveTime;
+    private TimeUnit threadKeepAliveTimeUnit;
+
+    private WorkerFactory requestWorkerFactory = null;
+
+    /**
+     * Create and configure a new HttpFactory
+     */
+    public HttpFactory(ConfigurationContext configurationContext) throws AxisFault {
+        this.configurationContext = configurationContext;
+        httpConfiguration = configurationContext.getAxisConfiguration().getTransportIn(Constants.TRANSPORT_HTTP);
+        port = getIntParam(PARAMETER_PORT, 6060);
+        hostAddress = getStringParam(PARAMETER_HOST_ADDRESS, null);
+        originServer = getStringParam(PARAMETER_ORIGIN_SERVER, "Simple-Server/1.1");
+        requestSocketTimeout = getIntParam(PARAMETER_REQUEST_SOCKET_TIMEOUT, 20000);
+        requestTcpNoDelay = getBooleanParam(PARAMETER_REQUEST_TCP_NO_DELAY, true);
+        requestCoreThreadPoolSize = getIntParam(PARAMETER_REQUEST_CORE_THREAD_POOL_SIZE, 100);
+        requestMaxThreadPoolSize = getIntParam(PARAMETER_REQUEST_MAX_THREAD_POOL_SIZE, 150);
+        threadKeepAliveTime = getLongParam(PARAMETER_THREAD_KEEP_ALIVE_TIME, 180L);
+        threadKeepAliveTimeUnit =
+                getTimeUnitParam(PARAMETER_THREAD_KEEP_ALIVE_TIME_UNIT, TimeUnit.SECONDS);
+    }
+
+    /**
+     * Create and configure a new HttpFactory
+     */
+    public HttpFactory(ConfigurationContext configurationContext, int port) throws AxisFault {
+        this(configurationContext);
+        this.port = port;
+    }
+
+    /**
+     * Create and configure a new HttpFactory
+     */
+    public HttpFactory(ConfigurationContext configurationContext, int port,
+                       WorkerFactory requestWorkerFactory) throws AxisFault {
+        this(configurationContext, port);
+        this.requestWorkerFactory = requestWorkerFactory;
+    }
+
+    private int getIntParam(String name, int def) {
+        String config = getStringParam(name, null);
+        if (config != null) {
+            return Integer.parseInt(config);
+        } else {
+            return def;
+        }
+    }
+
+    private long getLongParam(String name, long def) {
+        String config = getStringParam(name, null);
+        if (config != null) {
+            return Long.parseLong(config);
+        } else {
+            return def;
+        }
+    }
+
+    private boolean getBooleanParam(String name, boolean def) throws AxisFault {
+        String config = getStringParam(name, null);
+        if (config != null) {
+            if (config.equals("yes") || config.equals("true")) {
+                return true;
+            } else if (config.equals("no") || config.equals("false")) {
+                return false;
+            } else {
+                throw new AxisFault("Boolean value must be yes, true, no or false for parameter " +
+                        name + ":  " + config);
+            }
+        }
+        return def;
+    }
+
+    private TimeUnit getTimeUnitParam(String name, TimeUnit def) throws AxisFault {
+        String config = getStringParam(name, null);
+        if (config != null) {
+            try {
+                return (TimeUnit) TimeUnit.class.getField(config).get(null);
+            } catch (Exception e) {
+                throw AxisFault.makeFault(e);
+            }
+        }
+        return def;
+    }
+
+    private String getStringParam(String name, String def) {
+        Parameter param = httpConfiguration.getParameter(name);
+        if (param != null) {
+//            assert param.getParameterType() == Parameter.TEXT_PARAMETER;
+            String config = (String) param.getValue();
+            if (config != null) {
+                return config;
+            }
+        }
+        return def;
+    }
+
+    /**
+     * Return the configured listener manager or create and configure one with configurationContext
+     */
+    public ListenerManager getListenerManager() {
+        ListenerManager lm = configurationContext.getListenerManager();
+        if (lm == null) {
+            lm = new ListenerManager();
+            lm.init(configurationContext);
+        }
+        return lm;
+    }
+
+    /**
+     * Create the executor used to launch the single requestConnectionListener
+     */
+    public ExecutorService newListenerExecutor(int port) {
+        return new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS,
+                                      new LinkedBlockingQueue(),
+                                      new DefaultThreadFactory(
+                                              new ThreadGroup("Listener thread group"),
+                                              "HttpListener-" + this.port));
+    }
+
+    /**
+     * Create the listener for request connections
+     */
+    public IOProcessor newRequestConnectionListener(
+            int port,
+            final HttpConnectionManager manager, 
+            final HttpParams params) throws IOException {
+        return new DefaultConnectionListener(
+                port, 
+                manager, 
+                new DefaultConnectionListenerFailureHandler(), 
+                params);
+    }
+
+    /**
+     * Create and set the parameters applied to incoming request connections
+     */
+    public HttpParams newRequestConnectionParams() {
+        HttpParams params = new BasicHttpParams();
+        params
+                .setIntParameter(HttpConnectionParams.SO_TIMEOUT, requestSocketTimeout)
+                .setBooleanParameter(HttpConnectionParams.TCP_NODELAY, requestTcpNoDelay)
+                .setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 4000)
+                .setIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, 500)
+                .setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024)
+                .setParameter(HttpProtocolParams.ORIGIN_SERVER, originServer);
+        return params;
+    }
+
+    /**
+     * Create the connection manager used to launch request threads
+     */
+    public HttpConnectionManager newRequestConnectionManager(ExecutorService requestExecutor,
+                                                             WorkerFactory workerFactory,
+                                                             HttpParams params) {
+        return new DefaultHttpConnectionManager(configurationContext, requestExecutor,
+                                                workerFactory, params);
+    }
+
+    /**
+     * Create the executor use the manage request processing threads
+     */
+    public ExecutorService newRequestExecutor(int port) {
+        return new ThreadPoolExecutor(requestCoreThreadPoolSize, requestMaxThreadPoolSize,
+                                      threadKeepAliveTime, threadKeepAliveTimeUnit,
+                                      newRequestBlockingQueue(),
+                                      new DefaultThreadFactory(
+                                              new ThreadGroup("Connection thread group"),
+                                              "HttpConnection-" + port));
+    }
+
+    /**
+     * Create the queue used to hold incoming requests when requestCoreThreadPoolSize threads are busy.
+     * Default is an unbounded queue.
+     */
+    public BlockingQueue newRequestBlockingQueue() {
+        return new LinkedBlockingQueue();
+    }
+
+    /**
+     * Create the factory for request workers
+     */
+    public WorkerFactory newRequestWorkerFactory() {
+        if (requestWorkerFactory != null) {
+            return requestWorkerFactory;
+        } else {
+            return new HTTPWorkerFactory();
+        }
+    }
+
+    public HttpProcessor newHttpProcessor() {
+        BasicHttpProcessor httpProcessor = new BasicHttpProcessor();
+        httpProcessor.addInterceptor(new RequestSessionCookie());
+        httpProcessor.addInterceptor(new ResponseDate());
+        httpProcessor.addInterceptor(new ResponseServer());
+        httpProcessor.addInterceptor(new ResponseContent());
+        httpProcessor.addInterceptor(new ResponseConnControl());
+        httpProcessor.addInterceptor(new ResponseSessionCookie());
+        return httpProcessor;
+    }
+
+    public ConnectionReuseStrategy newConnStrategy() {
+        return new DefaultConnectionReuseStrategy();
+    }
+
+    public HttpResponseFactory newResponseFactory() {
+        return new DefaultHttpResponseFactory();
+    }
+
+    // *****
+    // Getters and Setters
+    // *****
+
+    /**
+     * Getter for configurationContext
+     */
+    public ConfigurationContext getConfigurationContext() {
+        return configurationContext;
+    }
+
+    /**
+     * Getter for httpConfiguration
+     */
+    public TransportInDescription getHttpConfiguration() {
+        return httpConfiguration;
+    }
+
+    /**
+     * Getter for port
+     * return the port on which to listen for http connections (default = 6060)
+     */
+    public int getPort() {
+        return port;
+    }
+
+    /**
+     * Setter for port
+     */
+    public void setPort(int port) {
+        this.port = port;
+    }
+
+    /**
+     * Getter for hostAddress
+     *
+     * @return the host address (or name) to be use in reply-to endpoint references, or null if not specified (default = null)
+     */
+    public String getHostAddress() {
+        return hostAddress;
+    }
+
+    /**
+     * Setter for hostAddress
+     */
+    public void setHostAddress(String hostAddress) {
+        this.hostAddress = hostAddress;
+    }
+
+    /**
+     * Getter for originServer
+     *
+     * @return the Server header string for outgoing messages (default "Simple-Server/1.1")
+     */
+    public String getOriginServer() {
+        return originServer;
+    }
+
+    /**
+     * Setter for originServer
+     */
+    public void setOriginServer(String originServer) {
+        this.originServer = originServer;
+    }
+
+    /**
+     * Getter for requestSocketTimeout
+     *
+     * @return the maximum time in millis to wait for data on a request socket (default 20000)
+     */
+    public int getRequestSocketTimeout() {
+        return requestSocketTimeout;
+    }
+
+    /**
+     * Setter for requestSocketTimeout
+     */
+    public void setRequestSocketTimeout(int requestSocketTimeout) {
+        this.requestSocketTimeout = requestSocketTimeout;
+    }
+
+    /**
+     * Getter for requestTcpNoDelay
+     * return false iff Nagle's algorithm should be used to conserve bandwidth by minimizing segments
+     * at the cost of latency and performance (default true, i.e. maximize performance at
+     * the cost of bandwidth)
+     */
+    public boolean getRequestTcpNoDelay() {
+        return requestTcpNoDelay;
+    }
+
+    /**
+     * Setter for requestTcpNoDelay
+     */
+    public void setRequestTcpNoDelay(boolean requestTcpNoDelay) {
+        this.requestTcpNoDelay = requestTcpNoDelay;
+    }
+
+    /**
+     * Getter for RequestCoreThreadPoolSize
+     *
+     * @return the size of the thread pool use to process requests assuming there is adequate queue space (default 25)
+     */
+    public int getRequestCoreThreadPoolSize() {
+        return requestCoreThreadPoolSize;
+    }
+
+    /**
+     * Setter for RequestCoreThreadPoolSize
+     */
+    public void setRequestCoreThreadPoolSize(int requestCoreThreadPoolSize) {
+        this.requestCoreThreadPoolSize = requestCoreThreadPoolSize;
+    }
+
+    /**
+     * Getter for requestMaxThreadPoolSize
+     *
+     * @return the maximum size of the thread pool used to process requests if the queue fills up (default 150).
+     *         Since the default queue is unbounded this parameter is meaningless unless you override newRequestBlockingQueue()
+     */
+    public int getRequestMaxThreadPoolSize() {
+        return requestMaxThreadPoolSize;
+    }
+
+    /**
+     * Setter for requestMaxThreadPoolSize
+     */
+    public void setRequestMaxThreadPoolSize(int requestMaxThreadPoolSize) {
+        this.requestMaxThreadPoolSize = requestMaxThreadPoolSize;
+    }
+
+    /**
+     * Getter for threadKeepAliveTime
+     *
+     * @return how long a request processing thread in excess of the core pool size will be kept alive it if is inactive
+     *         (default with threadKeepAliveTimeUnit to 180 seconds)
+     */
+    public long getThreadKeepAliveTime() {
+        return threadKeepAliveTime;
+    }
+
+    /**
+     * Setter for threadKeepAliveTime
+     */
+    public void setThreadKeepAliveTime(long threadKeepAliveTime) {
+        this.threadKeepAliveTime = threadKeepAliveTime;
+    }
+
+    /**
+     * Getter for threadKeepAliveTimeUnit
+     * return the time unit for threadKeepAliveTime (default SECONDS)
+     */
+    public TimeUnit getThreadKeepAliveTimeUnit() {
+        return threadKeepAliveTimeUnit;
+    }
+
+    /**
+     * Setter for threadKeepAliveTimeUnit
+     */
+    public void setThreadKeepAliveTimeUnit(TimeUnit threadKeepAliveTimeUnit) {
+        this.threadKeepAliveTimeUnit = threadKeepAliveTimeUnit;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.server;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.ConnectionClosedException;
+import org.apache.http.HttpException;
+import org.apache.http.protocol.BasicHttpContext;
+import org.apache.http.protocol.HttpContext;
+
+import java.io.IOException;
+import java.net.SocketException;
+import java.net.SocketTimeoutException;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * I/O processor intended to process requests and fill in responses.
+ */
+public class HttpServiceProcessor implements IOProcessor {
+
+    private static final Log LOG = LogFactory.getLog(HttpServiceProcessor.class);
+
+    /** Counter used to create unique IDs. */
+    private static AtomicLong counter = new AtomicLong(0L);
+
+    private AtomicBoolean terminated;
+
+    private final AxisHttpService httpservice;
+
+    private final AxisHttpConnection conn;
+
+    private final IOProcessorCallback callback;
+
+    /**
+     * Unique identifier used by {@linkplain #equals(Object)} and
+     * {@linkplain #hashCode()}.
+     * <p>
+     * This field is needed to allow the equals method to work properly when this
+     * HttpServiceProcessor has to be removed from the list of processors.
+     * 
+     * @see DefaultHttpConnectionManager
+     */
+    private final long id;
+
+
+    public HttpServiceProcessor(final AxisHttpService httpservice,
+            final AxisHttpConnection conn, final IOProcessorCallback callback) {
+        super();
+        this.httpservice = httpservice;
+        this.conn = conn;
+        this.callback = callback;
+        this.terminated = new AtomicBoolean(false);
+
+        id = counter.incrementAndGet();
+    }
+
+
+    public void run() {
+        LOG.debug("New connection thread");
+        HttpContext context = new BasicHttpContext(null);
+        try {
+            while (! Thread.interrupted() && ! isDestroyed() && this.conn.isOpen()) {
+                this.httpservice.handleRequest(this.conn, context);
+            }
+        } catch (ConnectionClosedException ex) {
+            LOG.debug("Client closed connection");
+        } catch (IOException ex) {
+            if (ex instanceof SocketTimeoutException) {
+                LOG.debug(ex.getMessage());
+            } else if (ex instanceof SocketException) {
+                LOG.debug(ex.getMessage());
+            } else {
+                LOG.warn(ex.getMessage(), ex);
+            }
+        } catch (HttpException ex) {
+            if (LOG.isWarnEnabled()) {
+                LOG.warn("HTTP protocol error: " + ex.getMessage());
+            }
+        } finally {
+            destroy();
+            if (this.callback == null) {
+                throw new NullPointerException("The callback object can't be null");
+            }
+            this.callback.completed(this);
+        }
+    }
+
+
+    public void close() throws IOException {
+        this.conn.close();
+    }
+
+
+    public void destroy() {
+        if (this.terminated.compareAndSet(false, true)) {
+            try {
+//                this.conn.shutdown();
+                close();
+            } catch (IOException ex) {
+                LOG.debug("I/O error shutting down connection");
+            }
+        }
+    }
+
+
+    public boolean isDestroyed() {
+        return this.terminated.get();
+    }
+
+
+    // -------------------------------------------------- Methods from Object
+
+    /**
+     * Returns the unique ID of this HttpServiceProcessor.
+     * 
+     * @return The unique ID of this HttpServiceProcessor.
+     */
+    public int hashCode() {
+        final int PRIME = 31;
+        int result = 1;
+        result = PRIME * result + (int) (id ^ (id >>> 32));
+        return result;
+    }
+
+
+   /**
+    * Indicates whether some other object is "equal to" this one.
+    * 
+    * @return <code>true</code> if this HttpServiceProcessor refere to the same 
+    * object as obj or they have the same {@linkplain #id}, <code>false</code> otherwise.
+    */
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        final HttpServiceProcessor other = (HttpServiceProcessor) obj;
+        if (id != other.id)
+            return false;
+        return true;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpUtils.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpUtils.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/HttpUtils.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.server;
+
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.transport.TransportListener;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.http.Header;
+
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.util.Enumeration;
+
+public class HttpUtils {
+
+    private HttpUtils() {
+    }
+
+    public static String getSoapAction(final AxisHttpRequest request) {
+        if (request == null) {
+            return null;
+        }
+        Header header = request.getFirstHeader(HTTPConstants.HEADER_SOAP_ACTION);
+        if (header != null) {
+            return header.getValue();
+        } else {
+            return null;
+        }
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/IOProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/IOProcessor.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/IOProcessor.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/IOProcessor.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.server;
+
+import java.io.IOException;
+
+public interface IOProcessor extends Runnable {
+
+    void close() throws IOException;
+
+    boolean isDestroyed();
+
+    void destroy();
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/IOProcessorCallback.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/IOProcessorCallback.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/IOProcessorCallback.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/IOProcessorCallback.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.server;
+
+public interface IOProcessorCallback {
+
+    void completed(IOProcessor processor);
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/RequestSessionCookie.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/RequestSessionCookie.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/RequestSessionCookie.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/RequestSessionCookie.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.server;
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.http.Header;
+import org.apache.http.HeaderElement;
+import org.apache.http.HttpException;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpRequestInterceptor;
+import org.apache.http.protocol.HttpContext;
+
+import java.io.IOException;
+
+public class RequestSessionCookie implements HttpRequestInterceptor {
+
+    public void process(final HttpRequest request, final HttpContext context)
+            throws HttpException, IOException {
+        if (request == null) {
+            throw new IllegalArgumentException("HTTP request may not be null");
+        }
+        if (context == null) {
+            throw new IllegalArgumentException("HTTP context may not be null");
+        }
+
+        String sessionCookie = null;
+        Header[] headers = request.getHeaders(HTTPConstants.HEADER_COOKIE);
+        for (int i = 0; i < headers.length; i++) {
+            HeaderElement[] elements = headers[i].getElements();
+            for (int e = 0; e < elements.length; e++) {
+                HeaderElement element = elements[e];
+                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) ||
+                        Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
+                    sessionCookie = element.getValue();
+                }
+            }
+        }
+        context.setAttribute(HTTPConstants.COOKIE_STRING, sessionCookie);
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/ResponseSessionCookie.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/ResponseSessionCookie.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/ResponseSessionCookie.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/ResponseSessionCookie.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.server;
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.http.HttpException;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpResponseInterceptor;
+import org.apache.http.message.BufferedHeader;
+import org.apache.http.protocol.HttpContext;
+import org.apache.http.util.CharArrayBuffer;
+
+import java.io.IOException;
+
+public class ResponseSessionCookie implements HttpResponseInterceptor {
+
+    public void process(final HttpResponse response, final HttpContext context)
+            throws HttpException, IOException {
+        if (response == null) {
+            throw new IllegalArgumentException("HTTP response may not be null");
+        }
+        if (context == null) {
+            throw new IllegalArgumentException("HTTP context may not be null");
+        }
+
+        String sessionCookie = null;
+        MessageContext msgctx = (MessageContext) context.getAttribute(AxisParams.MESSAGE_CONTEXT);
+        if (msgctx != null) {
+            sessionCookie = (String) msgctx.getProperty(HTTPConstants.COOKIE_STRING);
+        }
+        if (sessionCookie == null) {
+            sessionCookie = (String) context.getAttribute(HTTPConstants.COOKIE_STRING);
+        }
+        if (sessionCookie != null) {
+            // Generate Netscape style cookie header
+            CharArrayBuffer buffer1 = new CharArrayBuffer(sessionCookie.length() + 40);
+            buffer1.append(HTTPConstants.HEADER_SET_COOKIE);
+            buffer1.append(": ");
+            buffer1.append(Constants.SESSION_COOKIE_JSESSIONID);
+            buffer1.append("=");
+            buffer1.append(sessionCookie);
+            response.addHeader(new BufferedHeader(buffer1));
+
+            // Generate RFC2965 cookie2 header
+            CharArrayBuffer buffer2 = new CharArrayBuffer(sessionCookie.length() + 50);
+            buffer2.append(HTTPConstants.HEADER_SET_COOKIE2);
+            buffer2.append(": ");
+            buffer2.append(Constants.SESSION_COOKIE_JSESSIONID);
+            buffer2.append("=");
+            buffer2.append(sessionCookie);
+            buffer2.append("; ");
+            int port = response.getParams().getIntParameter(AxisParams.LISTENER_PORT, 0);
+            if (port > 0) {
+                buffer2.append("Port=\"");
+                buffer2.append(Integer.toString(port));
+                buffer2.append("\"; ");
+            }
+            buffer2.append("Version=1");
+            response.addHeader(new BufferedHeader(buffer2));
+        }
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/SessionManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/SessionManager.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/SessionManager.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/SessionManager.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.server;
+
+import org.apache.axiom.om.util.UUIDGenerator;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.context.SessionContext;
+import org.apache.axis2.engine.DependencyManager;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+public class SessionManager {
+
+    private final Map sessionmap;
+
+    public SessionManager() {
+        super();
+        this.sessionmap = new HashMap();
+    }
+
+    public synchronized SessionContext getSessionContext(String sessionKey) {
+        SessionContext sessionContext = null;
+        if (sessionKey != null && sessionKey.length() != 0) {
+            sessionContext = (SessionContext) this.sessionmap.get(sessionKey);
+        }
+        if (sessionContext == null) {
+            sessionKey = UUIDGenerator.getUUID();
+            sessionContext = new SessionContext(null);
+            sessionContext.setCookieID(sessionKey);
+            this.sessionmap.put(sessionKey, sessionContext);
+        }
+        sessionContext.touch();
+        cleanupServiceGroupContexts();
+        return sessionContext;
+    }
+
+    private void cleanupServiceGroupContexts() {
+        long currentTime = System.currentTimeMillis();
+        for (Iterator it = this.sessionmap.keySet().iterator(); it.hasNext();) {
+            String cookieID = (String) it.next();
+            SessionContext sessionContext = (SessionContext) this.sessionmap.get(cookieID);
+            if ((currentTime - sessionContext.getLastTouchedTime()) >
+                    sessionContext.sessionContextTimeoutInterval) {
+                it.remove();
+                Iterator serviceGroupContext = sessionContext.getServiceGroupContext();
+                if (serviceGroupContext != null) {
+                    while (serviceGroupContext.hasNext()) {
+                        ServiceGroupContext groupContext =
+                                (ServiceGroupContext) serviceGroupContext.next();
+                        cleanupServiceContexts(groupContext);
+                    }
+                }
+            }
+        }
+    }
+
+    private void cleanupServiceContexts(final ServiceGroupContext serviceGroupContext) {
+        for (Iterator it = serviceGroupContext.getServiceContexts(); it.hasNext();) {
+            ServiceContext serviceContext = (ServiceContext) it.next();
+            DependencyManager.destroyServiceObject(serviceContext);
+        }
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.server;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.params.HttpParams;
+
+import java.io.IOException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * A simple, but configurable and extensible HTTP server.
+ */
+public class SimpleHttpServer {
+
+    private static Log LOG = LogFactory.getLog(SimpleHttpServer.class);
+
+    private static final int SHUTDOWN_GRACE_PERIOD = 3000; // ms
+
+    private HttpFactory httpFactory;
+    private final int port;
+    private final HttpParams params;
+    private final WorkerFactory workerFactory;
+
+    private IOProcessor listener = null;
+    private ExecutorService listenerExecutor = null;
+    private HttpConnectionManager connmanager = null;
+    private ExecutorService requestExecutor = null;
+
+    public SimpleHttpServer(ConfigurationContext configurationContext, WorkerFactory workerFactory,
+                            int port) throws IOException {
+        this(new HttpFactory(configurationContext, port, workerFactory), port);
+    }
+
+    public SimpleHttpServer(HttpFactory httpFactory, int port) throws IOException {
+        this.httpFactory = httpFactory;
+        this.port = port;
+        this.workerFactory = httpFactory.newRequestWorkerFactory();
+        this.params = httpFactory.newRequestConnectionParams();
+        this.params.setIntParameter(AxisParams.LISTENER_PORT, port);
+    }
+
+    public void init() throws IOException {
+        requestExecutor = httpFactory.newRequestExecutor(port);
+        connmanager =
+                httpFactory.newRequestConnectionManager(requestExecutor, workerFactory, params);
+        listenerExecutor = httpFactory.newListenerExecutor(port);
+        listener = httpFactory.newRequestConnectionListener(port, connmanager, params);
+    }
+
+    public void destroy() throws IOException, InterruptedException {
+        // Attempt to terminate the listener nicely
+        LOG.info("Shut down connection listener");
+        this.listenerExecutor.shutdownNow();
+        this.listener.destroy();
+        this.listenerExecutor.awaitTermination(SHUTDOWN_GRACE_PERIOD, TimeUnit.MILLISECONDS);
+        if (!this.listenerExecutor.isTerminated()) {
+            // Terminate the listener forcibly
+            LOG.info("Force shut down connection listener");
+            this.listener.destroy();
+            // Leave it up to the garbage collector to clean up the mess
+            this.listener = null;
+        }
+        // Attempt to terminate the active processors nicely
+        LOG.info("Shut down HTTP processors");
+        this.requestExecutor.shutdownNow();
+        this.requestExecutor.awaitTermination(SHUTDOWN_GRACE_PERIOD, TimeUnit.MILLISECONDS);
+        if (!this.requestExecutor.isTerminated()) {
+            // Terminate the active processors forcibly
+            LOG.info("Force shut down HTTP processors");
+            this.connmanager.shutdown();
+            // Leave it up to the garbage collector to clean up the mess
+            this.connmanager = null;
+        }
+        LOG.info("HTTP protocol handler shut down");
+    }
+
+    public void start() {
+        this.listenerExecutor.execute(this.listener);
+    }
+
+    public boolean isRunning() {
+        return this.listenerExecutor != null && !this.listenerExecutor.isShutdown();
+    }
+
+    public int getPort() {
+        return this.port;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/Worker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/Worker.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/Worker.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/Worker.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.server;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.http.HttpException;
+
+import java.io.IOException;
+
+public interface Worker {
+
+    void service(AxisHttpRequest request, AxisHttpResponse response, MessageContext msgContext)
+            throws HttpException, IOException;
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/WorkerFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/WorkerFactory.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/WorkerFactory.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/server/WorkerFactory.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.server;
+
+public interface WorkerFactory {
+
+    Worker newWorker();
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/util/RESTUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/util/RESTUtil.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/util/RESTUtil.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/util/RESTUtil.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.util;
+
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.builder.BuilderUtil;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisBindingOperation;
+import org.apache.axis2.description.AxisEndpoint;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher;
+import org.apache.axis2.dispatchers.RequestURIBasedDispatcher;
+import org.apache.axis2.dispatchers.RequestURIOperationDispatcher;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.engine.Handler;
+import org.apache.axis2.transport.TransportUtils;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.HTTPTransportUtils;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ *
+ */
+public class RESTUtil {
+
+    public static Handler.InvocationResponse processXMLRequest(MessageContext msgContext,
+                                                               InputStream in,
+                                                               OutputStream out, String contentType)
+            throws AxisFault {
+        try {
+            msgContext.setDoingREST(true);
+            String charSetEncoding = BuilderUtil.getCharSetEncoding(contentType);
+            msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding);
+            dispatchAndVerify(msgContext);
+            in = HTTPTransportUtils.handleGZip(msgContext, in);
+            SOAPEnvelope soapEnvelope = TransportUtils
+                    .createSOAPMessage(msgContext, in, contentType);
+            msgContext.setEnvelope(soapEnvelope);
+            msgContext.setProperty(Constants.Configuration.CONTENT_TYPE,
+                                   contentType);
+
+            msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
+
+        } catch (AxisFault axisFault) {
+            throw axisFault;
+        } catch (XMLStreamException e) {
+            throw AxisFault.makeFault(e);
+        } catch (IOException e) {
+            throw AxisFault.makeFault(e);
+        } finally {
+            String messageType =
+                    (String) msgContext.getProperty(Constants.Configuration.MESSAGE_TYPE);
+            if (HTTPConstants.MEDIA_TYPE_X_WWW_FORM.equals(messageType) ||
+                    HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA.equals(messageType)) {
+                msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE,
+                                       HTTPConstants.MEDIA_TYPE_APPLICATION_XML);
+            }
+        }
+        return invokeAxisEngine(msgContext);
+    }
+
+    public static Handler.InvocationResponse processURLRequest(MessageContext msgContext,
+                                                               OutputStream out, String contentType)
+            throws AxisFault {
+        // here, only the parameters in the URI are supported. Others will be discarded.
+        try {
+
+            if (contentType == null || "".equals(contentType)) {
+                contentType = HTTPConstants.MEDIA_TYPE_X_WWW_FORM;
+            }
+
+            // set the required properties so that even if there is an error during the dispatch
+            // phase the response message will be passed to the client well. 
+            msgContext.setDoingREST(true);
+            msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
+            String charSetEncoding = BuilderUtil.getCharSetEncoding(contentType);
+            msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding);
+            // 1. First dispatchAndVerify and find out the service and the operation.
+            dispatchAndVerify(msgContext);
+            SOAPEnvelope soapEnvelope;
+            try {
+                soapEnvelope = TransportUtils
+                        .createSOAPMessage(msgContext, null, contentType);
+            } catch (XMLStreamException e) {
+                throw AxisFault.makeFault(e);
+            }
+
+            msgContext.setEnvelope(soapEnvelope);
+
+
+        } catch (AxisFault axisFault) {
+            throw axisFault;
+        }
+        catch (IOException e) {
+            throw AxisFault.makeFault(e);
+        } finally {
+            String messageType =
+                    (String) msgContext.getProperty(Constants.Configuration.MESSAGE_TYPE);
+            if (HTTPConstants.MEDIA_TYPE_X_WWW_FORM.equals(messageType) ||
+                    HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA.equals(messageType)) {
+                msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE,
+                                       HTTPConstants.MEDIA_TYPE_APPLICATION_XML);
+            }
+        }
+        return invokeAxisEngine(msgContext);
+    }
+
+    private static Handler.InvocationResponse invokeAxisEngine(MessageContext messageContext)
+            throws AxisFault {
+        return AxisEngine.receive(messageContext);
+
+    }
+
+    private static void dispatchAndVerify(MessageContext msgContext) throws AxisFault {
+        RequestURIBasedDispatcher requestDispatcher = new RequestURIBasedDispatcher();
+        requestDispatcher.invoke(msgContext);
+        AxisService axisService = msgContext.getAxisService();
+        if (axisService != null) {
+            HTTPLocationBasedDispatcher httpLocationBasedDispatcher =
+                    new HTTPLocationBasedDispatcher();
+            httpLocationBasedDispatcher.invoke(msgContext);
+            if (msgContext.getAxisOperation() == null) {
+                RequestURIOperationDispatcher requestURIOperationDispatcher =
+                        new RequestURIOperationDispatcher();
+                requestURIOperationDispatcher.invoke(msgContext);
+            }
+
+            AxisOperation axisOperation;
+            if ((axisOperation = msgContext.getAxisOperation()) != null) {
+                AxisEndpoint axisEndpoint =
+                        (AxisEndpoint) msgContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
+                if (axisEndpoint != null) {
+                    AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisEndpoint
+                            .getBinding().getChild(axisOperation.getName());
+                    msgContext.setProperty(Constants.AXIS_BINDING_OPERATION, axisBindingOperation);
+                }
+                msgContext.setAxisOperation(axisOperation);
+            }
+        }
+    }
+
+
+}
+
+

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/jms/JMSConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/jms/JMSConstants.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/jms/JMSConstants.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/jms/JMSConstants.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.jms;
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.client.Options;
+
+import javax.xml.namespace.QName;
+
+public class JMSConstants {
+
+    /**
+     * The prefix indicating an Axis JMS URL
+     */
+    public static final String JMS_PREFIX = "jms:/";
+
+    /**
+     * The Parameter name indicating a JMS destination for requests
+     */
+    public static final String DEST_PARAM = "transport.jms.Destination";
+
+    /**
+     * The Parameter name indicating the response JMS destination
+     */
+    public static final String REPLY_PARAM = "transport.jms.ReplyDestination";
+
+    /**
+     * The Parameter name indicating the JMS destination type
+     */
+    public static final String DEST_TYPE_PARAM = "transport.jms.DestinationType";
+
+    /**
+     * The Parameter name indicating the JMS destination type
+     */
+    public static final String DEST_TYPE_TOPIC = "Topic";
+
+    /**
+     * The Parameter name indicating the JMS destination type
+     */
+    public static final String DEST_TYPE_QUEUE = "Queue";
+
+    /**
+     * The Parameter name of an Axis2 service, indicating the JMS connection
+     * factory which should be used to listen for messages for it. This is
+     * the local (Axis2) name of the connection factory and not a JNDI name
+     */
+    public static final String CONFAC_PARAM = "transport.jms.ConnectionFactory";
+
+    /**
+     * The Parameter name indicating the JMS connection factory JNDI name
+     */
+    public static final String CONFAC_JNDI_NAME_PARAM = "transport.jms.ConnectionFactoryJNDIName";
+
+    /**
+     * The Parameter name indicating the JMS connection factory username (useful for WebsphereMQ CLIENT connections)
+     * n.b. This is not the actual username, it is the JNDI name of the variable that will hold the username
+     */
+    public static final String CONFAC_JNDI_NAME_USER = "transport.jms.ConnectionFactoryJNDIUser";
+
+    /**
+     * The Parameter name indicating the JMS connection factory password (useful for WebsphereMQ CLIENT connections)
+     * n.b. This is not the actual password, it is the JNDI name of the variable that will hold the password
+     */
+    public static final String CONFAC_JNDI_NAME_PASS = "transport.jms.ConnectionFactoryJNDIPass";
+
+    /**
+     * The Parameter name indicating the operation to dispatch non SOAP/XML messages
+     */
+    public static final String OPERATION_PARAM = "transport.jms.Operation";
+    /**
+     * The Parameter name indicating the wrapper element for non SOAP/XML messages
+     */
+    public static final String WRAPPER_PARAM = "transport.jms.Wrapper";
+    /**
+     * The default operation name to be used for non SOAP/XML messages
+     * if the operation cannot be determined
+     */
+    public static final QName DEFAULT_OPERATION = new QName("urn:mediate");
+    /**
+     * The name of the element which wraps non SOAP/XML content into a SOAP envelope
+     */
+    public static final QName DEFAULT_WRAPPER =
+            new QName(Constants.AXIS2_NAMESPACE_URI, "jmsMessage");
+
+    /**
+     * The local (Axis2) JMS connection factory name of the default connection
+     * factory to be used, if a service does not explicitly state the connection
+     * factory it should be using by a Parameter named JMSConstants.CONFAC_PARAM
+     */
+    public static final String DEFAULT_CONFAC_NAME = "default";
+
+    /**
+     * A MessageContext property or client Option stating the JMS message type
+     */
+    public static final String JMS_MESSAGE_TYPE = "JMS_MESSAGE_TYPE";
+    /**
+     * The message type indicating a BytesMessage. See JMS_MESSAGE_TYPE
+     */
+    public static final String JMS_BYTE_MESSAGE = "JMS_BYTE_MESSAGE";
+    /**
+     * The message type indicating a TextMessage. See JMS_MESSAGE_TYPE
+     */
+    public static final String JMS_TEXT_MESSAGE = "JMS_TEXT_MESSAGE";
+    /**
+     * A MessageContext property or client Option stating the JMS correlation id
+     */
+    public static final String JMS_COORELATION_ID = "JMS_COORELATION_ID";
+    /**
+     * A MessageContext property or client Option stating the time to wait for a response JMS message
+     */
+    public static final String JMS_WAIT_REPLY = "JMS_WAIT_REPLY";
+    /**
+     * The JMS message property specifying the SOAP Action
+     */
+    public static final String SOAPACTION = "SOAPAction";
+    /**
+     * The JMS message property specifying the content type
+     */
+    public static final String CONTENT_TYPE = "contentType";
+    /**
+     * The default JMS time out waiting for a reply
+     */
+    public static final long DEFAULT_JMS_TIMEOUT = Options.DEFAULT_TIMEOUT_MILLISECONDS;
+
+    public static final String ACTIVEMQ_DYNAMIC_QUEUE = "dynamicQueues/";
+    public static final String ACTIVEMQ_DYNAMIC_TOPIC = "dynamicTopics/";
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/local/LocalResponder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/local/LocalResponder.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/local/LocalResponder.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/local/LocalResponder.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.local;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.transport.TransportSender;
+import org.apache.axis2.transport.TransportUtils;
+import org.apache.axis2.transport.http.HTTPTransportUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
+/**
+ * LocalResponder
+ */
+public class LocalResponder extends AbstractHandler implements TransportSender {
+    protected static final Log log = LogFactory.getLog(LocalResponder.class);
+    
+    
+    //  fixed for Executing LocalTransport in MulthThread. 
+    private OutputStream out;
+
+    public LocalResponder(OutputStream response) {
+        this.out = response;        
+    }
+
+    public void init(ConfigurationContext confContext, TransportOutDescription transportOut)
+            throws AxisFault {
+    }
+
+    public void stop() {
+    }
+
+    public void cleanup(MessageContext msgContext) throws AxisFault {
+    }
+
+    /**
+     * Method invoke
+     *
+     * @param msgContext the active MessageContext
+     * @throws AxisFault
+     */
+    public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+
+        // Check for the REST behaviour, if you desire rest beahaviour
+        // put a <parameter name="doREST" value="true"/> at the axis2.xml
+        msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
+        msgContext.setDoingSwA(HTTPTransportUtils.doWriteSwA(msgContext));
+
+        EndpointReference epr = null;
+
+        if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) {
+            epr = msgContext.getTo();
+        }
+
+        try {
+            if (log.isDebugEnabled()) {
+                ByteArrayOutputStream os = new ByteArrayOutputStream();
+                TransportUtils.writeMessage(msgContext, os);
+                log.debug("Response - " + new String(os.toByteArray()));
+            }
+
+            if (epr != null) {
+                if (!epr.hasNoneAddress()) {
+                    TransportUtils.writeMessage(msgContext, out);
+                }
+            } else {
+                out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);
+
+                if (out != null) {
+                    TransportUtils.writeMessage(msgContext, out);
+                } else {
+                    throw new AxisFault(
+                            "Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send");
+                }
+            }
+        } catch (AxisFault axisFault) {
+            // At this point all we can do is log this error, since it happened while
+            // we were sending the response!
+            log.error("Error sending response", axisFault);
+        }
+
+        TransportUtils.setResponseWritten(msgContext, true);
+        
+        return InvocationResponse.CONTINUE;
+    }
+}



Mime
View raw message