cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r519327 [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 Sat, 17 Mar 2007 14:38:10 GMT
Author: ningjiang
Date: Sat Mar 17 07:38:09 2007
New Revision: 519327

URL: http://svn.apache.org/viewvc?view=rev&rev=519327
Log:
[CXF-462]Merged the HTTP module with HTTP2

NOTE 
1. The main difference between HTTP and HTTP2 after this merge.
Jetty6's SslSocketConnector is more stable than SslSelectChannelConnector.
I got a NPE when I run the hello_world_https sample with SslSelectChannelConnector.
I replaced the SslSelectChannelConnector with SslSocketConnector in the HTTP module.

2. About the CiphersuiteFiliter
Jetty5 provides the setCiphersuite API, but Jetty6 provides setExcudleCiphersuite API.
I changed the SSLUtils's getCiphersuites() method, added an exclude flage to get the excludedCiphersuite.
 

Added:
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyConnectorFactory.java
      - copied, changed from r518893, 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/http/JettyHTTPHandler.java   (with props)
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslConnectorFactory.java
      - copied, changed from r518893, 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/https/JettySslConnectorFactoryTest.java
      - copied, changed from r518893, 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/JettyListenerFactory.java
    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
    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
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/SSLUtils.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

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=519327&r1=519326&r2=519327
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/pom.xml (original)
+++ incubator/cxf/trunk/rt/transports/http/pom.xml Sat Mar 17 07:38:09 2007
@@ -22,7 +22,7 @@
     <artifactId>cxf-rt-transports-http</artifactId>
     <packaging>jar</packaging>
     <version>2.0-incubator-RC-SNAPSHOT</version>
-    <name>Apache CXF Runtime HTTP transport</name>
+    <name>Apache CXF Runtime HTTP transport (version2)</name>
     <url>http://cwiki.apache.org/CXF</url>
 
     <parent>
@@ -50,28 +50,35 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-tools-common</artifactId>
+            <artifactId>cxf-rt-core</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-core</artifactId>
+            <artifactId>cxf-tools-common</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>jetty</groupId>
-            <artifactId>org.mortbay.jetty</artifactId>
+            <groupId>org.mortbay.jetty</groupId>
+            <artifactId>jetty</artifactId>
+            <version>6.1.2rc0</version>
         </dependency>
         <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-web</artifactId>
+            <groupId>org.mortbay.jetty</groupId>
+            <artifactId>jetty-sslengine</artifactId>
+            <version>6.1.2rc0</version>
         </dependency>
+
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-servlet_2.5_spec</artifactId>
@@ -97,7 +104,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>
@@ -132,6 +139,7 @@
             </plugin>
         </plugins>
     </build>
+
 
 
     <scm>

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=519327&r1=519326&r2=519327
==============================================================================
--- 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 Sat Mar 17 07:38:09 2007
@@ -20,14 +20,24 @@
 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;
@@ -36,9 +46,11 @@
 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;
@@ -48,6 +60,11 @@
  */
 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;
@@ -147,9 +164,51 @@
      * @param message the current message
      * @param headers the current set of headers
      */
-    protected abstract void copyRequestHeaders(Message message,
-                                               Map<String, List<String>> 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);
+            }
+        }
+    }
 
+    /**
+     * 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);
     } 
@@ -157,9 +216,18 @@
     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.
@@ -208,11 +276,119 @@
                         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=519327&r1=519326&r2=519327
==============================================================================
--- 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 Sat Mar 17 07:38:09 2007
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.cxf.transport.http;
 
 import java.io.IOException;
@@ -60,16 +59,15 @@
 
 import static org.apache.cxf.message.Message.DECOUPLED_CHANNEL_MESSAGE;
 
+
 /**
  * HTTP Conduit implementation.
  */
-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 class HTTPConduit extends AbstractConduit implements Configurable {   
     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;
@@ -84,7 +82,7 @@
     private AuthorizationPolicy authorization;
     private AuthorizationPolicy proxyAuthorization;
     private SSLClientPolicy sslClient;
-
+    
 
     /**
      * Constructor
@@ -98,7 +96,7 @@
              ei,
              null);
     }
-    
+
     /**
      * Constructor
      * 
@@ -140,21 +138,18 @@
               : 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.
      * 
@@ -162,7 +157,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);        
@@ -186,7 +181,7 @@
             } else {
                 hc.setInstanceFollowRedirects(false);
                 if (!hc.getRequestMethod().equals("GET")
-                        && getClient().isAllowChunking()) {
+                    && getClient().isAllowChunking()) {
                     hc.setChunkedStreamingMode(2048);
                 }
             }
@@ -220,15 +215,14 @@
      * @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
      */
@@ -402,7 +396,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);
@@ -632,7 +626,7 @@
             incomingObserver.onMessage(inMessage);
         }
     }
