Author: ningjiang
Date: Sat Oct 13 20:04:19 2007
New Revision: 584484
URL: http://svn.apache.org/viewvc?rev=584484&view=rev
Log:
CXF-1110 Fixed the issue of the Jetty default handler configuration blocking
the CXF endpoint request
Modified:
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
Modified:
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java?rev=584484&r1=584483&r2=584484&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
(original)
+++
incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
Sat Oct 13 20:04:19 2007
@@ -40,6 +40,7 @@
import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.ContextHandler;
import org.mortbay.jetty.handler.ContextHandlerCollection;
+import org.mortbay.jetty.handler.DefaultHandler;
import org.mortbay.jetty.handler.HandlerList;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.security.SslSocketConnector;
@@ -246,6 +247,7 @@
*/
public synchronized void addServant(URL url, JettyHTTPHandler handler) {
if (server == null) {
+ DefaultHandler defaultHandler = null;
// create a new jetty server instance if there is no server there
server = new Server();
if (connector == null) {
@@ -255,12 +257,21 @@
if (handlers != null && handlers.size() > 0) {
HandlerList handlerList = new HandlerList();
for (Handler h : handlers) {
- handlerList.addHandler(h);
+ // filting the jetty default handler
+ // which should not be added at this point
+ if (h instanceof DefaultHandler) {
+ defaultHandler = (DefaultHandler) h;
+ } else {
+ handlerList.addHandler(h);
+ }
}
server.addHandler(handlerList);
}
contexts = new ContextHandlerCollection();
- server.addHandler(contexts);
+ server.addHandler(contexts);
+ if (defaultHandler != null) {
+ server.addHandler(defaultHandler);
+ }
try {
server.start();
AbstractConnector aconn = (AbstractConnector) connector;
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java?rev=584484&r1=584483&r2=584484&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
Sat Oct 13 20:04:19 2007
@@ -133,7 +133,9 @@
@Test
public void testServerUpDownUp() throws Exception {
setUpBus();
- launchService();
+ launchService();
+ getTestHtml();
+ invokeService();
shutdownService();
launchService();
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml?rev=584484&r1=584483&r2=584484&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http_jetty/jetty-engine.xml
Sat Oct 13 20:04:19 2007
@@ -42,6 +42,7 @@
</bean>
</property>
</bean>
+ <bean class="org.mortbay.jetty.handler.DefaultHandler"/>
</httpj:handlers>
</httpj:engine>
</httpj:engine-factory>