cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r513213 - in /incubator/cxf/trunk: rt/management/src/main/java/org/apache/cxf/management/jmx/ rt/transports/http/src/main/java/org/apache/cxf/transport/http/ rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ rt/transports/h...
Date Thu, 01 Mar 2007 07:36:59 GMT
Author: ningjiang
Date: Wed Feb 28 23:36:57 2007
New Revision: 513213

URL: http://svn.apache.org/viewvc?view=rev&rev=513213
Log:
[CXF-343] Refactoring to make ServletDestination share some common code with JettyHTTPDestination
on Http2 module
1. Jetty6.x change its API to use the HttpServletRequest and HttpServletRequest as the parameters.
So the JettyHTTPDestionation and ServletDestionation can share the common logical from AbstractHTTPDestination.
2. Since HttpServletResponse.setStatus(int code, String message) in Servlet2.5 used by Jetty6
is depercated, I just did some updates on theAbstractHTTPDestination flushHeaders() and some
test code of it.
3. Fixed some systest errors which run with the http2 module. 
4. Copied the http spring support files to http2
5. Fixed an instrumentationManagerImpl's null point exception  

Added:
    incubator/cxf/trunk/rt/transports/http2/src/main/resources/META-INF/cxf/cxf-servlet.xml
      - copied unchanged from r513098, incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-servlet.xml
    incubator/cxf/trunk/rt/transports/http2/src/main/resources/META-INF/spring.handlers
      - copied unchanged from r513098, incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/spring.handlers
    incubator/cxf/trunk/rt/transports/http2/src/main/resources/META-INF/spring.schemas
      - copied unchanged from r513098, incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/spring.schemas
    incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/spring/
      - copied from r513098, incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/spring/
Removed:
    incubator/cxf/trunk/rt/transports/http2/src/main/resources/META-INF/cxf/cxf-property-editors.xml
    incubator/cxf/trunk/rt/transports/http2/src/main/resources/schemas/configuration/http-conduit.xsd
    incubator/cxf/trunk/rt/transports/http2/src/main/resources/schemas/configuration/http-destination.xsd
Modified:
    incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.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/servlet/ServletDestination.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
    incubator/cxf/trunk/rt/transports/http2/pom.xml
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
    incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
    incubator/cxf/trunk/rt/transports/http2/src/main/resources/schemas/configuration/http-listener.xsd
    incubator/cxf/trunk/rt/transports/http2/src/main/resources/schemas/wsdl/http-conf.xsd
    incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/JsFrontEndServletTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soap12/Soap12ClientServerTest.java