-       
+    
     /**
      * Used to set appropriate message properties, exchange etc.
      * as required for an incoming decoupled response (as opposed
@@ -655,11 +649,13 @@
             inMessage.put(Message.RESPONSE_CODE, HttpURLConnection.HTTP_OK);
 
             // remove server-specific properties
-            inMessage.remove(HTTP_REQUEST);
-            inMessage.remove(HTTP_RESPONSE);
+            inMessage.remove(AbstractHTTPDestination.HTTP_REQUEST);
+            inMessage.remove(AbstractHTTPDestination.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=519327&r1=519326&r2=519327
==============================================================================
--- 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 Sat Mar 17 07:38:09 2007
@@ -50,11 +50,12 @@
 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.JettySslListenerFactory;
+import org.apache.cxf.transport.https.JettySslConnectorFactory;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl11.WSDLEndpointFactory;
-import org.mortbay.http.SocketListener;
-import org.mortbay.util.InetAddrPort;
+import org.mortbay.jetty.AbstractConnector;
+//import org.mortbay.jetty.bio.SocketConnector;
+import org.mortbay.jetty.nio.SelectChannelConnector;
 import org.xmlsoap.schemas.wsdl.http.AddressType;
 
 public class HTTPTransportFactory extends AbstractTransportFactory implements ConduitInitiator,
@@ -99,8 +100,7 @@
             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,21 +165,24 @@
                ? 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 JettyListenerFactory getListenerFactory(SSLServerPolicy policy) {
+    
+    protected static JettyConnectorFactory getConnectorFactory(SSLServerPolicy policy) {
         return policy == null
-               ? new JettyListenerFactory() {
-                       public SocketListener createListener(int port) {
-                           return new SocketListener(new InetAddrPort(port));
-                       }
+               ? new JettyConnectorFactory() {                     
+                   public AbstractConnector createConnector(int port) {
+                       SelectChannelConnector result = new SelectChannelConnector();
+                       //SocketConnector result = new SocketConnector();
+                       result.setPort(port);
+                       return result;
                    }
-               : new JettySslListenerFactory(policy);
+               }
+               : new JettySslConnectorFactory(policy);
     }
-}
+}
\ No newline at end of file

Copied: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyConnectorFactory.java (from r518893, incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyListenerFactory.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyConnectorFactory.java?view=diff&rev=519327&p1=incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyListenerFactory.java&r1=518893&p2=incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyConnectorFactory.java&r2=519327
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyListenerFactory.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyConnectorFactory.java Sat Mar 17 07:38:09 2007
@@ -16,20 +16,20 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.cxf.transport.http;
 
-import org.mortbay.http.SocketListener;
+import org.mortbay.jetty.AbstractConnector;
+
 
 /**
  * Encapsulates creation of Jetty listener.
  */
