cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <ning.ji...@iona.com>
Subject Re: svn commit: r584484 - in /incubator/cxf/trunk: rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/ systests/src/test/java/org/apache/cxf/systest/http_jetty/
Date Mon, 15 Oct 2007 01:30:25 GMT
Hi Glen,

Please see my comment in the mail.

Glen Mazza wrote:
> Am Sonntag, den 14.10.2007, 03:04 +0000 schrieb ningjiang@apache.org:
>   
>> 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
>
>   
Jetty's DefaultHandler should be the last one which be put into the 
handler list (It will block the request handler chain, return the error 
message). If there are more than two DefaultHandler or the subclasses of 
it , we just add the last DefaultHandler to the handler list.

Willem.
>> +                    } 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;
>>
>>     
>
>
>   

Mime
View raw message