cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r518860 [1/2] - in /incubator/cxf/trunk/rt/transports/http: ./ src/main/java/org/apache/cxf/transport/http/ src/main/java/org/apache/cxf/transport/https/ src/main/java/org/apache/cxf/transport/servlet/ src/test/java/org/apache/cxf/transport...
Date Fri, 16 Mar 2007 04:27:23 GMT
Author: ningjiang
Date: Thu Mar 15 21:27:21 2007
New Revision: 518860

URL: http://svn.apache.org/viewvc?view=rev&rev=518860
Log:
Rollback HTTP module to reversion 518603

Added:
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyListenerFactory.java
      - copied unchanged from r518603, incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyListenerFactory.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslListenerFactory.java
      - copied unchanged from r518603, incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslListenerFactory.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/TestHttpRequest.java
      - copied unchanged from r518603, incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/TestHttpRequest.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/TestHttpResponse.java
      - copied unchanged from r518603, incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/TestHttpResponse.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/JettySslListenerFactoryTest.java
      - copied unchanged from r518603, incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/JettySslListenerFactoryTest.java
Removed:
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyConnectorFactory.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslConnectorFactory.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/JettySslConnectorFactoryTest.java
Modified:
    incubator/cxf/trunk/rt/transports/http/pom.xml
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyContextInspector.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPServerEngine.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/ServerEngine.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/Messages.properties
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLSocketFactoryWrapper.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLUtils.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyContextInspectorTest.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/https/HttpsURLConnectionFactoryTest.java

Modified: incubator/cxf/trunk/rt/transports/http/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/pom.xml?view=diff&rev=518860&r1=518859&r2=518860
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/pom.xml (original)
+++ incubator/cxf/trunk/rt/transports/http/pom.xml Thu Mar 15 21:27:21 2007
@@ -19,10 +19,10 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.cxf</groupId>
-    <artifactId>cxf-rt-transports-http2</artifactId>
+    <artifactId>cxf-rt-transports-http</artifactId>
     <packaging>jar</packaging>
     <version>2.0-incubator-RC-SNAPSHOT</version>
-    <name>Apache CXF Runtime HTTP transport (version2)</name>
+    <name>Apache CXF Runtime HTTP transport</name>
     <url>http://cwiki.apache.org/CXF</url>
 
     <parent>
@@ -50,35 +50,28 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-core</artifactId>
+            <artifactId>cxf-tools2-common</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-tools2-common</artifactId>
+            <artifactId>cxf-rt-core</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-web</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-testutils</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.mortbay.jetty</groupId>
-            <artifactId>jetty</artifactId>
-            <version>6.1.2rc0</version>
+            <groupId>jetty</groupId>
+            <artifactId>org.mortbay.jetty</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.mortbay.jetty</groupId>
-            <artifactId>jetty-sslengine</artifactId>
-            <version>6.1.2rc0</version>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
         </dependency>
-
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-servlet_2.5_spec</artifactId>
@@ -104,7 +97,7 @@
                                     <deleteDirs>
                                         <deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl</deleteDir>
                                     </deleteDirs>
-                                </xsdOption>                               
+                                </xsdOption>
                                 <xsdOption>
                                     <xsd>${basedir}/src/main/resources/schemas/configuration/http-listener.xsd</xsd>
                                     <bindingFile>${basedir}/src/main/resources/schemas/wsdl/http-conf.xjb</bindingFile>
@@ -141,10 +134,9 @@
     </build>
 
 
-
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/transports/http2</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/transports/http2</developerConnection>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/transports/http</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/transports/http</developerConnection>
     </scm>
 
 </project>

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?view=diff&rev=518860&r1=518859&r2=518860
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Thu Mar 15 21:27:21 2007
@@ -20,24 +20,14 @@
 package org.apache.cxf.transport.http;
 
 import java.io.IOException;
-import java.io.OutputStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
-import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.Base64Exception;
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.common.util.StringUtils;
@@ -46,11 +36,9 @@
 import org.apache.cxf.configuration.security.SSLServerPolicy;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.HttpHeaderHelper;
-import org.apache.cxf.io.AbstractWrappedOutputStream;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.AbstractDestination;
-import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
@@ -60,11 +48,6 @@
  */
 public abstract class AbstractHTTPDestination extends AbstractDestination implements Configurable {
     
-    public static final String HTTP_REQUEST = "HTTP.REQUEST";
-    public static final String HTTP_RESPONSE = "HTTP.RESPONSE";
-    
-    private static final Logger LOG = LogUtils.getL7dLogger(JettyHTTPDestination.class);
-    
     private static final long serialVersionUID = 1L;
 
     protected final Bus bus;
@@ -164,51 +147,9 @@
      * @param message the current message
      * @param headers the current set of headers
      */
-    protected void copyRequestHeaders(Message message, Map<String, List<String>> headers) {
-        HttpServletRequest req = (HttpServletRequest)message.get(HTTP_REQUEST);
-        //TODO how to deal with the fields        
-        for (Enumeration e = req.getHeaderNames(); e.hasMoreElements();) {
-            String fname = (String)e.nextElement();
-            List<String> values;
-            if (headers.containsKey(fname)) {
-                values = headers.get(fname);
-            } else {
-                values = new ArrayList<String>();
-                headers.put(HttpHeaderHelper.getHeaderKey(fname), values);
-            }
-            for (Enumeration e2 = req.getHeaders(fname); e2.hasMoreElements();) {
-                String val = (String)e2.nextElement();
-                values.add(val);
-            }
-        }
-    }
+    protected abstract void copyRequestHeaders(Message message,
+                                               Map<String, List<String>> headers);
 
-    /**
-     * Copy the response headers into the response.
-     * 
-     * @param message the current message
-     * @param headers the current set of headers
-     */
-    protected void copyResponseHeaders(Message message, HttpServletResponse response) {
-        Map<?, ?> headers = (Map<?, ?>)message.get(Message.PROTOCOL_HEADERS);
-        if (null != headers) {
-            
-            if (!headers.containsKey(Message.CONTENT_TYPE)) {
-                response.setContentType((String) message.get(Message.CONTENT_TYPE));
-            }
-            
-            for (Iterator<?> iter = headers.keySet().iterator(); iter.hasNext();) {
-                String header = (String)iter.next();
-                List<?> headerList = (List<?>)headers.get(header);
-                for (Object value : headerList) {
-                    response.addHeader(header, (String)value);
-                }
-            }
-        } else {
-            response.setContentType((String) message.get(Message.CONTENT_TYPE));
-        }
-    }
-    
     protected static EndpointInfo getAddressValue(EndpointInfo ei) {       
         return getAddressValue(ei, true);
     } 
@@ -216,18 +157,9 @@
     protected static EndpointInfo getAddressValue(EndpointInfo ei, boolean dp) {       
         if (dp) {
             ei.setAddress(StringUtils.addDefaultPortIfMissing(ei.getAddress()));
-        } 
+        }
         return ei;
-    }
-    
-    /**
-     * @param inMessage the incoming message
-     * @return the inbuilt backchannel
-     */
-    protected Conduit getInbuiltBackChannel(Message inMessage) {
-        HttpServletResponse response = (HttpServletResponse)inMessage.get(HTTP_RESPONSE);
-        return new BackChannelConduit(response);
-    }
+    }  
     
     /**
      * Mark message as a partial message.
@@ -276,119 +208,11 @@
                         Arrays.asList(new String[] {"close"}));
         }
         
-    
-        
     /*
      * TODO - hook up these policies
     <xs:attribute name="SuppressClientSendErrors" type="xs:boolean" use="optional" default="false">
     <xs:attribute name="SuppressClientReceiveErrors" type="xs:boolean" use="optional" default="false">
     */