-public interface JettyListenerFactory {
+public interface JettyConnectorFactory {
 
     /**
      * Create a Listener.
      * 
      * @param port the listen port
      */
-    SocketListener createListener(int port);
+    AbstractConnector createConnector(int port);
 }

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=519327&r1=519326&r2=519327
==============================================================================
--- 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 Sat Mar 17 07:38:09 2007
@@ -20,13 +20,13 @@
 package org.apache.cxf.transport.http;
 
 import org.apache.cxf.endpoint.ContextInspector;
-import org.mortbay.http.HttpContext;
+import org.mortbay.jetty.handler.ContextHandler;
 
 public class JettyContextInspector implements ContextInspector {
     
     public String getAddress(Object serverContext) {
-        if (HttpContext.class.isAssignableFrom(serverContext.getClass())) {
-            return ((HttpContext)serverContext).getContextPath();
+        if (ContextHandler.class.isAssignableFrom(serverContext.getClass())) {
+            return ((ContextHandler)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=519327&r1=519326&r2=519327
==============================================================================
--- 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 Sat Mar 17 07:38:09 2007
@@ -21,39 +21,27 @@
 
 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.http.HttpRequest;
-import org.mortbay.http.HttpResponse;
-import org.mortbay.http.handler.AbstractHttpHandler;
+import org.mortbay.jetty.HttpConnection;
+import org.mortbay.jetty.Request;
 
 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);
 
@@ -111,25 +99,8 @@
         LOG.log(Level.FINE, "Activating receipt of incoming messages");
         try {
             URL url = new URL(endpointInfo.getAddress());
-            if (contextMatchOnExact()) {
-                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 AbstractHttpHandler() {
-                    public void handle(String pathInContext, String pathParams, HttpRequest req,
-                                       HttpResponse resp) throws IOException {                            
-                        if (pathInContext.startsWith(getName())) {
-                            doService(req, resp);
-                        }
-                    }
-                });
-            }
+            engine.addServant(url, new JettyHTTPHandler(this, contextMatchOnExact()));
+            
         } catch (Exception e) {
             LOG.log(Level.WARNING, "URL creation failed: ", e);
         }
@@ -141,17 +112,8 @@
     protected void deactivate() {
         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
@@ -160,75 +122,27 @@
         return conduitInitiator;
     }
 
-    /**
-     * 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));
-            }
+   
+   
+    protected void doService(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+        Request baseRequest = (req instanceof Request) 
+            ? (Request)req : HttpConnection.getCurrentConnection().getRequest();
             
-            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.commit();
-            req.setHandled(true);
+            resp.flushBuffer();
+            baseRequest.setHandled(true);
             return;
         }
         QueryHandlerRegistry queryHandlerRegistry = bus.getExtension(QueryHandlerRegistry.class);
         if (queryHandlerRegistry != null) { 
             for (QueryHandler qh : queryHandlerRegistry.getHandlers()) {
-                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);
+                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);
                     return;
                 }
             }
@@ -238,8 +152,10 @@
         serviceRequest(req, resp);
     }
 
-    protected void serviceRequest(final HttpRequest req, final HttpResponse resp)
+    protected void serviceRequest(final HttpServletRequest req, final HttpServletResponse 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());
@@ -250,8 +166,8 @@
             inMessage.put(HTTP_REQUEST, req);
             inMessage.put(HTTP_RESPONSE, resp);
             inMessage.put(Message.HTTP_REQUEST_METHOD, req.getMethod());
-            inMessage.put(Message.PATH_INFO, req.getPath());
-            inMessage.put(Message.QUERY_STRING, req.getQuery());
+            inMessage.put(Message.PATH_INFO, req.getContextPath() + req.getPathInfo()); 
+            inMessage.put(Message.QUERY_STRING, req.getQueryString());
             inMessage.put(Message.CONTENT_TYPE, req.getContentType());
             if (!StringUtils.isEmpty(endpointInfo.getAddress())) {
                 inMessage.put(Message.BASE_PATH, new URL(endpointInfo.getAddress()).getPath());
@@ -265,126 +181,13 @@
 
             incomingObserver.onMessage(inMessage);
 
-            resp.commit();
-            req.setHandled(true);
+            resp.flushBuffer();
+            baseRequest.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();
-            }
-        }
-    }
+   
 }

Added: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPHandler.java?view=auto&rev=519327
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPHandler.java (added)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPHandler.java Sat Mar 17 07:38:09 2007
@@ -0,0 +1,61 @@
+/**
+ * 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.cxf.transport.http;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.mortbay.jetty.handler.AbstractHandler;
+
+public class JettyHTTPHandler extends AbstractHandler {
+    private String urlName;
+    private boolean contextMatchExact;
+    private JettyHTTPDestination jettyHTTPDestination;
+    
+    public JettyHTTPHandler(JettyHTTPDestination jhd, boolean cmExact) {
+        contextMatchExact = cmExact;
+        jettyHTTPDestination = jhd;
+    }
+    
+    public void setName(String name) {
+        urlName = name;
+    }
+    
+    public String getName() {
+        return urlName;
+    }
+    
+    public void handle(String target, HttpServletRequest req,
+                       HttpServletResponse resp, int dispatch) throws IOException {        
+        if (contextMatchExact) {
+            if (target.equals(urlName)) {
+                jettyHTTPDestination.doService(req, resp);
+            }
+        } else {
+            if (target.startsWith(urlName)) {
+                jettyHTTPDestination.doService(req, resp);
+            }
+        }
+    }
+    
+    
+
+}

Propchange: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/JettyHTTPHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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=519327&r1=519326&r2=519327
==============================================================================
--- 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 Sat Mar 17 07:38:09 2007
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.transport.http;
 
-import java.io.IOException;
 import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
@@ -30,11 +29,11 @@
 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.http.HttpContext;
-import org.mortbay.http.HttpHandler;
-import org.mortbay.http.HttpServer;
-import org.mortbay.http.SocketListener;
-import org.mortbay.http.handler.AbstractHttpHandler;
+import org.mortbay.jetty.AbstractConnector;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.ContextHandler;
+import org.mortbay.jetty.handler.ContextHandlerCollection;
 
 
 
@@ -45,9 +44,11 @@
         new HashMap<Integer, JettyHTTPServerEngine>();
    
     private int servantCount;
-    private HttpServer server;
-    private SocketListener listener;
-    private JettyListenerFactory listenerFactory;
+    private Server server;
+    private AbstractConnector connector;
+    private JettyConnectorFactory connectorFactory;
+    private ContextHandlerCollection contexts;
+    
     private final int port;
     
     JettyHTTPServerEngine(Bus bus, String protocol, int p) {
@@ -81,17 +82,15 @@
         JettyHTTPServerEngine ref = portMap.remove(p);
         if (ref != null && ref.server != null) {
             try {
-                ref.listener.getServerSocket().close();
-                ref.server.stop(true);
+                ref.connector.close();
+                ref.server.stop();
                 ref.server.destroy();
                 ref.server = null;
-                ref.listener = null;
-            } catch (InterruptedException ex) {
-                ex.printStackTrace();
-            } catch (IOException ex) {
-                ex.printStackTrace();
-            }
-            
+                ref.listener = null;            
+            } catch (Exception e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }            
         }
     }
     
@@ -101,12 +100,13 @@
      * @param url the URL associated with the servant
      * @param handler notified on incoming HTTP requests
      */
-    public synchronized void addServant(URL url, AbstractHttpHandler handler) {
+    public synchronized void addServant(URL url, JettyHTTPHandler handler) {
         if (server == null) {
-            server = new HttpServer();
+            server = new Server();
             
-            listener = listenerFactory.createListener(port);
-           
+            connector = connectorFactory.createConnector(port);
+            //REVISITION for setup the connector's threadPool
+            /*
             if (getListener().isSetMinThreads()) {
                 listener.setMinThreads(getListener().getMinThreads());
             }
@@ -120,18 +120,20 @@
                 int lowResourcePersistTime = 
                     getListener().getLowResourcePersistTimeMs().intValue();
                 listener.setLowResourcePersistTimeMs(lowResourcePersistTime);
-            }
+            }*/
 
-            server.addListener(listener);
+            server.addConnector(connector);
+            contexts = new ContextHandlerCollection();
+            server.addHandler(contexts);
             try {
                 server.start();
             } catch (Exception e) {
                 e.printStackTrace();
                 //problem starting server
-                try {
-                    server.stop(true);
+                try {                    
+                    server.stop();
                     server.destroy();
-                } catch (InterruptedException ex) {
+                } catch (Exception ex) {
                     ex.printStackTrace();
                 }    
             }
@@ -139,24 +141,19 @@
         
         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();
+        ContextHandler context = new ContextHandler();
+        context.setContextPath(contextName);
+        context.setHandler(handler);
+        contexts.addHandler(context);
+        if (contexts.isStarted()) {           
+            try {                
+                context.start();
+            } catch (Exception ex) {
+                ex.printStackTrace();
+            }
         }
         
         handler.setName(smap);        
-        context.addHandler(handler);
-        
-        try {
-            handler.start();
-        } catch (Exception e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
         ++servantCount;
     }
     
@@ -168,21 +165,39 @@
     public synchronized void removeServant(URL url) {        
         
         String contextName = HttpUriMapper.getContextName(url.getPath());
-        final String smap = HttpUriMapper.getResourceBase(url.getPath());
+        //final String smap = HttpUriMapper.getResourceBase(url.getPath());
 
         boolean found = false;
         // REVISIT: how come server can be null?
         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();
+            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();
+                        }
+                        /*for (Handler httpHandler
+                            : contextHandler.getChildHandlersByClass(JettyHTTPHandler.class)) {
+                            if (smap.equals(((JettyHTTPHandler)httpHandler).getName())) {
+                                contexts.removeHandler(httpHandler);
+                                try {
+                                    handler.stop();                               
+                                    handler.destroy();
+                                } catch (Exception e) {
+                                    // TODO Auto-generated catch block
+                                    e.printStackTrace();
+                                }    
+                            }
+                        
+                        }*/
                     }
-                    context.removeHandler(handler);
                     found = true;
                 }
             }
@@ -206,20 +221,23 @@
      * @param url the associated URL
      * @return the HttpHandler if registered
      */
-    public synchronized HttpHandler getServant(URL url)  {
+    public synchronized Handler getServant(URL url)  {
         String contextName = HttpUriMapper.getContextName(url.getPath());
-        final String smap = HttpUriMapper.getResourceBase(url.getPath());
+        //final String smap = HttpUriMapper.getResourceBase(url.getPath());
         
-        HttpHandler ret = null;
+        Handler ret = null;
         // REVISIT: how come server can be null?
-        if (server != null) {
-            HttpContext context = server.getContext(contextName);
-            for (HttpHandler handler : context.getHandlers()) {
-                if (smap.equals(handler.getName())) {
-                    ret = handler;
-                    break;
+        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;
+                    }
                 }
-            }
+            }    
         }
         return ret;
     }
@@ -232,7 +250,7 @@
     }
 
     private void retrieveListenerFactory() {
-        listenerFactory = HTTPTransportFactory.getListenerFactory(getSslServer());
+        connectorFactory = HTTPTransportFactory.getConnectorFactory(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=519327&r1=519326&r2=519327
==============================================================================
--- 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 Sat Mar 17 07:38:09 2007
@@ -21,8 +21,7 @@
 
 import java.net.URL;
 
-import org.mortbay.http.HttpHandler;
-import org.mortbay.http.handler.AbstractHttpHandler;
+import org.mortbay.jetty.Handler;
 
 public interface ServerEngine {
     /**
@@ -31,7 +30,7 @@
      * @param url the URL associated with the servant
      * @param handler notified on incoming HTTP requests
      */
-    void addServant(URL url, AbstractHttpHandler handler);
+    void addServant(URL url, JettyHTTPHandler handler);
     
     /**
      * Remove a previously registered servant.
@@ -46,5 +45,5 @@
      * @param url the associated URL
      * @return the HttpHandler if registered
      */
-    HttpHandler getServant(URL url);
+    Handler 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=519327&r1=519326&r2=519327
==============================================================================
--- 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 Sat Mar 17 07:38:09 2007
@@ -125,7 +125,7 @@
                 SSLUtils.getCiphersuites(sslPolicy.getCiphersuites(),
                                          SSLUtils.getSupportedCipherSuites(ctx),
                                          sslPolicy.getCiphersuiteFilters(),
-                                         LOG);
+                                         LOG, false);
             secureConnection.setSSLSocketFactory(
                 new SSLSocketFactoryWrapper(ctx.getSocketFactory(),
                                             cipherSuites));

Copied: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslConnectorFactory.java (from r518893, incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslListenerFactory.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslConnectorFactory.java?view=diff&rev=519327&p1=incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslListenerFactory.java&r1=518893&p2=incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslConnectorFactory.java&r2=519327
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslListenerFactory.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/https/JettySslConnectorFactory.java Sat Mar 17 07:38:09 2007
@@ -27,14 +27,14 @@
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.security.SSLServerPolicy;
-import org.apache.cxf.transport.http.JettyListenerFactory;
-import org.mortbay.http.SocketListener;
-import org.mortbay.http.SslListener;
-import org.mortbay.util.InetAddrPort;
+import org.apache.cxf.transport.http.JettyConnectorFactory;
+import org.mortbay.jetty.AbstractConnector;
+import org.mortbay.jetty.security.SslSocketConnector;
 
-public final class JettySslListenerFactory implements JettyListenerFactory {
+
+public final class JettySslConnectorFactory implements JettyConnectorFactory {
     private static final long serialVersionUID = 1L;
-    private static final Logger LOG = LogUtils.getL7dLogger(JettySslListenerFactory.class);    
+    private static final Logger LOG = LogUtils.getL7dLogger(JettySslConnectorFactory.class);    
     
     private static final String[] UNSUPPORTED =
     {"SessionCaching", "SessionCacheKey", "MaxChainLength",
@@ -49,19 +49,21 @@
      * 
      * @param policy the applicable SSLServerPolicy (guaranteed non-null)
      */
-    public JettySslListenerFactory(SSLServerPolicy policy) {
+    public JettySslConnectorFactory(SSLServerPolicy policy) {
         this.sslPolicy = policy;
-    }
+    }    
+    
     
     /**
-     * Create a Listener.
+     * Create a SSL Connector.
      * 
      * @param p the listen port
      */
-    public SocketListener createListener(int port) {
-        SslListener secureListener = new SslListener(new InetAddrPort(port));
-        decorate(secureListener);
-        return secureListener;
+    public AbstractConnector createConnector(int port) {
+        SslSocketConnector secureConnector = new SslSocketConnector();
+        secureConnector.setPort(port);
+        decorate(secureConnector);
+        return secureConnector;
     }
     
     /**
@@ -69,7 +71,7 @@
      * 
      * @param listener the secure listener
      */
-    public void decorate(SslListener secureListener) {
+    public void decorate(SslSocketConnector secureListener) {
         String keyStoreLocation =
             SSLUtils.getKeystore(sslPolicy.getKeystore(), LOG);
         secureListener.setKeystore(keyStoreLocation);
@@ -85,7 +87,7 @@
         String keyStoreMgrFactoryAlgorithm =
             SSLUtils.getKeystoreAlgorithm(sslPolicy.getKeystoreAlgorithm(),
                                           LOG);
-        secureListener.setAlgorithm(keyStoreMgrFactoryAlgorithm);
+        secureListener.setSslKeyManagerFactoryAlgorithm(keyStoreMgrFactoryAlgorithm);
         
         System.setProperty("javax.net.ssl.trustStore",
                            SSLUtils.getTrustStore(sslPolicy.getTrustStore(),
@@ -94,7 +96,7 @@
             SSLUtils.getSecureSocketProtocol(sslPolicy.getSecureSocketProtocol(),
                                              LOG);
         secureListener.setProtocol(secureSocketProtocol);
-        
+        //need to Check it
         secureListener.setWantClientAuth(
             SSLUtils.getWantClientAuthentication(
                                    sslPolicy.isSetWantClientAuthentication(),
@@ -117,11 +119,11 @@
                                              secureSocketProtocol,
                                              LOG),
                 null);
-            secureListener.setCipherSuites(
+            secureListener.setExcludeCipherSuites(
                 SSLUtils.getCiphersuites(sslPolicy.getCiphersuites(),
                                          SSLUtils.getServerSupportedCipherSuites(ctx),
                                          sslPolicy.getCiphersuiteFilters(),
-                                         LOG));
+                                         LOG, true));
         } catch (Exception e) {
             LogUtils.log(LOG, Level.SEVERE, "SSL_CONTEXT_INIT_FAILURE", e);
         }
@@ -146,4 +148,5 @@
     protected String[] getDerivative() {
         return DERIVATIVE;
     }
+    
 }

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=519327&r1=519326&r2=519327
==============================================================================
--- 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 Sat Mar 17 07:38:09 2007
@@ -59,7 +59,8 @@
 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}.  
+CIPHERSUITES_FILTERED = The enabled cipher suites have been filtered down to {0}.
+CIPHERSUITES_EXCLUDED = The excluded 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/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=519327&r1=519326&r2=519327
==============================================================================
--- 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 Sat Mar 17 07:38:09 2007
@@ -44,7 +44,6 @@
 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;
@@ -53,8 +52,7 @@
 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
@@ -68,7 +66,7 @@
     private static final String DEFAULT_TRUST_STORE_TYPE = "JKS";
     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 String 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;
@@ -352,11 +350,11 @@
     public static String[] getServerSupportedCipherSuites(SSLContext context) {
         return context.getServerSocketFactory().getSupportedCipherSuites();
     }
-
+        
     public static String[] getCiphersuites(List<String> cipherSuitesList,
                                            String[] supportedCipherSuites,
                                            FiltersType filters,
-                                           Logger log) {
+                                           Logger log, boolean exclude) {
         String[] cipherSuites = null;
         if (!(cipherSuitesList == null || cipherSuitesList.isEmpty())) {
             cipherSuites = getCiphersFromList(cipherSuitesList, log);
@@ -366,6 +364,7 @@
                 LogUtils.log(log, Level.INFO, "CIPHERSUITE_FILTERS_NOT_SET");                
             }
             List<String> filteredCipherSuites = new ArrayList<String>();
+            List<String> excludedCipherSuites = new ArrayList<String>();
             List<Pattern> includes =
                 filters != null
                 ? compileRegexPatterns(filters.getInclude(), true, log)
@@ -387,13 +386,22 @@
                                  Level.INFO,
                                  "CIPHERSUITE_EXCLUDED",
                                  supportedCipherSuites[i]);
+                    excludedCipherSuites.add(supportedCipherSuites[i]);
                 }
             }
             LogUtils.log(log,
                          Level.INFO,
                          "CIPHERSUITES_FILTERED",
                          filteredCipherSuites);
-            cipherSuites = getCiphersFromList(filteredCipherSuites, log);
+            LogUtils.log(log,
+                         Level.INFO,
+                         "CIPHERSUITES_EXCLUDED",
+                         excludedCipherSuites);
+            if (exclude) {
+                cipherSuites = getCiphersFromList(excludedCipherSuites, log);
+            } else {
+                cipherSuites = getCiphersFromList(filteredCipherSuites, log);
+            }
         } 
         return cipherSuites;
     }         
@@ -539,25 +547,21 @@
      * @param req the Jetty request
      * @param message the Message
      */
-    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));
+    public static void propogateSecureSession(HttpServletRequest request,
+                                              Message message) {    
+        SSLSession session = 
+            (SSLSession) request.getAttribute(SSL_SESSION_ATTRIBUTE);
+        if (session != null) {
+            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));
         }
     }
 
@@ -567,7 +571,7 @@
      * 
      * @param req the servlet request
      * @param message the Message
-     */
+     
     public static void propogateSecureServletSession(HttpServletRequest request,
                                                      Message message) {
         SSLSession session = 
@@ -584,7 +588,7 @@
                                            session,
                                            certs));
         }
