Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 52611 invoked from network); 1 Mar 2007 07:37:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Mar 2007 07:37:23 -0000 Received: (qmail 22847 invoked by uid 500); 1 Mar 2007 07:37:31 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 22790 invoked by uid 500); 1 Mar 2007 07:37:31 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 22780 invoked by uid 99); 1 Mar 2007 07:37:31 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Feb 2007 23:37:31 -0800 X-ASF-Spam-Status: No, hits=-98.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Feb 2007 23:37:20 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 92D4A1A981A; Wed, 28 Feb 2007 23:37:00 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: cxf-commits@incubator.apache.org From: ningjiang@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070301073700.92D4A1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 @@ org.mortbay.jetty jetty - 6.1.1 + 6.1.2rc0 org.mortbay.jetty jetty-sslengine - 6.1.1 + 6.1.2rc0 @@ -104,31 +104,7 @@ ${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl - - - ${basedir}/src/main/resources/schemas/configuration/http-conduit.xsd - ${basedir}/src/main/resources/schemas/wsdl/http-conf.xjb - true - - -Xdv - - - ${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl - ${basedir}/target/generated/src/main/java/org/apache/cxf/configuration/security - - - - ${basedir}/src/main/resources/schemas/configuration/http-destination.xsd - ${basedir}/src/main/resources/schemas/wsdl/http-conf.xjb - true - - -Xdv - - - ${basedir}/target/generated/src/main/java/org/apache/cxf/wsdl - ${basedir}/target/generated/src/main/java/org/apache/cxf/configuration/security - - + ${basedir}/src/main/resources/schemas/configuration/http-listener.xsd ${basedir}/src/main/resources/schemas/wsdl/http-conf.xjb 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> headers); + protected void copyRequestHeaders(Message message, Map> 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 values; + if (headers.containsKey(fname)) { + values = headers.get(fname); + } else { + values = new ArrayList(); + 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 */ + } + + + 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> 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 values; - if (headers.containsKey(fname)) { - values = headers.get(fname); - } else { - values = new ArrayList(); - 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> headers) { - HttpServletRequest req = (HttpServletRequest)message.get(HTTP_REQUEST); - for (Enumeration e = req.getHeaderNames(); e.hasMoreElements();) { - String fname = (String)e.nextElement(); - - List values; - if (headers.containsKey(fname)) { - values = headers.get(fname); - } else { - values = new ArrayList(); - 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"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + HTTP Server configuration properties. @@ -136,8 +173,6 @@ - - @@ -332,7 +367,6 @@ - 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);