Modified: incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java?view=diff&rev=513213&r1=513212&r2=513213
==============================================================================
--- incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
(original)
+++ incubator/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
Wed Feb 28 23:36:57 2007
@@ -84,7 +84,9 @@
         if (null != bus) {
             bus.setExtension(this, InstrumentationManager.class);
             BusLifeCycleManager blcm = bus.getExtension(BusLifeCycleManager.class);
-            blcm.registerLifeCycleListener(this);
+            if (null != blcm) {
+                blcm.registerLifeCycleListener(this);
+            }    
         }
     }
     

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=513213&r1=513212&r2=513213
==============================================================================
--- 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
Wed Feb 28 23:36:57 2007
@@ -283,13 +283,14 @@
             Integer i = (Integer)outMessage.get(Message.RESPONSE_CODE);
             if (i != null) {
                 int status = i.intValue();
-                if (status == HttpURLConnection.HTTP_INTERNAL_ERROR) {
+                /*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);
             }

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=513213&r1=513212&r2=513213
==============================================================================
--- 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
Wed Feb 28 23:36:57 2007
@@ -135,6 +135,7 @@
         } else if (enc != null) {
             response.setContentType("text/xml; charset=" + enc);
         }
+        
     }
     
     

Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java?view=diff&rev=513213&r1=513212&r2=513213
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
Wed Feb 28 23:36:57 2007
@@ -585,7 +585,7 @@
                      response.getStatus());
         if (status == 500) {
             assertEquals("unexpected status message",
-                         "Fault+Occurred",
+                         "Internal Server Error",
                          response.getReason());
         }
         verifyResponseHeaders(outMsg);

Modified: incubator/cxf/trunk/rt/transports/http2/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/pom.xml?view=diff&rev=513213&r1=513212&r2=513213
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/pom.xml (original)
+++ incubator/cxf/trunk/rt/transports/http2/pom.xml Wed Feb 28 23:36:57 2007
@@ -71,12 +71,12 @@
         <dependency>
             <groupId>org.mortbay.jetty</groupId>
             <artifactId>jetty</artifactId>
-            <version>6.1.1</version>
+            <version>6.1.2rc0</version>
         </dependency>
         <dependency>
             <groupId>org.mortbay.jetty</groupId>
             <artifactId>jetty-sslengine</artifactId>
-            <version>6.1.1</version>
+            <version>6.1.2rc0</version>
         </dependency>
 
         <dependency>
@@ -104,31 +104,7 @@
                                     <deleteDirs>
                                         <deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl</deleteDir>
                                     </deleteDirs>
-                                </xsdOption>
-                                <xsdOption>
-                                    <xsd>${basedir}/src/main/resources/schemas/configuration/http-conduit.xsd</xsd>
-                                    <bindingFile>${basedir}/src/main/resources/schemas/wsdl/http-conf.xjb</bindingFile>
-                                    <extension>true</extension>
-                                    <extensionArgs>
-                                        <extensionArg>-Xdv</extensionArg>
-                                    </extensionArgs>
-                                    <deleteDirs>
-                                        <deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl</deleteDir>
-                                        <deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/configuration/security</deleteDir>
-                                    </deleteDirs>
-                                </xsdOption>
-                                <xsdOption>
-                                    <xsd>${basedir}/src/main/resources/schemas/configuration/http-destination.xsd</xsd>
-                                    <bindingFile>${basedir}/src/main/resources/schemas/wsdl/http-conf.xjb</bindingFile>
-                                    <extension>true</extension>
-                                    <extensionArgs>
-                                        <extensionArg>-Xdv</extensionArg>
-                                    </extensionArgs>
-                                    <deleteDirs>
-                                        <deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl</deleteDir>
-                                        <deleteDir>${basedir}/target/generated/src/main/java/org/apache/cxf/configuration/security</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>

Modified: incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?view=diff&rev=513213&r1=513212&r2=513213
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
(original)
+++ incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Wed Feb 28 23:36:57 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 String getAddressValue(EndpointInfo ei) {       
         return getAddressValue(ei, true);
     } 
@@ -160,7 +219,16 @@
         } else {
             return ei.getAddress();
         }
-    }  
+    }
+    
+    /**
+     * @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.
@@ -209,11 +277,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/http2/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java?view=diff&rev=513213&r1=513212&r2=513213
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java
(original)
+++ incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/http/JettyHTTPDestination.java
Wed Feb 28 23:36:57 2007
@@ -21,14 +21,8 @@
 
 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;
 
@@ -38,13 +32,9 @@
 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.transports.http.QueryHandler;
 import org.apache.cxf.transports.http.QueryHandlerRegistry;
@@ -53,10 +43,8 @@
 import org.mortbay.jetty.handler.AbstractHandler;
 
 
-public class JettyHTTPDestination extends AbstractHTTPDestination {
+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);
     
@@ -148,15 +136,7 @@
         LOG.log(Level.INFO, "Deactivating receipt of incoming messages");
         engine.removeServant(nurl);        
     }
-
-    /**
-     * @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);
-    }
+ 
 
     
     /**
@@ -166,57 +146,7 @@
         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) {
-        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 void doService(HttpServletRequest req, HttpServletResponse resp) throws IOException
{
         Request baseRequest = (req instanceof Request) 
             ? (Request)req : HttpConnection.getCurrentConnection().getRequest();
@@ -282,111 +212,6 @@
                 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 HttpServletResponse) {
-            HttpServletResponse response = (HttpServletResponse)responseObj;
-
-            Integer i = (Integer)outMessage.get(Message.RESPONSE_CODE);
-            if (i != null) { 
-                //removed the error handler things
-                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();
-            }
-        }
-    }
+    }   
+    
 }

Modified: incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?view=diff&rev=513213&r1=513212&r2=513213
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
(original)
+++ incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
Wed Feb 28 23:36:57 2007
@@ -46,15 +46,13 @@
 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.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 {
-
-    static final String HTTP_REQUEST = "HTTP_SERVLET_REQUEST";
-    static final String HTTP_RESPONSE = "HTTP_SERVLET_RESPONSE";
+public class ServletController {   
 
     private static final Logger LOG = Logger.getLogger(ServletController.class.getName());
 
@@ -161,8 +159,8 @@
         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());

Modified: incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java?view=diff&rev=513213&r1=513212&r2=513213
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
(original)
+++ incubator/cxf/trunk/rt/transports/http2/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
Wed Feb 28 23:36:57 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());
         
@@ -81,48 +65,9 @@
     protected Logger getLogger() {
         return LOG;
     }
-
-    /**
-     * @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
-     * @param headers the current set of headers
-     */
+    
     protected void copyResponseHeaders(Message message, HttpServletResponse response) {
         String ct = (String) message.get(Message.CONTENT_TYPE);
         String enc = (String) message.get(Message.ENCODING);
@@ -135,8 +80,7 @@
         } else if (enc != null) {
             response.setContentType("text/xml; charset=" + enc);
         }
-    }
-    
+    }    
     
     
     protected void doMessage(MessageImpl inMessage) throws IOException {
@@ -154,104 +98,7 @@
             }
         }
         
