servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r406633 - in /incubator/servicemix/trunk: pom.xml servicemix-http/src/main/java/org/apache/servicemix/http/ServerManager.java
Date Mon, 15 May 2006 14:21:39 GMT
Author: gnodet
Date: Mon May 15 07:21:37 2006
New Revision: 406633

URL: http://svn.apache.org/viewcvs?rev=406633&view=rev
Log:
Upgrade to jetty6 beta15

Modified:
    incubator/servicemix/trunk/pom.xml
    incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/ServerManager.java

Modified: incubator/servicemix/trunk/pom.xml
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/pom.xml?rev=406633&r1=406632&r2=406633&view=diff
==============================================================================
--- incubator/servicemix/trunk/pom.xml (original)
+++ incubator/servicemix/trunk/pom.xml Mon May 15 07:21:37 2006
@@ -1032,7 +1032,7 @@
       <dependency>
         <groupId>org.mortbay.jetty</groupId>
         <artifactId>jetty</artifactId>
-        <version>6.0.0beta10</version>
+        <version>6.0.0beta15</version>
       </dependency>
       <dependency>
         <groupId>jgroups</groupId>

Modified: incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/ServerManager.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/ServerManager.java?rev=406633&r1=406632&r2=406633&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/ServerManager.java
(original)
+++ incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/ServerManager.java
Mon May 15 07:21:37 2006
@@ -36,11 +36,15 @@
 import org.apache.commons.logging.LogFactory;
 import org.mortbay.jetty.Connector;
 import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.HttpConnection;
 import org.mortbay.jetty.HttpMethods;
 import org.mortbay.jetty.MimeTypes;
+import org.mortbay.jetty.Response;
 import org.mortbay.jetty.Server;
 import org.mortbay.jetty.handler.AbstractHandler;
 import org.mortbay.jetty.handler.ContextHandler;
+import org.mortbay.jetty.handler.ContextHandlerCollection;
+import org.mortbay.jetty.handler.HandlerCollection;
 import org.mortbay.jetty.security.SslSocketConnector;
 import org.mortbay.jetty.servlet.ServletHandler;
 import org.mortbay.jetty.servlet.ServletHolder;
@@ -140,6 +144,7 @@
         // add context
         handlers = (Handler[]) add(handlers, context, Handler.class);
         server.setHandlers(handlers);
+        context.stop();
         return context;
     }
     
@@ -246,7 +251,7 @@
         Server server = new Server();
         server.setThreadPool(threadPool);
         server.setConnectors(new Connector[] { connector });
-        server.setNotFoundHandler(new DisplayServiceHandler());
+        server.setHandler(new DisplayServiceHandler());
         connector.start();
         server.start();
         servers.put(getKey(url), server);
@@ -266,14 +271,19 @@
         return threadPool;
     }
     
-    protected class DisplayServiceHandler extends AbstractHandler {
+    protected class DisplayServiceHandler extends ContextHandlerCollection {
 
-        public boolean handle(String target, HttpServletRequest request, HttpServletResponse
response, int dispatch) throws IOException, ServletException {
+        public void handle(String target, HttpServletRequest request, HttpServletResponse
response, int dispatch) throws IOException, ServletException {
+            super.handle(target, request, response, dispatch);
+            Response base_response = HttpConnection.getCurrentConnection().getResponse();
+            if (response.isCommitted() || base_response.getStatus()!=-1)
+                return;
+            
             String method = request.getMethod();
             
             if (!method.equals(HttpMethods.GET) || !request.getRequestURI().equals("/"))
{
                 response.sendError(404);
-                return true;   
+                return;   
             }
 
             response.setStatus(404);
@@ -294,7 +304,7 @@
             for (Iterator iter = servers.iterator(); iter.hasNext();) {
                 String serverUri = (String) iter.next();
                 Server server = (Server) ServerManager.this.servers.get(serverUri);
-                Handler[] handlers = server.getAllHandlers();
+                Handler[] handlers = server.getChildHandlersByClass(ContextHandler.class);
                 for (int i = 0; handlers != null && i < handlers.length; i++)
                 {
                     if (!(handlers[i] instanceof ContextHandler)) {
@@ -327,8 +337,6 @@
             OutputStream out = response.getOutputStream();
             writer.writeTo(out);
             out.close();
-            
-            return true;
         }
         
     }



Mime
View raw message