-    }
+    }*/
     
     protected static void logUnSupportedPolicies(Object policy,
                                                  boolean client,

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=519327&r1=519326&r2=519327
==============================================================================
--- 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 Sat Mar 17 07:38:09 2007
@@ -51,6 +51,7 @@
 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;
@@ -58,10 +59,7 @@
 import org.xmlsoap.schemas.wsdl.http.AddressType;
 
 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());
 
     private ServletTransportFactory transport;
@@ -179,14 +177,14 @@
         try {
             MessageImpl inMessage = new MessageImpl();
             inMessage.setContent(InputStream.class, request.getInputStream());
-            inMessage.put(HTTP_REQUEST, request);
-            inMessage.put(HTTP_RESPONSE, response);
+            inMessage.put(AbstractHTTPDestination.HTTP_REQUEST, request);
+            inMessage.put(AbstractHTTPDestination.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());
             inMessage.put(Message.CONTENT_TYPE, request.getContentType());
             inMessage.put(Message.ENCODING, request.getCharacterEncoding());
-            SSLUtils.propogateSecureServletSession(request, inMessage);
+            SSLUtils.propogateSecureSession(request, inMessage);
             d.doMessage(inMessage);
         } catch (IOException e) {
             throw new ServletException(e);

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java?view=diff&rev=519327&r1=519326&r2=519327
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java Sat Mar 17 07:38:09 2007
@@ -20,38 +20,22 @@
 package org.apache.cxf.transport.servlet;
 
 import java.io.IOException;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-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.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.MessageObserver;
 import org.apache.cxf.transport.http.AbstractHTTPDestination;
 
 
 public class ServletDestination extends AbstractHTTPDestination {
-
-    public static final String HTTP_REQUEST =
-        "HTTP_SERVLET_REQUEST";
-    public static final String HTTP_RESPONSE =
-        "HTTP_SERVLET_RESPONSE"; 
     
     static final Logger LOG = Logger.getLogger(ServletDestination.class.getName());
         
@@ -83,41 +67,6 @@
     }
 
     /**
-     * @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);
-    }
-   
-   
-        
-    /**
-     * 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) {
-        HttpServletRequest req = (HttpServletRequest)message.get(HTTP_REQUEST);
-        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);
-            }
-        }
-    }    
-    /**
      * Copy the response headers into the response.
      * 
      * @param message the current message
@@ -153,107 +102,9 @@
             if (LOG.isLoggable(Level.INFO)) {
                 LOG.info("Finished servicing http request on thread: " + Thread.currentThread());
             }
-        }
-        
-    }
-    
-    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));
-        }
-    }
-    
-    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) {
-                LOG.severe(e.getMessage());
-            }
-        }
+        }        
     }
-    
-    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 {
-            LOG.log(Level.WARNING, "UNEXPECTED_RESPONSE_TYPE_MSG", responseObj.getClass());
-            throw new IOException("UNEXPECTED_RESPONSE_TYPE_MSG" + responseObj.getClass());
-        }
-    
-        if (isOneWay(outMessage)) {
-            outMessage.remove(HTTP_RESPONSE);
-        }
-        return responseStream;
-    }
-    
-    protected boolean isOneWay(Message message) {
-        return message.getExchange() != null && message.getExchange().isOneWay();
-    }
-
+   
     public MessageObserver getMessageObserver() {
         return this.incomingObserver;
     }

Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java?view=diff&rev=519327&r1=519326&r2=519327
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java Sat Mar 17 07:38:09 2007
@@ -33,6 +33,9 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+
 import junit.framework.TestCase;
 
 import org.apache.cxf.bus.CXFBusImpl;
@@ -63,8 +66,8 @@
     private Proxy proxy;
     private Message inMessage;
     private MessageObserver observer;
-    private OutputStream os;
-    private InputStream is;
+    private ServletOutputStream os;
+    private ServletInputStream is;
     private IMocksControl control;
     
     public void setUp() throws Exception {
@@ -139,7 +142,7 @@
         contentTypes.add("text/xml");
         contentTypes.add("charset=utf8");
         headers.put("content-type", contentTypes);
-        message.put(Message.PROTOCOL_HEADERS, headers);        
+        message.put(Message.PROTOCOL_HEADERS, headers);
         
         AuthorizationPolicy authPolicy = new AuthorizationPolicy();
         authPolicy.setUserName("BJ");
@@ -284,7 +287,7 @@
         }
         
         
-        os = EasyMock.createMock(OutputStream.class);
+        os = EasyMock.createMock(ServletOutputStream.class);
         connection.getOutputStream();
         EasyMock.expectLastCall().andReturn(os);
         os.write(PAYLOAD.getBytes(), 0, PAYLOAD.length());
@@ -370,7 +373,7 @@
             String responseString = Integer.toString(responseCode);
             EasyMock.expectLastCall().andReturn(responseString).times(2);
         }
-        is = EasyMock.createMock(InputStream.class);
+        is = EasyMock.createMock(ServletInputStream.class);
         connection.getInputStream();
         EasyMock.expectLastCall().andReturn(is);
     }
@@ -390,10 +393,10 @@
                      inMessage.get(DECOUPLED_CHANNEL_MESSAGE));
         assertEquals("unexpected HTTP_REQUEST set",
                      false,
-                     inMessage.containsKey(HTTPConduit.HTTP_REQUEST));
+                     inMessage.containsKey(AbstractHTTPDestination.HTTP_REQUEST));
         assertEquals("unexpected HTTP_RESPONSE set",
                      false,
-                     inMessage.containsKey(HTTPConduit.HTTP_RESPONSE));
+                     inMessage.containsKey(AbstractHTTPDestination.HTTP_RESPONSE));
         assertEquals("unexpected Message.ASYNC_POST_RESPONSE_DISPATCH set",
                      false,
                      inMessage.containsKey(Message.ASYNC_POST_RESPONSE_DISPATCH));

Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyContextInspectorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyContextInspectorTest.java?view=diff&rev=519327&r1=519326&r2=519327
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyContextInspectorTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyContextInspectorTest.java Sat Mar 17 07:38:09 2007
@@ -23,17 +23,18 @@
 
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
-import org.mortbay.http.HttpContext;
+import org.mortbay.jetty.handler.ContextHandler;
+
 
 
 public class JettyContextInspectorTest extends TestCase {
     private static final String CONTEXT_PATH = "/foo/bar";
-    private HttpContext context;
+    private ContextHandler context;
     private IMocksControl control;
     
     public void setUp() throws Exception {
         control = EasyMock.createNiceControl();
-        context = control.createMock(HttpContext.class);
+        context = control.createMock(ContextHandler.class);
         context.getContextPath();
         EasyMock.expectLastCall().andReturn(CONTEXT_PATH);
         control.replay();



Mime
View raw message