-    }
-    
-    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/http2/src/main/resources/schemas/configuration/http-listener.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/src/main/resources/schemas/configuration/http-listener.xsd?view=diff&rev=513213&r1=513212&r2=513213
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/src/main/resources/schemas/configuration/http-listener.xsd
(original)
+++ incubator/cxf/trunk/rt/transports/http2/src/main/resources/schemas/configuration/http-listener.xsd
Wed Feb 28 23:36:57 2007
@@ -24,7 +24,6 @@
            xmlns:http-conf="http://cxf.apache.org/transports/http/configuration" 
            xmlns:sec="http://cxf.apache.org/configuration/security" 
            xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
-           xmlns:cfg="http://cxf.apache.org/configuration/cfg"
            elementFormDefault="qualified" 
            attributeFormDefault="unqualified"
            jaxb:version="2.0">

Modified: incubator/cxf/trunk/rt/transports/http2/src/main/resources/schemas/wsdl/http-conf.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/src/main/resources/schemas/wsdl/http-conf.xsd?view=diff&rev=513213&r1=513212&r2=513213
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/src/main/resources/schemas/wsdl/http-conf.xsd
(original)
+++ incubator/cxf/trunk/rt/transports/http2/src/main/resources/schemas/wsdl/http-conf.xsd
Wed Feb 28 23:36:57 2007
@@ -22,13 +22,50 @@
            xmlns:xs="http://www.w3.org/2001/XMLSchema" 
            xmlns:http-conf="http://cxf.apache.org/transports/http/configuration" 
            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+           xmlns:sec="http://cxf.apache.org/configuration/security"
            elementFormDefault="qualified" 
            attributeFormDefault="unqualified"
            xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
            jaxb:version="2.0">
 
     <xs:import namespace="http://schemas.xmlsoap.org/wsdl/" schemaLocation="../../../../../../../../common/schemas/src/main/resources/schemas/wsdl/wsdl.xsd"/>
+    <xs:import namespace="http://cxf.apache.org/configuration/security" schemaLocation="../../../../../../../../common/schemas/src/main/resources/schemas/configuration/security.xsd"/>
 
