Am Sonntag, den 14.10.2007, 03:04 +0000 schrieb [EMAIL PROTECTED]:
> 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;
(I don't know the system here, but...) What if something extends the
DefaultHandler--the code above would activate, is that still what you
would want? Also, should we trap it as an error if there are actually
two DefaultHandlers (or subclasses of it)? The code above would just
take the latter one, and ignore the other.
Regards,
Glen
> + } 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;
>