-    }
-  
-   
-    protected OutputStream flushHeaders(Message outMessage) throws IOException {
-        updateResponseHeaders(outMessage);
-        Object responseObj = outMessage.get(HTTP_RESPONSE);
-        OutputStream responseStream = null;
-        if (responseObj instanceof HttpServletResponse) {
-            HttpServletResponse response = (HttpServletResponse)responseObj;
-
-            Integer i = (Integer)outMessage.get(Message.RESPONSE_CODE);
-            if (i != null) {
-                int status = i.intValue();               
-                response.setStatus(status);
-            } else {
-                response.setStatus(HttpURLConnection.HTTP_OK);
-            }
-
-            copyResponseHeaders(outMessage, response);
-            responseStream = response.getOutputStream();
-
-            if (isOneWay(outMessage)) {
-                response.flushBuffer();
-            }
-        } else if (null != responseObj) {
-            String m = (new org.apache.cxf.common.i18n.Message("UNEXPECTED_RESPONSE_TYPE_MSG",
-                LOG, responseObj.getClass())).toString();
-            LOG.log(Level.WARNING, m);
-            throw new IOException(m);   
-        } else {
-            String m = (new org.apache.cxf.common.i18n.Message("NULL_RESPONSE_MSG", LOG)).toString();
-            LOG.log(Level.WARNING, m);
-            throw new IOException(m);
-        }
-
-        if (isOneWay(outMessage)) {
-            outMessage.remove(HTTP_RESPONSE);
-        }
-        return responseStream;
-    }
-    
-    /**
-     * Backchannel conduit.
-     */
-    protected class BackChannelConduit
-        extends AbstractDestination.AbstractBackChannelConduit {
-
-        protected HttpServletResponse response;
-
-        BackChannelConduit(HttpServletResponse resp) {
-            response = resp;
-        }
-
-        /**
-         * Send an outbound message, assumed to contain all the name-value
-         * mappings of the corresponding input message (if any). 
-         * 
-         * @param message the message to be sent.
-         */
-        public void send(Message message) throws IOException {
-            message.put(HTTP_RESPONSE, response);
-            message.setContent(OutputStream.class, new WrappedOutputStream(message, response));
-        }
-    }
-
-    /**
-     * Wrapper stream responsible for flushing headers and committing outgoing
-     * HTTP-level response.
-     */
-    private class WrappedOutputStream extends AbstractWrappedOutputStream {
-
-        protected HttpServletResponse response;
-
-        WrappedOutputStream(Message m, HttpServletResponse resp) {
-            super(m);
-            response = resp;
-        }
-
-        /**
-         * Perform any actions required on stream flush (freeze headers,
-         * reset output stream ... etc.)
-         */
-        protected void doFlush() throws IOException {
-            OutputStream responseStream = flushHeaders(outMessage);
-            if (null != responseStream && !alreadyFlushed()) {
-                resetOut(responseStream, true);
-            }
-        }
-
-        /**
-         * Perform any actions required on stream closure (handle response etc.)
-         */
-        protected void doClose() {
-            commitResponse();
-        }
-
-        protected void onWrite() throws IOException {
-        }
-
-        private void commitResponse() {
-            try {
-                response.flushBuffer();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
     }
 
     boolean contextMatchOnExact() {

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?view=diff&rev=518860&r1=518859&r2=518860
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java Thu Mar 15 21:27:21 2007
@@ -60,15 +60,16 @@
 
 import static org.apache.cxf.message.Message.DECOUPLED_CHANNEL_MESSAGE;
 
-
 /**
  * HTTP Conduit implementation.
  */
-public class HTTPConduit extends AbstractConduit implements Configurable {   
+public class HTTPConduit extends AbstractConduit implements Configurable {
+    public static final String HTTP_REQUEST = "org.apache.cxf.transport.http.JettyHTTPDestination.REQUEST";
+    public static final String HTTP_RESPONSE = "org.apache.cxf.transport.http.JettyHTTPDestination.RESPONSE";
     public static final String HTTP_CONNECTION = "http.connection";
     private static final Logger LOG = LogUtils.getL7dLogger(HTTPConduit.class);
     
-    private final Bus bus;    
+    private final Bus bus;
     private final URLConnectionFactory alternateConnectionFactory;
     private URLConnectionFactory connectionFactory;
     private URL url;
@@ -83,7 +84,7 @@
     private AuthorizationPolicy authorization;
     private AuthorizationPolicy proxyAuthorization;
     private SSLClientPolicy sslClient;
-    
+
 
     /**
      * Constructor
@@ -97,7 +98,7 @@
              ei,
              null);
     }
-
+    
     /**
      * Constructor
      * 
@@ -139,18 +140,21 @@
               : new URL(t.getAddress().getValue());
     }
 
-
     protected Logger getLogger() {
         return LOG;
     }
+
     
+    /**
+     * Post-configure retreival of connection factory.
+     */
     protected void retrieveConnectionFactory() {
         connectionFactory = alternateConnectionFactory != null
                             ? alternateConnectionFactory
                             : HTTPTransportFactory.getConnectionFactory(
-                                getSslClient());
+                                  getSslClient());
     }
-   
+        
     /**
      * Send an outbound message.
      * 
@@ -158,7 +162,7 @@
      */
     public void send(Message message) throws IOException {
         Map<String, List<String>> headers = setHeaders(message);
-        URL currentURL = setupURL(message);        
+        URL currentURL = setupURL(message);
         URLConnection connection = 
             connectionFactory.createConnection(getProxy(), currentURL);
         connection.setDoOutput(true);        
@@ -182,7 +186,7 @@
             } else {
                 hc.setInstanceFollowRedirects(false);
                 if (!hc.getRequestMethod().equals("GET")
-                    && getClient().isAllowChunking()) {
+                        && getClient().isAllowChunking()) {
                     hc.setChunkedStreamingMode(2048);
                 }
             }
@@ -216,14 +220,15 @@
      * @return the backchannel Destination (or null if the backchannel is
      * built-in)
      */
+    @Override
     public synchronized Destination getBackChannel() {
         if (decoupledDestination == null
-            &&  getClient().getDecoupledEndpoint() != null) {
+            && getClient().getDecoupledEndpoint() != null) {
             setUpDecoupledDestination(); 
         }
         return decoupledDestination;
     }
-
+    
     /**
      * Close the conduit
      */
@@ -397,7 +402,7 @@
     }
 
     private void initConfig() {
-        //Initialize some default values for the configuration
+        // Initialize some default values for the configuration
         client = endpointInfo.getTraversedExtensor(new HTTPClientPolicy(), HTTPClientPolicy.class);
         authorization = endpointInfo.getTraversedExtensor(new AuthorizationPolicy(),
                                                           AuthorizationPolicy.class);
@@ -627,7 +632,7 @@
             incomingObserver.onMessage(inMessage);
         }
     }
-    
+       
     /**
      * Used to set appropriate message properties, exchange etc.
      * as required for an incoming decoupled response (as opposed
@@ -650,12 +655,11 @@
             inMessage.put(Message.RESPONSE_CODE, HttpURLConnection.HTTP_OK);
 
             // remove server-specific properties
-            inMessage.remove(AbstractHTTPDestination.HTTP_REQUEST);
-            inMessage.remove(AbstractHTTPDestination.HTTP_RESPONSE);
+            inMessage.remove(HTTP_REQUEST);
+            inMessage.remove(HTTP_RESPONSE);
             inMessage.remove(Message.ASYNC_POST_RESPONSE_DISPATCH);
 
             incomingObserver.onMessage(inMessage);
         }
     }
-    
 }

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java?view=diff&rev=518860&r1=518859&r2=518860
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java Thu Mar 15 21:27:21 2007
@@ -50,12 +50,11 @@
 import org.apache.cxf.transport.DestinationFactory;
 import org.apache.cxf.transport.DestinationFactoryManager;
 import org.apache.cxf.transport.https.HttpsURLConnectionFactory;
-import org.apache.cxf.transport.https.JettySslConnectorFactory;
+import org.apache.cxf.transport.https.JettySslListenerFactory;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl11.WSDLEndpointFactory;
-import org.mortbay.jetty.AbstractConnector;
-//import org.mortbay.jetty.bio.SocketConnector;
-import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.http.SocketListener;
+import org.mortbay.util.InetAddrPort;
 import org.xmlsoap.schemas.wsdl.http.AddressType;
 
 public class HTTPTransportFactory extends AbstractTransportFactory implements ConduitInitiator,
@@ -100,7 +99,8 @@
             for (String ns : activationNamespaces) {
                 dfm.registerDestinationFactory(ns, this);
             }
-        }
+        }       
+       
     }
 
     public Conduit getConduit(EndpointInfo endpointInfo) throws IOException {
@@ -118,7 +118,7 @@
     public Destination getDestination(EndpointInfo endpointInfo) throws IOException {
         JettyHTTPDestination destination = new JettyHTTPDestination(bus, this, endpointInfo);
         configure(destination);
-        destination.retrieveEngine();        
+        destination.retrieveEngine();
         return destination;
     }
 
@@ -165,24 +165,21 @@
                ? new URLConnectionFactory() {
                        public URLConnection createConnection(Proxy proxy, URL u)
                            throws IOException {
-                           return proxy != null 
+                           return proxy != null
                                   ? u.openConnection(proxy)
                                   : u.openConnection();
                        }
                    }
                : new HttpsURLConnectionFactory(policy);
     }
-    
-    protected static JettyConnectorFactory getConnectorFactory(SSLServerPolicy policy) {
+
+    protected static JettyListenerFactory getListenerFactory(SSLServerPolicy policy) {
         return policy == null
-               ? new JettyConnectorFactory() {                     
-                   public AbstractConnector createConnector(int port) {
-                       SelectChannelConnector result = new SelectChannelConnector();
-                       //SocketConnector result = new SocketConnector();
-                       result.setPort(port);
-                       return result;
+               ? new JettyListenerFactory() {
+                       public SocketListener createListener(int port) {
+                           return new SocketListener(new InetAddrPort(port));
+                       }
                    }
-               }
-               : new JettySslConnectorFactory(policy);
+               : new JettySslListenerFactory(policy);
     }
 }

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyContextInspector.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyContextInspector.java?view=diff&rev=518860&r1=518859&r2=518860
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyContextInspector.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyContextInspector.java Thu Mar 15 21:27:21 2007
@@ -20,13 +20,13 @@
 package org.apache.cxf.transport.http;
 
 import org.apache.cxf.endpoint.ContextInspector;
-import org.mortbay.jetty.handler.ContextHandler;
+import org.mortbay.http.HttpContext;
 
 public class JettyContextInspector implements ContextInspector {
     
     public String getAddress(Object serverContext) {
-        if (ContextHandler.class.isAssignableFrom(serverContext.getClass())) {
-            return ((ContextHandler)serverContext).getContextPath();
+        if (HttpContext.class.isAssignableFrom(serverContext.getClass())) {
+            return ((HttpContext)serverContext).getContextPath();
         } else {
             return null;
         }

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java?view=diff&rev=518860&r1=518859&r2=518860
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java Thu Mar 15 21:27:21 2007
@@ -21,34 +21,42 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
 import java.net.URL;
-
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.helpers.HttpHeaderHelper;
+import org.apache.cxf.io.AbstractWrappedOutputStream;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.AbstractDestination;
+import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transport.https.SSLUtils;
 import org.apache.cxf.transports.http.QueryHandler;
 import org.apache.cxf.transports.http.QueryHandlerRegistry;
-import org.mortbay.jetty.HttpConnection;
-import org.mortbay.jetty.Request;
-import org.mortbay.jetty.handler.AbstractHandler;
-
-
-public class JettyHTTPDestination extends AbstractHTTPDestination {    
+import org.mortbay.http.HttpRequest;
+import org.mortbay.http.HttpResponse;
+import org.mortbay.http.handler.AbstractHttpHandler;
+
+public class JettyHTTPDestination extends AbstractHTTPDestination {
+   
+    public static final String HTTP_REQUEST = JettyHTTPDestination.class.getName() + ".REQUEST";
+    public static final String HTTP_RESPONSE = JettyHTTPDestination.class.getName() + ".RESPONSE";
     
-
     private static final Logger LOG = LogUtils.getL7dLogger(JettyHTTPDestination.class);
-    
+
     protected ServerEngine engine;
     protected ServerEngine alternateEngine;
 
@@ -75,6 +83,7 @@
      */
     public JettyHTTPDestination(Bus b, ConduitInitiator ci, EndpointInfo endpointInfo, ServerEngine eng)
         throws IOException {
+        //Add the defualt port if the address is missing it
         super(b, ci, endpointInfo, true);
         alternateEngine = eng;
     }
@@ -94,8 +103,7 @@
                                                     nurl.getPort(),
                                                     getSslServer());
     }