+    <xs:element name="server" type="http-conf:HTTPServerPolicy"/>
+    <xs:element name="authorization" type="sec:AuthorizationPolicy"/>
+    <xs:element name="sslServer" type="sec:SSLServerPolicy"/>
+    <xs:element name="contextMatchStrategy" type="xs:string" default="stem"/>
+    <xs:element name="fixedParameterOrder" type="xs:boolean" default="false"/>
+
+    <xs:element name="client" type="http-conf:HTTPClientPolicy"/>
+    <xs:element name="proxyAuthorization" type="sec:AuthorizationPolicy"/>
+    <xs:element name="sslClient" type="sec:SSLClientPolicy"/>
+
+    <xs:element name="conduit">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="http-conf:client" minOccurs="0"/>
+                <xs:element ref="http-conf:authorization" minOccurs="0"/>
+                <xs:element ref="http-conf:proxyAuthorization" minOccurs="0"/>
+                <xs:element ref="http-conf:sslClient" minOccurs="0"/>
+            </xs:sequence>
+            <xs:attribute name="id" type="xs:string" use="required"/>
+        </xs:complexType>
+    </xs:element>
+    
+    <xs:element name="destination">
+      <xs:complexType>        
+        <xs:sequence>
+            <xs:element ref="http-conf:server" minOccurs="0"/>
+            <xs:element ref="http-conf:authorization" minOccurs="0"/>
+            <xs:element ref="http-conf:sslServer" minOccurs="0"/>
+            <xs:element ref="http-conf:contextMatchStrategy" minOccurs="0"/>
+            <xs:element ref="http-conf:fixedParameterOrder" minOccurs="0"/>
+        </xs:sequence>
+        <xs:attribute name="id" type="xs:string" use="required"/>
+      </xs:complexType>
+   </xs:element>
+   
     <xs:complexType name="HTTPServerPolicy">
         <xs:annotation>
             <xs:documentation>HTTP Server configuration properties.
@@ -136,8 +173,6 @@
             </xs:extension>
         </xs:complexContent>
     </xs:complexType>
-    <xs:element name="server" type="http-conf:HTTPServerPolicy"/>
-
 
     <xs:complexType name="HTTPClientPolicy">
         <xs:annotation>
@@ -332,7 +367,6 @@
             </xs:extension>
         </xs:complexContent>
     </xs:complexType>
-    <xs:element name="client" type="http-conf:HTTPClientPolicy"/>
     
     <xs:complexType name="HTTPListenerPolicy">
     	<xs:sequence>

Modified: incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java?view=diff&rev=513213&r1=513212&r2=513213
==============================================================================
--- incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
(original)
+++ incubator/cxf/trunk/rt/transports/http2/src/test/java/org/apache/cxf/transport/http/JettyHTTPDestinationTest.java
Wed Feb 28 23:36:57 2007
@@ -248,7 +248,7 @@
         engine = EasyMock.createMock(ServerEngine.class);
         EasyMock.replay();
 
-        JettyHTTPDestination dest = new JettyHTTPDestination(bus,
+        AbstractHTTPDestination dest = new JettyHTTPDestination(bus,
                                                              conduitInitiator,
                                                              endpointInfo,
                                                              engine);

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/JsFrontEndServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/JsFrontEndServletTest.java?view=diff&rev=513213&r1=513212&r2=513213
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/JsFrontEndServletTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/JsFrontEndServletTest.java
Wed Feb 28 23:36:57 2007
@@ -41,7 +41,7 @@
         WebResponse response = newClient().getResponse(req);
 
         assertEquals("text/xml", response.getContentType());
-        //assertEquals("UTF-8", response.getCharacterSet());
+        assertEquals("UTF-8", response.getCharacterSet());
 
         Document doc = DOMUtils.readXml(response.getInputStream());
         assertNotNull(doc);

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soap12/Soap12ClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soap12/Soap12ClientServerTest.java?view=diff&rev=513213&r1=513212&r2=513213
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soap12/Soap12ClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soap12/Soap12ClientServerTest.java
Wed Feb 28 23:36:57 2007
@@ -113,7 +113,7 @@
         
         assertEquals(500, httpConnection.getResponseCode());
         
-        assertEquals("Fault+Occurred", httpConnection.getResponseMessage());
+        assertEquals("Internal Server Error", httpConnection.getResponseMessage());
 
         InputStream in = httpConnection.getErrorStream();
         assertNotNull(in);     
@@ -155,7 +155,7 @@
 
         assertEquals("application/soap+xml", httpConnection.getContentType());
         
-        assertEquals("Fault+Occurred", httpConnection.getResponseMessage());
+        assertEquals("Internal Server Error", httpConnection.getResponseMessage());
 
         InputStream in = httpConnection.getErrorStream();                  
         assertNotNull(in);        



Mime
View raw message