-
-      
+    
     /**
      * Activate receipt of incoming messages.
      */
@@ -103,71 +111,124 @@
         LOG.log(Level.FINE, "Activating receipt of incoming messages");
         try {
             URL url = new URL(endpointInfo.getAddress());
-            //The handler is bind with the context, 
-            //TODO we need to set the things on on context
             if (contextMatchOnExact()) {
-                engine.addServant(url, new AbstractHandler() {
-                    public void handle(String target, HttpServletRequest req,
-                                       HttpServletResponse resp, int dispatch) throws IOException {
-                        //if (target.equals(getName())) {
-                        doService(req, resp);
-                        //}
+                engine.addServant(url, new AbstractHttpHandler() {
+                    public void handle(String pathInContext, String pathParams, HttpRequest req,
+                                       HttpResponse resp) throws IOException {
+                        if (pathInContext.equals(getName())) {
+                            doService(req, resp);
+                        }
                     }
                 });
             } else {
-                engine.addServant(url, new AbstractHandler() {
-                    public void handle(String target,  HttpServletRequest req,
-                                       HttpServletResponse resp, int dispatch) throws IOException {
-                        //if (target.startsWith(getName())) {
-                        doService(req, resp);
-                        //}
-                    }                        
+                engine.addServant(url, new AbstractHttpHandler() {
+                    public void handle(String pathInContext, String pathParams, HttpRequest req,
+                                       HttpResponse resp) throws IOException {                            
+                        if (pathInContext.startsWith(getName())) {
+                            doService(req, resp);
+                        }
+                    }
                 });
             }
         } catch (Exception e) {
             LOG.log(Level.WARNING, "URL creation failed: ", e);
         }
-    
     }
 
     /**
      * Deactivate receipt of incoming messages.
      */
     protected void deactivate() {
-        LOG.log(Level.INFO, "Deactivating receipt of incoming messages");
-        engine.removeServant(nurl);        
+        LOG.log(Level.FINE, "Deactivating receipt of incoming messages");
+        engine.removeServant(nurl);   
     }
- 
-
     
     /**
+     * @param inMessage the incoming message
+     * @return the inbuilt backchannel
+     */
+    protected Conduit getInbuiltBackChannel(Message inMessage) {
+        HttpResponse response = (HttpResponse)inMessage.get(HTTP_RESPONSE);
+        return new BackChannelConduit(response);
+    }
+   
+
+    /**
      * @return the associated conduit initiator
      */
     protected ConduitInitiator getConduitInitiator() {
         return conduitInitiator;
     }
 
-    
-    protected void doService(HttpServletRequest req, HttpServletResponse resp) throws IOException {
-        Request baseRequest = (req instanceof Request) 
-            ? (Request)req : HttpConnection.getCurrentConnection().getRequest();
-        
+    /**
+     * Copy the request headers into the message.
+     * 
+     * @param message the current message
+     * @param headers the current set of headers
+     */
+    protected void copyRequestHeaders(Message message, Map<String, List<String>> headers) {
+        HttpRequest req = (HttpRequest)message.get(HTTP_REQUEST);
+        for (Enumeration e = req.getFieldNames(); e.hasMoreElements();) {
+            String fname = (String)e.nextElement();
+            List<String> values;
+            if (headers.containsKey(fname)) {
+                values = headers.get(fname);
+            } else {
+                values = new ArrayList<String>();
+                headers.put(HttpHeaderHelper.getHeaderKey(fname), values);
+            }
+            for (Enumeration e2 = req.getFieldValues(fname); e2.hasMoreElements();) {
+                String val = (String)e2.nextElement();
+                values.add(val);
+            }
+        }
+    }
+
+    /**
+     * Copy the response headers into the response.
+     * 
+     * @param message the current message
+     * @param headers the current set of headers
+     */
+    protected void copyResponseHeaders(Message message, HttpResponse response) {
+        Map<?, ?> headers = (Map<?, ?>)message.get(Message.PROTOCOL_HEADERS);
+        if (null != headers) {
+            
+            if (!headers.containsKey(Message.CONTENT_TYPE)) {
+                response.setContentType((String) message.get(Message.CONTENT_TYPE));
+            }
+            
+            for (Iterator<?> iter = headers.keySet().iterator(); iter.hasNext();) {
+                String header = (String)iter.next();
+                List<?> headerList = (List<?>)headers.get(header);
+                for (Object value : headerList) {
+                    response.addField(header, (String)value);
+                }
+            }
+        } else {
+            response.setContentType((String) message.get(Message.CONTENT_TYPE));
+        }
+    }
+
+    protected void doService(HttpRequest req, HttpResponse resp) throws IOException {
         if (getServer().isSetRedirectURL()) {
             resp.sendRedirect(getServer().getRedirectURL());
-            resp.flushBuffer();
-            baseRequest.setHandled(true);
+            resp.commit();
+            req.setHandled(true);
             return;
         }
-        
         QueryHandlerRegistry queryHandlerRegistry = bus.getExtension(QueryHandlerRegistry.class);
         if (queryHandlerRegistry != null) { 
             for (QueryHandler qh : queryHandlerRegistry.getHandlers()) {
-                String requestURL = req.getPathInfo() + "?" + req.getQueryString();
-                if (qh.isRecognizedQuery(requestURL, endpointInfo)) {
-                    resp.setContentType(qh.getResponseContentType(requestURL));
-                    qh.writeResponse(requestURL, endpointInfo, resp.getOutputStream());
-                    resp.getOutputStream().flush();                     
-                    baseRequest.setHandled(true);
+                if (qh.isRecognizedQuery(req.getURI().toString(), endpointInfo)) {
+                    if (resp.getField(HttpHeaderHelper.CONTENT_TYPE) == null) {
+                        resp.addField(HttpHeaderHelper.CONTENT_TYPE, 
+                                      qh.getResponseContentType(req.getURI().toString()));
+                    }
+                    qh.writeResponse(req.getURI().toString(), endpointInfo, resp.getOutputStream());
+                    resp.getOutputStream().flush(); 
+                    resp.commit();
+                    req.setHandled(true);
                     return;
                 }
             }
@@ -177,29 +238,26 @@
         serviceRequest(req, resp);
     }
 
-    protected void serviceRequest(HttpServletRequest req, HttpServletResponse resp)
+    protected void serviceRequest(final HttpRequest req, final HttpResponse resp)
         throws IOException {
-        Request baseRequest = (req instanceof Request) 
-            ? (Request)req : HttpConnection.getCurrentConnection().getRequest();
         try {
             if (LOG.isLoggable(Level.FINE)) {
                 LOG.fine("Service http request on thread: " + Thread.currentThread());
             }
 
-            MessageImpl inMessage = new MessageImpl();            
+            MessageImpl inMessage = new MessageImpl();
+            inMessage.setContent(InputStream.class, req.getInputStream());
             inMessage.put(HTTP_REQUEST, req);
-            inMessage.put(HTTP_RESPONSE, resp);            
+            inMessage.put(HTTP_RESPONSE, resp);
             inMessage.put(Message.HTTP_REQUEST_METHOD, req.getMethod());
-            inMessage.put(Message.PATH_INFO, req.getContextPath() + req.getPathInfo());            
-            inMessage.put(Message.QUERY_STRING, req.getQueryString());
+            inMessage.put(Message.PATH_INFO, req.getPath());
+            inMessage.put(Message.QUERY_STRING, req.getQuery());
             inMessage.put(Message.CONTENT_TYPE, req.getContentType());
-            inMessage.setContent(InputStream.class, req.getInputStream());
             if (!StringUtils.isEmpty(endpointInfo.getAddress())) {
                 inMessage.put(Message.BASE_PATH, new URL(endpointInfo.getAddress()).getPath());
             }
             inMessage.put(Message.FIXED_PARAMETER_ORDER, isFixedParameterOrder());
-            inMessage.put(Message.ASYNC_POST_RESPONSE_DISPATCH, Boolean.TRUE); 
-            
+            inMessage.put(Message.ASYNC_POST_RESPONSE_DISPATCH, Boolean.TRUE);
             setHeaders(inMessage);
             inMessage.setDestination(this);
             
@@ -207,12 +265,126 @@
 
             incomingObserver.onMessage(inMessage);
 
-            resp.flushBuffer();
-            baseRequest.setHandled(true);
+            resp.commit();
+            req.setHandled(true);
         } finally {
             if (LOG.isLoggable(Level.FINE)) {
                 LOG.fine("Finished servicing http request on thread: " + Thread.currentThread());
             }
         }
-    } 
+    }
+
+    protected OutputStream flushHeaders(Message outMessage) throws IOException {
+        updateResponseHeaders(outMessage);
+        Object responseObj = outMessage.get(HTTP_RESPONSE);
+        OutputStream responseStream = null;
+        if (responseObj instanceof HttpResponse) {
+            HttpResponse response = (HttpResponse)responseObj;
+
+            Integer i = (Integer)outMessage.get(Message.RESPONSE_CODE);
+            if (i != null) {
+                int status = i.intValue();
+                /*if (status == HttpURLConnection.HTTP_INTERNAL_ERROR) {
+                    response.setStatus(status, "Fault Occurred");
+                } else if (status == HttpURLConnection.HTTP_ACCEPTED) {
+                    response.setStatus(status, "Accepted");
+                } else {
+                    response.setStatus(status);
+                }*/
+                response.setStatus(status);
+            } else {
+                response.setStatus(HttpURLConnection.HTTP_OK);
+            }
+
+            copyResponseHeaders(outMessage, response);
+            responseStream = response.getOutputStream();
+
+            if (isOneWay(outMessage)) {
+                response.commit();
+            }
+        } else if (null != responseObj) {
+            String m = (new org.apache.cxf.common.i18n.Message("UNEXPECTED_RESPONSE_TYPE_MSG",
+                LOG, responseObj.getClass())).toString();
+            LOG.log(Level.WARNING, m);
+            throw new IOException(m);   
+        } else {
+            String m = (new org.apache.cxf.common.i18n.Message("NULL_RESPONSE_MSG", LOG)).toString();
+            LOG.log(Level.WARNING, m);
+            throw new IOException(m);            
+        }
+
+        if (isOneWay(outMessage)) {
+            outMessage.remove(HTTP_RESPONSE);
+        }
+        return responseStream;
+    }
+
+    /**
+     * Backchannel conduit.
+     */
+    protected class BackChannelConduit 
+        extends AbstractDestination.AbstractBackChannelConduit {
+
+        protected HttpResponse response;
+
+        BackChannelConduit(HttpResponse resp) {
+            response = resp;
+        }
+
+        /**
+         * Send an outbound message, assumed to contain all the name-value
+         * mappings of the corresponding input message (if any). 
+         * 
+         * @param message the message to be sent.
+         */
+        public void send(Message message) throws IOException {
+            message.put(HTTP_RESPONSE, response);
+            message.setContent(OutputStream.class, new WrappedOutputStream(message, response));
+        }
+    }
+
+    /**
+     * Wrapper stream responsible for flushing headers and committing outgoing
+     * HTTP-level response.
+     */
+    private class WrappedOutputStream extends AbstractWrappedOutputStream {
+
+        protected HttpResponse response;
+
+        WrappedOutputStream(Message m, HttpResponse resp) {
+            super(m);
+            response = resp;
+        }
+
+        /**
+         * Perform any actions required on stream flush (freeze headers,
+         * reset output stream ... etc.)
+         */
+        protected void doFlush() throws IOException {
+            if (!alreadyFlushed()) {
+                OutputStream responseStream = flushHeaders(outMessage);
+                if (null != responseStream) {
+                    resetOut(responseStream, true);
+                }
+            }
+        }
+
+        /**
+         * Perform any actions required on stream closure (handle response etc.)
+         */
+        protected void doClose() {
+            commitResponse();
+        }
+
+        protected void onWrite() throws IOException {
+        }
+
+        private void commitResponse() {
+            try {
+                response.commit();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
 }

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPServerEngine.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPServerEngine.java?view=diff&rev=518860&r1=518859&r2=518860
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPServerEngine.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPServerEngine.java Thu Mar 15 21:27:21 2007
@@ -25,35 +25,29 @@
 import java.util.Map;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.configuration.Configurable;
 import org.apache.cxf.configuration.Configurer;
 import org.apache.cxf.configuration.security.SSLServerPolicy;
 import org.apache.cxf.transport.HttpUriMapper;
 import org.apache.cxf.transport.http.listener.HTTPListenerConfigBean;
 import org.apache.cxf.transports.http.configuration.HTTPListenerPolicy;
-import org.mortbay.jetty.AbstractConnector;
-import org.mortbay.jetty.Handler;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.handler.AbstractHandler;
-import org.mortbay.jetty.handler.ContextHandler;
-import org.mortbay.jetty.handler.ContextHandlerCollection;
+import org.mortbay.http.HttpContext;
+import org.mortbay.http.HttpHandler;
+import org.mortbay.http.HttpServer;
+import org.mortbay.http.SocketListener;
+import org.mortbay.http.handler.AbstractHttpHandler;
 
 
 
-
-
-public final class JettyHTTPServerEngine extends HTTPListenerConfigBean 
-    implements ServerEngine, Configurable {
+public final class JettyHTTPServerEngine extends HTTPListenerConfigBean implements ServerEngine {
     private static final long serialVersionUID = 1L;
     
     private static Map<Integer, JettyHTTPServerEngine> portMap =
         new HashMap<Integer, JettyHTTPServerEngine>();
    
     private int servantCount;
-    private Server server;
-    private AbstractConnector connector;
-    private JettyConnectorFactory connectorFactory;
-    private ContextHandlerCollection contexts;
+    private HttpServer server;
+    private SocketListener listener;
+    private JettyListenerFactory listenerFactory;
     private final int port;
     
     JettyHTTPServerEngine(Bus bus, String protocol, int p) {
@@ -87,15 +81,14 @@
         JettyHTTPServerEngine ref = portMap.remove(p);
         if (ref != null && ref.server != null) {
             try {
-                //NEED to check again
-                ref.connector.close();
-                ref.server.stop();
+                ref.listener.getServerSocket().close();
+                ref.server.stop(true);
                 ref.server.destroy();
                 ref.server = null;
                 ref.listener = null;
-            } catch (IOException ex) {
+            } catch (InterruptedException ex) {
                 ex.printStackTrace();
-            } catch (Exception ex) {
+            } catch (IOException ex) {
                 ex.printStackTrace();
             }
             
@@ -108,56 +101,62 @@
      * @param url the URL associated with the servant
      * @param handler notified on incoming HTTP requests
      */
-    public synchronized void addServant(URL url, AbstractHandler handler) {
+    public synchronized void addServant(URL url, AbstractHttpHandler handler) {
         if (server == null) {
-            server = new Server();            
-            connector = connectorFactory.createConnector(port);
-            //TODO Get the detail configuration 
-            /* set up the connector's paraments
+            server = new HttpServer();
+            
+            listener = listenerFactory.createListener(port);
+           
             if (getListener().isSetMinThreads()) {
-                connector.getThreadPool()..setMinThreads(getListener().getMinThreads());
+                listener.setMinThreads(getListener().getMinThreads());
             }
             if (getListener().isSetMaxThreads()) {
-                connector.setMaxThreads(getListener().getMaxThreads());            
+                listener.setMaxThreads(getListener().getMaxThreads());            
             }
             if (getListener().isSetMaxIdleTimeMs()) {
-                connector.setMaxIdleTimeMs(getListener().getMaxIdleTimeMs().intValue());
+                listener.setMaxIdleTimeMs(getListener().getMaxIdleTimeMs().intValue());
             }
             if (getListener().isSetLowResourcePersistTimeMs()) {
                 int lowResourcePersistTime = 
                     getListener().getLowResourcePersistTimeMs().intValue();
-                connector.setLowResourcePersistTimeMs(lowResourcePersistTime);
-            }*/
-            server.addConnector(connector);
-            contexts = new ContextHandlerCollection();
-            server.addHandler(contexts);
+                listener.setLowResourcePersistTimeMs(lowResourcePersistTime);
+            }
+
+            server.addListener(listener);
             try {
                 server.start();
             } catch (Exception e) {
                 e.printStackTrace();
                 //problem starting server
                 try {
-                    server.stop();
+                    server.stop(true);
                     server.destroy();
-                } catch (Exception ex) {
+                } catch (InterruptedException ex) {
                     ex.printStackTrace();
                 }    
             }
         }
-        String contextName = HttpUriMapper.getContextName(url.getPath());       
         
-        ContextHandler context = new ContextHandler();
-        context.setContextPath(contextName);
-        context.setHandler(handler);
-        contexts.addHandler(context);
-        if (contexts.isStarted()) {           
-            try {                
-                context.start();
-            } catch (Exception e1) {
-                e1.printStackTrace();
-            }
+        String contextName = HttpUriMapper.getContextName(url.getPath());
+        final String smap = HttpUriMapper.getResourceBase(url.getPath());
+        
+        HttpContext context = server.getContext(contextName);
+        try {
+            context.start();
+        } catch (Exception e1) {
+            // TODO Auto-generated catch block
+            e1.printStackTrace();
         }
         
+        handler.setName(smap);        
+        context.addHandler(handler);
+        
+        try {
+            handler.start();
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
         ++servantCount;
     }
     
@@ -166,27 +165,25 @@
      * 
      * @param url the URL the servant was registered against.
      */
-    public synchronized void removeServant(URL url) {
-        String contextName = HttpUriMapper.getContextName(url.getPath());
+    public synchronized void removeServant(URL url) {        
         
+        String contextName = HttpUriMapper.getContextName(url.getPath());
+        final String smap = HttpUriMapper.getResourceBase(url.getPath());
+
         boolean found = false;
         // REVISIT: how come server can be null?
-        if (server != null) {            
-            for (Handler handler : contexts.getChildHandlersByClass(ContextHandler.class)) {
-                ContextHandler contextHandler = null;                
-                if (handler instanceof ContextHandler) {
-                    contextHandler = (ContextHandler) handler;
-                    if (contextName.equals(contextHandler.getContextPath())) {
-                        try {
-                            contexts.removeHandler(handler);
-                            handler.stop();
-                            handler.destroy();
-                        } catch (Exception e) {
-                            // TODO Auto-generated catch block
-                            e.printStackTrace();
-                        }                                                
-                        found = true;
+        if (server != null) {
+            HttpContext context = server.getContext(contextName);
+            for (HttpHandler handler : context.getHandlers()) {
+                if (smap.equals(handler.getName())) {
+                    try {
+                        handler.stop();
+                    } catch (InterruptedException e) {
+                        // TODO Auto-generated catch block
+                        e.printStackTrace();
                     }
+                    context.removeHandler(handler);
+                    found = true;
                 }
             }
         }
@@ -209,20 +206,18 @@
      * @param url the associated URL
      * @return the HttpHandler if registered
      */
-    public synchronized Handler getServant(URL url)  {
+    public synchronized HttpHandler getServant(URL url)  {
         String contextName = HttpUriMapper.getContextName(url.getPath());
+        final String smap = HttpUriMapper.getResourceBase(url.getPath());
         
-        Handler ret = null;
+        HttpHandler ret = null;
         // REVISIT: how come server can be null?
         if (server != null) {
-            for (Handler handler : server.getChildHandlersByClass(ContextHandler.class)) {
-                ContextHandler contextHandler = null;
-                if (handler instanceof ContextHandler) {
-                    contextHandler = (ContextHandler) handler;
-                    if (contextName.equals(contextHandler.getContextPath())) {           
-                        ret = contextHandler.getHandler();
-                        break;
-                    }    
+            HttpContext context = server.getContext(contextName);
+            for (HttpHandler handler : context.getHandlers()) {
+                if (smap.equals(handler.getName())) {
+                    ret = handler;
+                    break;
                 }
             }
         }
@@ -237,7 +232,7 @@
     }
 
     private void retrieveListenerFactory() {
-        connectorFactory = HTTPTransportFactory.getConnectorFactory(getSslServer());
+        listenerFactory = HTTPTransportFactory.getListenerFactory(getSslServer());
     }
     
     private void init(SSLServerPolicy sslServerPolicy) {

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/ServerEngine.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/ServerEngine.java?view=diff&rev=518860&r1=518859&r2=518860
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/ServerEngine.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/ServerEngine.java Thu Mar 15 21:27:21 2007
@@ -21,8 +21,8 @@
 
 import java.net.URL;
 
-import org.mortbay.jetty.Handler;
-import org.mortbay.jetty.handler.AbstractHandler;
+import org.mortbay.http.HttpHandler;
+import org.mortbay.http.handler.AbstractHttpHandler;
 
 public interface ServerEngine {
     /**
@@ -31,7 +31,7 @@
      * @param url the URL associated with the servant
      * @param handler notified on incoming HTTP requests
      */
-    void addServant(URL url, AbstractHandler handler);
+    void addServant(URL url, AbstractHttpHandler handler);
     
     /**
      * Remove a previously registered servant.
@@ -46,5 +46,5 @@
      * @param url the associated URL
      * @return the HttpHandler if registered
      */
-    Handler getServant(URL url);
+    HttpHandler getServant(URL url);
 }

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java?view=diff&rev=518860&r1=518859&r2=518860
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java Thu Mar 15 21:27:21 2007
@@ -95,8 +95,6 @@
         String trustStoreMgrFactoryAlgorithm =
             SSLUtils.getTrustStoreAlgorithm(sslPolicy.getTrustStoreAlgorithm(),
                                             LOG);
-        String[] cipherSuites =
-            SSLUtils.getCiphersuites(sslPolicy.getCiphersuites(), LOG);
         String trustStoreLocation =
             SSLUtils.getTrustStore(sslPolicy.getTrustStore(), LOG);
         String trustStoreType =
@@ -106,10 +104,10 @@
                                              LOG);
         
         try {
-            SSLContext sslctx = SSLContext.getInstance(secureSocketProtocol);
             boolean pkcs12 =
                 keyStoreType.equalsIgnoreCase(SSLUtils.PKCS12_TYPE);
-            sslctx.init(
+            SSLContext ctx = SSLUtils.getSSLContext(
+                secureSocketProtocol,
                 SSLUtils.getKeyStoreManagers(keyStoreLocation,
                                              keyStoreType,
                                              keyStorePassword,
@@ -121,10 +119,15 @@
                                                trustStoreType,
                                                trustStoreLocation,
                                                trustStoreMgrFactoryAlgorithm,
-                                               LOG),
-                null);
+                                               LOG));
+            
+            String[] cipherSuites =
+                SSLUtils.getCiphersuites(sslPolicy.getCiphersuites(),
+                                         SSLUtils.getSupportedCipherSuites(ctx),
+                                         sslPolicy.getCiphersuiteFilters(),
+                                         LOG);
             secureConnection.setSSLSocketFactory(
-                new SSLSocketFactoryWrapper(sslctx.getSocketFactory(),
+                new SSLSocketFactoryWrapper(ctx.getSocketFactory(),
                                             cipherSuites));
         } catch (Exception e) {
             LogUtils.log(LOG, Level.SEVERE, "SSL_CONTEXT_INIT_FAILURE", e);

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/Messages.properties?view=diff&rev=518860&r1=518859&r2=518860
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/Messages.properties (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/Messages.properties Thu Mar 15 21:27:21 2007
@@ -51,8 +51,15 @@
 WANT_CLIENT_AUTHENTICATION_NOT_SET = Want client authentication has not been set explicitly in configuration so defaulting to false.
 WANT_CLIENT_AUTHENTICATION_SET = Want client authentication is set to {0}.
 KEY_PASSWORD_NOT_SAME_KEYSTORE_PASSWORD = The value specified for the keystore password is different to the key password. Currently limitations in JSSE requires that they should be the same. The keystore password value will be used only.
-CIPHERSUITE_SET = The cipher suite has been set to {0}.  
-CIPHERSUITE_NOT_SET = The cipher suite has not been set, default values will be used.
+CIPHERSUITES_SET = The cipher suites have been set to {0}.  
+CIPHERSUITES_NOT_SET = The cipher suites have not been configured, falling back to cipher suite filters.
+CIPHERSUITE_FILTERS_NOT_SET = The cipher suite filters have not been configured, falling back to default filters.
+CIPHERSUITE_FILTER = Ciphersuite filter: 
+CIPHERSUITE_INCLUDED = The {0} cipher suite is included by the filter.
+CIPHERSUITE_EXCLUDED = The {0} cipher suite is excluded by the filter.
+CIPHERSUITE_INCLUDE_FILTER = Ciphersuite include filter: {0}
+CIPHERSUITE_EXCLUDE_FILTER = Ciphersuite exclude filter: {0}
+CIPHERSUITES_FILTERED = The enabled cipher suites have been filtered down to {0}.  
 SUCCESS_INVOKING_SECURITY_CONFIGURER = The custom security configurer {0} configure method was called successfully.
 ERROR_INVOKING_SECURITY_CONFIGURER = Failure invoking on custom security configurer {0}, exception reported is {1}.
 KEY_STORE_ALGORITHM_NOT_SET = The keystore key manager factory algorithm has not been set in configuration so the default value {0} will be used.

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLSocketFactoryWrapper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLSocketFactoryWrapper.java?view=diff&rev=518860&r1=518859&r2=518860
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLSocketFactoryWrapper.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLSocketFactoryWrapper.java Thu Mar 15 21:27:21 2007
@@ -55,76 +55,45 @@
     
     public Socket createSocket(Socket s, String host, int port, boolean autoClose)
         throws IOException, UnknownHostException  {
-        
-        SSLSocket socket = null;
-        socket = (SSLSocket)sslSocketFactory.createSocket(s, host, port, autoClose);
-        if ((socket != null) && (ciphers != null)) {
-            socket.setEnabledCipherSuites(ciphers);
-        }
-
-        return socket; 
+        return enableCipherSuites(sslSocketFactory.createSocket(s, host, port, autoClose),
+                                  new Object[]{host, port});
     }
 
     public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
-        SSLSocket socket = null;
-        socket = (SSLSocket)sslSocketFactory.createSocket(host, port);
-        if ((socket != null) && (ciphers != null)) {
-            socket.setEnabledCipherSuites(ciphers);
-        }
-        if (socket == null) {
-            LogUtils.log(LOG, Level.SEVERE, "PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET", 
-                         new Object[]{host, port});
-        }
-        return socket; 
+        return enableCipherSuites(sslSocketFactory.createSocket(host, port),
+                                  new Object[]{host, port});
     }
 
-
     public Socket createSocket(String host, int port, InetAddress localHost, int localPort) 
         throws IOException, UnknownHostException {
-        SSLSocket socket = null;
-        socket = (SSLSocket)sslSocketFactory.createSocket(host, port, localHost, localPort);
-        if ((socket != null) && (ciphers != null)) {
-            socket.setEnabledCipherSuites(ciphers);
-        }
-
-        if (socket == null) {
-            LogUtils.log(LOG, Level.SEVERE, "PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET", 
-                         new Object[]{host, port});
-        }
-        return socket;
+        return enableCipherSuites(sslSocketFactory.createSocket(host, port, localHost, localPort),
+                                  new Object[]{host, port});
     }
 
-
     public Socket createSocket(InetAddress host, int port) throws IOException {
-        SSLSocket socket = null;
-        socket = (SSLSocket)sslSocketFactory.createSocket(host, port);
-        if ((socket != null) && (ciphers != null)) {
-            socket.setEnabledCipherSuites(ciphers);
-        }
-
-        if (socket == null) {
-            LogUtils.log(LOG, Level.SEVERE, "PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET", 
-                         new Object[]{host, port});
-        }
-        return socket;
+        return enableCipherSuites(sslSocketFactory.createSocket(host, port),
+                                  new Object[]{host, port});
     }
 
-
     public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) 
         throws IOException {
-        SSLSocket socket = null;
-        socket = (SSLSocket)sslSocketFactory.createSocket(address, port, localAddress, localPort);
+        return enableCipherSuites(sslSocketFactory.createSocket(address, port, localAddress, localPort),
+                                  new Object[]{address, port});
+    }
+    
+    private Socket enableCipherSuites(Socket s, Object[] logParams) {
+        SSLSocket socket = (SSLSocket)s;
         if ((socket != null) && (ciphers != null)) {
             socket.setEnabledCipherSuites(ciphers);
         }
 
         if (socket == null) {
-            LogUtils.log(LOG, Level.SEVERE, "PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET", 
-                         new Object[]{address, port});
+            LogUtils.log(LOG, Level.SEVERE,
+                         "PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET", 
+                         logParams);
         }
-        return socket;
+        return socket;        
     }
-    
     /*
      * For testing only
      */

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLUtils.java?view=diff&rev=518860&r1=518859&r2=518860
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLUtils.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/SSLUtils.java Thu Mar 15 21:27:21 2007
@@ -25,25 +25,36 @@
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.lang.reflect.Method;
+import java.security.KeyManagementException;
 import java.security.KeyStore;
+import java.security.NoSuchAlgorithmException;
 import java.security.cert.Certificate;
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import javax.net.ssl.KeyManager;
 import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLPeerUnverifiedException;
 import javax.net.ssl.SSLSession;
+import javax.net.ssl.SSLSocket;
 import javax.net.ssl.TrustManager;
 import javax.net.ssl.TrustManagerFactory;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.configuration.security.FiltersType;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.security.transport.TLSSessionInfo;
+import org.mortbay.http.HttpConnection;
+import org.mortbay.http.HttpRequest;
 
 /**
  * Holder for utility methods related to manipulating SSL settings, common
@@ -58,10 +69,19 @@
     private static final String DEFAULT_SECURE_SOCKET_PROTOCOL = "TLSv1";
     private static final String CERTIFICATE_FACTORY_TYPE = "X.509";
     private static final String SERVLET_SSL_SESSION_ATTRIBUTE = "javax.net.ssl.session";
-
+    
     private static final boolean DEFAULT_REQUIRE_CLIENT_AUTHENTICATION = false;
     private static final boolean DEFAULT_WANT_CLIENT_AUTHENTICATION = true;
     
+    /**
+     * By default, only include export-compatible ciphersuites.
+     */
+    private static final List<String> DEFAULT_CIPHERSUITE_FILTERS_INCLUDE =
+        Arrays.asList(new String[] {".*_EXPORT_.*",
+                                    ".*_EXPORT1024_.*",
+                                    ".*_WITH_DES_.*",
+                                    ".*_WITH_NULL_.*"});
+
 
     private SSLUtils() {
     }    
@@ -120,7 +140,7 @@
         if ((keyStorePassword == null) && (keyStoreLocation != null)) {
             LogUtils.log(log, Level.WARNING,
                          "FAILED_TO_LOAD_KEYSTORE_NULL_PASSWORD", 
-                         new Object[]{keyStoreLocation});
+                         keyStoreLocation);
         }
         return keystoreManagers;
     }
@@ -139,7 +159,7 @@
             LogUtils.log(log,
                          Level.INFO,
                          "LOADED_KEYSTORE",
-                         new Object[]{keyStoreLocation});
+                         keyStoreLocation);
         } catch (Exception e) {
             LogUtils.log(log,
                          Level.WARNING,
@@ -186,10 +206,7 @@
         TrustManagerFactory tmf  = 
             TrustManagerFactory.getInstance(trustStoreMgrFactoryAlgorithm);
         tmf.init(trustedCertStore);
-        LogUtils.log(log,
-                     Level.INFO,
-                     "LOADED_TRUST_STORE",
-                     new Object[]{trustStoreLocation});
+        LogUtils.log(log, Level.INFO, "LOADED_TRUST_STORE", trustStoreLocation);
         trustStoreManagers = tmf.getTrustManagers();
 
         return trustStoreManagers;
@@ -242,7 +259,7 @@
                 logMsg = "KEY_STORE_NOT_SET";
             }
         }
-        LogUtils.log(log, Level.INFO, logMsg, new Object[]{keyStoreLocation});
+        LogUtils.log(log, Level.INFO, logMsg, keyStoreLocation);
         return keyStoreLocation;
     }
     
@@ -254,7 +271,7 @@
             keyStoreType = DEFAULT_KEYSTORE_TYPE;
             logMsg = "KEY_STORE_TYPE_NOT_SET";
         }
-        LogUtils.log(log, Level.INFO, logMsg, new Object[]{keyStoreType});
+        LogUtils.log(log, Level.INFO, logMsg, keyStoreType);
         return keyStoreType;
     }  
     
@@ -300,8 +317,7 @@
                 KeyManagerFactory.getDefaultAlgorithm();
             logMsg = "KEY_STORE_ALGORITHM_NOT_SET";
         }
-        LogUtils.log(log, Level.INFO, logMsg, 
-                     new Object[] {keyStoreMgrFactoryAlgorithm});
+        LogUtils.log(log, Level.INFO, logMsg, keyStoreMgrFactoryAlgorithm);
         return keyStoreMgrFactoryAlgorithm;
     } 
     
@@ -316,33 +332,119 @@
                 TrustManagerFactory.getDefaultAlgorithm();
             logMsg = "TRUST_STORE_ALGORITHM_NOT_SET";
         }
-        LogUtils.log(log, Level.INFO, logMsg, 
-                     new Object[] {trustStoreMgrFactoryAlgorithm});
+        LogUtils.log(log, Level.INFO, logMsg, trustStoreMgrFactoryAlgorithm);
         return trustStoreMgrFactoryAlgorithm;
     }    
     
+    public static SSLContext getSSLContext(String protocol,
+                                           KeyManager[] keyStoreManagers,
+                                           TrustManager[] trustStoreManagers)
+        throws NoSuchAlgorithmException, KeyManagementException {
+        SSLContext ctx = SSLContext.getInstance(protocol);
+        ctx.init(keyStoreManagers, trustStoreManagers, null);
+        return ctx;
+    }
+    
+    public static String[] getSupportedCipherSuites(SSLContext context) {
+        return context.getSocketFactory().getSupportedCipherSuites();
+    }
+
+    public static String[] getServerSupportedCipherSuites(SSLContext context) {
+        return context.getServerSocketFactory().getSupportedCipherSuites();
+    }
+
     public static String[] getCiphersuites(List<String> cipherSuitesList,
+                                           String[] supportedCipherSuites,
+                                           FiltersType filters,
                                            Logger log) {
         String[] cipherSuites = null;
         if (!(cipherSuitesList == null || cipherSuitesList.isEmpty())) {
-            int numCipherSuites = cipherSuitesList.size();
-            cipherSuites = new String[numCipherSuites];
-            String ciphsStr = null;
-            for (int i = 0; i < numCipherSuites; i++) {
-                cipherSuites[i] = cipherSuitesList.get(i);
-                if (ciphsStr == null) {
-                    ciphsStr = cipherSuites[i];
+            cipherSuites = getCiphersFromList(cipherSuitesList, log);
+        } else {
+            LogUtils.log(log, Level.INFO, "CIPHERSUITES_NOT_SET");
+            if (filters == null) {
+                LogUtils.log(log, Level.INFO, "CIPHERSUITE_FILTERS_NOT_SET");                
+            }
+            List<String> filteredCipherSuites = new ArrayList<String>();
+            List<Pattern> includes =
+                filters != null
+                ? compileRegexPatterns(filters.getInclude(), true, log)
+                : compileRegexPatterns(DEFAULT_CIPHERSUITE_FILTERS_INCLUDE, true, log);
+            List<Pattern> excludes =
+                filters != null
+                ? compileRegexPatterns(filters.getExclude(), false, log)
+                : null;
+            for (int i = 0; i < supportedCipherSuites.length; i++) {
+                if (matchesOneOf(supportedCipherSuites[i], includes)
+                    && !matchesOneOf(supportedCipherSuites[i], excludes)) {
+                    LogUtils.log(log,
+                                 Level.INFO,
+                                 "CIPHERSUITE_INCLUDED",
+                                 supportedCipherSuites[i]);
+                    filteredCipherSuites.add(supportedCipherSuites[i]);
                 } else {
-                    ciphsStr += ", " + cipherSuites[i];
+                    LogUtils.log(log,
+                                 Level.INFO,
+                                 "CIPHERSUITE_EXCLUDED",
+                                 supportedCipherSuites[i]);
                 }
             }
-            LogUtils.log(log, Level.INFO, "CIPHERSUITE_SET", new Object[]{ciphsStr});
-        } else {
-            LogUtils.log(log, Level.INFO, "CIPHERSUITE_NOT_SET");
-        }
+            LogUtils.log(log,
+                         Level.INFO,
+                         "CIPHERSUITES_FILTERED",
+                         filteredCipherSuites);
+            cipherSuites = getCiphersFromList(filteredCipherSuites, log);
+        } 
         return cipherSuites;
     }         
     
+    private static List<Pattern> compileRegexPatterns(List<String> regexes,
+                                                      boolean include,
+                                                      Logger log) {
+        List<Pattern> patterns = new ArrayList<Pattern>();
+        if (regexes != null) {
+            String msg = include
+                         ? "CIPHERSUITE_INCLUDE_FILTER"
+                         : "CIPHERSUITE_EXCLUDE_FILTER";
+            for (String s : regexes) {
+                LogUtils.log(log, Level.INFO, msg, s);
+                patterns.add(Pattern.compile(s));
+            }
+        }
+        return patterns;
+    }
+    
+    private static boolean matchesOneOf(String s, List<Pattern> patterns) {
+        boolean matches = false;
+        if (patterns != null) {
+            for (Pattern pattern : patterns) {
+                Matcher matcher = pattern.matcher(s);
+                if (matcher.matches()) {
+                    matches = true;
+                    break;
+                }
+            }
+        }
+        return matches;
+    }
+    
+    private static String[] getCiphersFromList(List<String> cipherSuitesList,
+                                               Logger log) {
+        int numCipherSuites = cipherSuitesList.size();
+        String[] cipherSuites = new String[numCipherSuites];
+        String ciphsStr = null;
+        for (int i = 0; i < numCipherSuites; i++) {
+            cipherSuites[i] = cipherSuitesList.get(i);
+            if (ciphsStr == null) {
+                ciphsStr = cipherSuites[i];
+            } else {
+                ciphsStr += ", " + cipherSuites[i];
+            }
+        }
+        LogUtils.log(log, Level.INFO, "CIPHERSUITES_SET", ciphsStr);
+        return cipherSuites;
+    }
+    
     public static String getTrustStore(String trustStoreLocation, Logger log) {
         String logMsg = null;
         if (trustStoreLocation != null) {
@@ -357,7 +459,7 @@
                 logMsg = "TRUST_STORE_NOT_SET";
             }
         }
-        LogUtils.log(log, Level.INFO, logMsg, new Object[]{trustStoreLocation});
+        LogUtils.log(log, Level.INFO, logMsg, trustStoreLocation);
         return trustStoreLocation;
     }
     
@@ -370,7 +472,7 @@
             trustStoreType = DEFAULT_TRUST_STORE_TYPE;
             logMsg = "TRUST_STORE_TYPE_NOT_SET";
         }
-        LogUtils.log(log, Level.INFO, logMsg, new Object[]{trustStoreType});
+        LogUtils.log(log, Level.INFO, logMsg, trustStoreType);
         return trustStoreType;
     }
     
@@ -380,7 +482,7 @@
             LogUtils.log(log,
                          Level.INFO,
                          "SECURE_SOCKET_PROTOCOL_SET",
-                         new Object[] {secureSocketProtocol});
+                         secureSocketProtocol);
         } else {
             LogUtils.log(log, Level.INFO, "SECURE_SOCKET_PROTOCOL_NOT_SET");
             secureSocketProtocol = DEFAULT_SECURE_SOCKET_PROTOCOL;
@@ -400,7 +502,7 @@
             LogUtils.log(log,
                          Level.INFO,
                          "REQUIRE_CLIENT_AUTHENTICATION_SET", 
-                         new Object[]{requireClientAuthentication});
+                         requireClientAuthentication);
         } else {
             LogUtils.log(log,
                          Level.WARNING,
@@ -421,7 +523,7 @@
             LogUtils.log(log,
                          Level.INFO,
                          "WANT_CLIENT_AUTHENTICATION_SET", 
-                         new Object[]{wantClientAuthentication});
+                         wantClientAuthentication);
         } else {
             LogUtils.log(log,
                          Level.WARNING,
@@ -437,24 +539,28 @@
      * @param req the Jetty request
      * @param message the Message
      */
-    public static void propogateSecureSession(HttpServletRequest request,
-                                              Message message) {    
-        SSLSession session = 
-            (SSLSession) request.getAttribute("javax.net.ssl.session");
-        if (session != null) {
-            Certificate[] certs = null;
-            try {
-                certs = session.getPeerCertificates();
-            } catch (final SSLPeerUnverifiedException e) {
-                // peer has not been verified
+    public static void propogateSecureSession(HttpRequest req,
+                                              Message message) {
+        final HttpConnection httpCon = req.getHttpConnection();
+        if (httpCon != null) {
+            final Object connection = httpCon.getConnection();
+            if (connection instanceof SSLSocket) {
+                final SSLSocket socket = (SSLSocket) connection;
+                final SSLSession session = socket.getSession();
+                Certificate[] certs = null;
+                try {
+                    certs = session.getPeerCertificates();
+                } catch (final SSLPeerUnverifiedException e) {
+                    // peer has not been verified
+                }
+                message.put(TLSSessionInfo.class,
+                            new TLSSessionInfo(session.getCipherSuite(),
+                                               session,
+                                               certs));
             }
-            message.put(TLSSessionInfo.class,
-                        new TLSSessionInfo(session.getCipherSuite(),
-                                           session,
-                                           certs));
         }
     }
-    
+
     /**
      * Propogate in the message a TLSSessionInfo instance representative  
      * of the TLS-specific information in the HTTP request.
@@ -506,7 +612,7 @@
                          client
                          ? "UNSUPPORTED_SSL_CLIENT_POLICY_DATA"
                          : "UNSUPPORTED_SSL_SERVER_POLICY_DATA",
-                         new Object[]{policy});
+                         policy);
         }    
     }
     

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java?view=diff&rev=518860&r1=518859&r2=518860
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java Thu Mar 15 21:27:21 2007
@@ -85,7 +85,7 @@
 
     public void init(ServletConfig servletConfig) throws ServletException {
         super.init(servletConfig);
-
+        
         String busid = servletConfig.getInitParameter("bus.id");
         if (null != busid) {
             WeakReference<Bus> ref = BUS_MAP.get(busid);
@@ -97,6 +97,7 @@
             // try to pull an existing ApplicationContext out of the
             // ServletContext
             ServletContext svCtx = getServletContext();
+
             
             // Spring 1.x
             ApplicationContext ctx = (ApplicationContext)svCtx

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?view=diff&rev=518860&r1=518859&r2=518860
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java Thu Mar 15 21:27:21 2007
@@ -51,14 +51,16 @@
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.tools.common.extensions.soap.SoapAddress;
 import org.apache.cxf.tools.util.SOAPBindingUtil;
-import org.apache.cxf.transport.http.AbstractHTTPDestination;
 import org.apache.cxf.transport.https.SSLUtils;
 import org.apache.cxf.transports.http.QueryHandler;
 import org.apache.cxf.transports.http.QueryHandlerRegistry;
 import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
 import org.xmlsoap.schemas.wsdl.http.AddressType;
 
-public class ServletController {   
+public class ServletController {
+
+    static final String HTTP_REQUEST = "HTTP_SERVLET_REQUEST";
+    static final String HTTP_RESPONSE = "HTTP_SERVLET_RESPONSE";
 
     private static final Logger LOG = Logger.getLogger(ServletController.class.getName());
 
@@ -66,7 +68,7 @@
     private ServletContext servletContext;
     private CXFServlet cxfServlet;
     private URL wsdlLocation;
-    
+
     public ServletController(ServletTransportFactory df, ServletContext servCont, CXFServlet servlet) {
         this.transport = df;
         this.servletContext = servCont;
@@ -116,7 +118,7 @@
     
     public void setWsdlLocation(URL location) {
         this.wsdlLocation = location;
-    }   
+    }
     
     private void generateServiceList(HttpServletRequest request, HttpServletResponse response)
         throws IOException {
@@ -145,7 +147,6 @@
         response.setHeader(HttpHeaderHelper.CONTENT_TYPE, "text/xml");
         try {
             OutputStream os = response.getOutputStream();
-                 
             ExtendedURIResolver resolver = new ExtendedURIResolver();
             Source source = null;
             if (wsdlLocation != null) {
@@ -155,7 +156,6 @@
             } else {
                 source = new StreamSource(servletContext.getResourceAsStream("/WEB-INF/wsdl/" + xsdName));
             }
-            
             Result result = new StreamResult(os);
             TransformerFactory.newInstance().newTransformer().transform(source, result);
             response.getOutputStream().flush();
@@ -179,8 +179,8 @@
         try {
             MessageImpl inMessage = new MessageImpl();
             inMessage.setContent(InputStream.class, request.getInputStream());
-            inMessage.put(AbstractHTTPDestination.HTTP_REQUEST, request);
-            inMessage.put(AbstractHTTPDestination.HTTP_RESPONSE, response);
+            inMessage.put(HTTP_REQUEST, request);
+            inMessage.put(HTTP_RESPONSE, response);
             inMessage.put(Message.HTTP_REQUEST_METHOD, request.getMethod());
             inMessage.put(Message.PATH_INFO, request.getPathInfo());
             inMessage.put(Message.QUERY_STRING, request.getQueryString());



Mime
View raw message