geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r417369 [7/8] - in /geronimo/sandbox/servlet-2.5: ./ etc/ modules/client-builder/src/java/org/apache/geronimo/client/builder/ modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ modules/j2ee-builder/src/java/org/apa...
Date Tue, 27 Jun 2006 08:13:13 GMT
Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyEJBWebServiceContext.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyEJBWebServiceContext.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyEJBWebServiceContext.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyEJBWebServiceContext.java Tue Jun 27 01:13:10 2006
@@ -28,15 +28,14 @@
 
 import org.apache.geronimo.security.ContextManager;
 import org.apache.geronimo.webservices.WebServiceContainer;
-import org.mortbay.http.Authenticator;
-import org.mortbay.http.BasicAuthenticator;
-import org.mortbay.http.ClientCertAuthenticator;
-import org.mortbay.http.DigestAuthenticator;
-import org.mortbay.http.HttpContext;
-import org.mortbay.http.HttpException;
-import org.mortbay.http.HttpHandler;
-import org.mortbay.http.HttpRequest;
-import org.mortbay.http.HttpResponse;
+import org.mortbay.jetty.security.Authenticator;
+import org.mortbay.jetty.security.BasicAuthenticator;
+import org.mortbay.jetty.security.ClientCertAuthenticator;
+import org.mortbay.jetty.security.DigestAuthenticator;
+import org.mortbay.jetty.handler.ContextHandler;
+import org.mortbay.jetty.HttpException;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Response;
 
 /**
  * Delegates requests to a WebServiceContainer which is presumably for an EJB WebService.
@@ -62,7 +61,7 @@
  *
  * @version $Rev$ $Date$
  */
-public class JettyEJBWebServiceContext extends HttpContext implements HttpHandler {
+public class JettyEJBWebServiceContext extends ContextHandler {
 
     private final String contextPath;
     private final WebServiceContainer webServiceContainer;
@@ -72,14 +71,16 @@
     private final boolean isIntegralTransportGuarantee;
     private final ClassLoader classLoader;
 
-    private HttpContext httpContext;
+    
 
     public JettyEJBWebServiceContext(String contextPath, WebServiceContainer webServiceContainer, InternalJAASJettyRealm internalJAASJettyRealm, String realmName, String transportGuarantee, String authMethod, ClassLoader classLoader) {
         this.contextPath = contextPath;
         this.webServiceContainer = webServiceContainer;
         if (internalJAASJettyRealm != null) {
             JAASJettyRealm realm = new JAASJettyRealm(realmName, internalJAASJettyRealm);
-            setRealm(realm);
+            //TODO
+            //not used???
+            //setUserRealm(realm);
             this.realm = realm;
             if ("NONE".equals(transportGuarantee)) {
                 isConfidentialTransportGuarantee = false;
@@ -117,7 +118,7 @@
         //need a better name
         return contextPath;
     }
-
+/*
     public HttpContext getHttpContext() {
         return httpContext;
     }
@@ -125,9 +126,15 @@
     public void initialize(HttpContext httpContext) {
         this.httpContext = httpContext;
     }
+    */
 
-    public void handle(HttpRequest req, HttpResponse res) throws HttpException, IOException {
-        req.setContentType("text/xml");
+    public boolean handle(Request req, Response res) throws HttpException, IOException {
+    	//TODO
+    	//shouldn't set this on the request !
+        //req.setContentType("text/xml");
+    	
+    	//TODO
+    	//do we need to check that this request should be handled by this handler?
         RequestAdapter request = new RequestAdapter(req);
         ResponseAdapter response = new ResponseAdapter(res);
 
@@ -135,6 +142,7 @@
             try {
                 webServiceContainer.getWsdl(request, response);
                 //WHO IS RESPONSIBLE FOR CLOSING OUT?
+                return true;
             } catch (IOException e) {
                 throw e;
             } catch (Exception e) {
@@ -142,12 +150,12 @@
             }
         } else {
             if (isConfidentialTransportGuarantee) {
-                if (!req.isConfidential()) {
-                    throw new HttpException(403);
+                if (!req.isSecure()) {
+                    throw new HttpException(403,null);
                 }
             } else if (isIntegralTransportGuarantee) {
-                if (!req.isIntegral()) {
-                    throw new HttpException(403);
+                if (!req.getConnection().isIntegral(req)) {
+                    throw new HttpException(403,null);
                 }
             }
             Thread currentThread = Thread.currentThread();
@@ -157,9 +165,9 @@
             Subject oldSubject = ContextManager.getCurrentCaller();
             try {
                 if (authenticator != null) {
-                    String pathInContext = org.mortbay.util.URI.canonicalPath(req.getPath());
+                    String pathInContext = org.mortbay.util.URIUtil.canonicalPath(req.getContextPath());
                     if (authenticator.authenticate(realm, pathInContext, req, res) == null) {
-                        throw new HttpException(403);
+                        throw new HttpException(403, null);
                     }
                 } else {
                     //EJB will figure out correct defaultSubject shortly
@@ -169,7 +177,7 @@
                 }
                 try {
                     webServiceContainer.invoke(request, response);
-                    req.setHandled(true);
+                    return true;
                 } catch (IOException e) {
                     throw e;
                 } catch (Exception e) {
@@ -196,21 +204,21 @@
     }
 
     public static class RequestAdapter implements WebServiceContainer.Request {
-        private final HttpRequest request;
+        private final Request request;
         private URI uri;
 
-        public RequestAdapter(HttpRequest request) {
+        public RequestAdapter(Request request) {
             this.request = request;
         }
 
         public String getHeader(String name) {
-            return request.getField(name);
+            return request.getHeader(name);
         }
 
         public java.net.URI getURI() {
             if (uri == null) {
                 try {
-                    String uriString = request.getScheme() + "://" + request.getHost() + ":" + request.getPort() + request.getURI();
+                    String uriString = request.getScheme() + "://" + request.getRemoteHost() + ":" + request.getRemotePort() + request.getRequestURI();
                     //return new java.net.URI(uri.getScheme(),uri.getHost(),uri.getPath(),uri.);
                     uri = new java.net.URI(uriString);
                 } catch (URISyntaxException e) {
@@ -270,22 +278,26 @@
     }
 
     public static class ResponseAdapter implements WebServiceContainer.Response {
-        private final HttpResponse response;
+        private final Response response;
 
-        public ResponseAdapter(HttpResponse response) {
+        public ResponseAdapter(Response response) {
             this.response = response;
         }
 
         public void setHeader(String name, String value) {
-            response.setField(name, value);
+            response.setHeader(name, value);
         }
 
         public String getHeader(String name) {
-            return response.getField(name);
+            return response.getHeader(name);
         }
 
         public OutputStream getOutputStream() {
+        	try {
             return response.getOutputStream();
+        	} catch (IOException e) {
+        		throw new IllegalStateException(e.getMessage());
+        	}
         }
 
         public void setStatusCode(int code) {

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyFilterHolder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyFilterHolder.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyFilterHolder.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyFilterHolder.java Tue Jun 27 01:13:10 2006
@@ -22,7 +22,7 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.mortbay.jetty.servlet.FilterHolder;
-import org.mortbay.jetty.servlet.WebApplicationHandler;
+
 
 /**
  * @version $Rev$ $Date$
@@ -34,10 +34,14 @@
     }
 
     public JettyFilterHolder(String filterName, String filterClass, Map initParams, JettyServletRegistration jettyServletRegistration) throws Exception {
-        super(jettyServletRegistration == null? null: jettyServletRegistration.getServletHandler(), filterName, filterClass);
+        super();
+
         if (jettyServletRegistration != null) {
-            ((WebApplicationHandler)jettyServletRegistration.getServletHandler()).addFilterHolder(this);
-            putAll(initParams);
+            setName(filterName);
+            setClassName(filterClass);
+            setInitParameters(initParams);
+            (jettyServletRegistration.getServletHandler()).addFilter(this);
+           
             
             ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
             try {

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyFilterMapping.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyFilterMapping.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyFilterMapping.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyFilterMapping.java Tue Jun 27 01:13:10 2006
@@ -17,90 +17,95 @@
 package org.apache.geronimo.jetty;
 
 import java.io.Serializable;
+import java.util.Set;
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.mortbay.jetty.servlet.Dispatcher;
-import org.mortbay.jetty.servlet.WebApplicationHandler;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.servlet.FilterMapping;
+
 
 /**
  * @version $Rev$ $Date$
  */
-public class JettyFilterMapping implements Serializable {
+public class JettyFilterMapping extends FilterMapping implements Serializable {
 
-    private final String urlPattern;
+    private final String[] urlPatterns;
     private final boolean requestDispatch;
     private final boolean forwardDispatch;
     private final boolean includeDispatch;
     private final boolean errorDispatch;
     private final JettyFilterHolder jettyFilterHolder;
-    private final JettyServletHolder jettyServletHolder;
+    private final Set jettyServletHolders;
     private final JettyFilterMapping previous;
     private final JettyServletRegistration jettyServletRegistration;
 
     //todo use an interface for endpoints.
     public JettyFilterMapping() {
-        this.urlPattern = null;
+        this.urlPatterns = null;
         this.requestDispatch = false;
         this.forwardDispatch = false;
         this.includeDispatch = false;
         this.errorDispatch = false;
         this.jettyFilterHolder = null;
-        this.jettyServletHolder = null;
+        this.jettyServletHolders = null;
         this.previous = null;
         this.jettyServletRegistration = null;
     }
 
-    public JettyFilterMapping(String urlPattern,
+    public JettyFilterMapping(String[] urlPatterns,
                               boolean requestDispatch,
                               boolean forwardDispatch,
                               boolean includeDispatch,
                               boolean errorDispatch,
                               JettyFilterHolder jettyFilterHolder,
-                              JettyServletHolder jettyServletHolder,
+                              Set jettyServletHolders,
                               JettyFilterMapping previous,
                               JettyServletRegistration jettyServletRegistration) {
-       this.urlPattern = urlPattern;
+       this.urlPatterns = urlPatterns;
         this.requestDispatch = requestDispatch;
         this.forwardDispatch = forwardDispatch;
         this.includeDispatch = includeDispatch;
         this.errorDispatch = errorDispatch;
         this.jettyFilterHolder = jettyFilterHolder;
-        this.jettyServletHolder = jettyServletHolder;
+        this.jettyServletHolders = jettyServletHolders;
         this.previous = previous;
         this.jettyServletRegistration = jettyServletRegistration;
 
         if (jettyServletRegistration != null) {
-            assert jettyServletHolder != null ^ urlPattern != null;
+            assert jettyServletHolders != null ^ urlPatterns != null;
 
             String filterName = jettyFilterHolder.getFilterName();
             int dispatches = 0;
             if (requestDispatch) {
-                dispatches |= Dispatcher.__REQUEST;
+                dispatches |= Handler.REQUEST;
             }
             if (forwardDispatch) {
-                dispatches |= Dispatcher.__FORWARD;
+                dispatches |= Handler.FORWARD;
             }
             if (includeDispatch) {
-                dispatches |= Dispatcher.__INCLUDE;
+                dispatches |= Handler.INCLUDE;
             }
             if (errorDispatch) {
-                dispatches |= Dispatcher.__ERROR;
+                dispatches |= Handler.ERROR;
             }
 
+            setFilterName(filterName);
+            setDispatches(dispatches);
+            setPathSpecs(urlPatterns);
 
-            if (jettyServletHolder == null) {
-                ((WebApplicationHandler)jettyServletRegistration.getServletHandler()).addFilterPathMapping(urlPattern, filterName, dispatches);
+            if (jettyServletHolders == null) {
+                (jettyServletRegistration.getServletHandler()).addFilterMapping(urlPatterns, filterName, dispatches);
             } else {
-                String servletName = jettyServletHolder.getServletName();
-                ((WebApplicationHandler)jettyServletRegistration.getServletHandler()).addFilterServletMapping(servletName, filterName, dispatches);
+                setServletNames((String[])jettyServletHolders.toArray(new String[0]));
+                (jettyServletRegistration.getServletHandler()).addFilterMapping(this);
             }
         }
     }
 
-    public String getUrlPattern() {
-        return urlPattern;
+    public String[] getUrlPatterns() {
+        return urlPatterns;
     }
 
     public boolean isRequestDispatch() {
@@ -123,8 +128,8 @@
         return jettyFilterHolder;
     }
 
-    public JettyServletHolder getServlet() {
-        return jettyServletHolder;
+    public Set getServlets() {
+        return jettyServletHolders;
     }
 
     public JettyFilterMapping getPrevious() {
@@ -139,24 +144,24 @@
 
     static {
         GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(JettyFilterMapping.class, NameFactory.URL_WEB_FILTER_MAPPING);
-        infoBuilder.addAttribute("urlPattern", String.class, true);
+        infoBuilder.addAttribute("urlPatterns", String[].class, true);
         infoBuilder.addAttribute("requestDispatch", boolean.class, true);
         infoBuilder.addAttribute("forwardDispatch", boolean.class, true);
         infoBuilder.addAttribute("includeDispatch", boolean.class, true);
         infoBuilder.addAttribute("errorDispatch", boolean.class, true);
 
         infoBuilder.addReference("Filter", JettyFilterHolder.class, NameFactory.WEB_FILTER);
-        infoBuilder.addReference("Servlet", JettyServletHolder.class, NameFactory.SERVLET);
+        infoBuilder.addReference("Servlets", Set.class, NameFactory.SERVLET);
         infoBuilder.addReference("Previous", JettyFilterMapping.class, NameFactory.URL_WEB_FILTER_MAPPING);
         infoBuilder.addReference("JettyServletRegistration", JettyServletRegistration.class, NameFactory.WEB_MODULE);
 
-        infoBuilder.setConstructor(new String[]{"urlPattern",
+        infoBuilder.setConstructor(new String[]{"urlPatterns",
                                                 "requestDispatch",
                                                 "forwardDispatch",
                                                 "includeDispatch",
                                                 "errorDispatch",
                                                 "Filter",
-                                                "Servlet",
+                                                "Servlets",
                                                 "Previous",
                                                 "JettyServletRegistration"});
 

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java Tue Jun 27 01:13:10 2006
@@ -27,6 +27,7 @@
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.servlet.UnavailableException;
+import javax.servlet.http.HttpServletRequest;
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
@@ -35,15 +36,16 @@
 import org.apache.geronimo.webservices.POJOWebServiceServlet;
 import org.apache.geronimo.webservices.WebServiceContainer;
 import org.apache.geronimo.webservices.WebServiceContainerInvoker;
+import org.mortbay.jetty.Request;
 import org.mortbay.jetty.servlet.ServletHolder;
-import org.mortbay.jetty.servlet.ServletHttpRequest;
+
 
 
 /**
  * This is intended to hold the web service stack for an axis POJO web service.
  * It is starting life as a copy of JettyServletHolder.
  *
- * @version $Rev: 385886 $ $Date$
+ * @version $Rev$ $Date$
  */
 public class JettyPOJOWebServiceHolder extends ServletHolder implements GBeanLifecycle {
     private WebServiceContainer webServiceContainer;
@@ -66,14 +68,16 @@
                                      WebServiceContainer webServiceContainer,
                                      ServletHolder previous,    //dependency for startup ordering
                                      JettyServletRegistration context) throws Exception {
-        super(context == null ? null : context.getServletHandler(), servletName, POJOWebServiceServlet.class.getName(), null);
+        super();
         //context will be null only for use as "default servlet info holder" in deployer.
 
         this.pojoClassName = pojoClassName;
         this.context = context;
         this.webServiceContainer = webServiceContainer;
         if (context != null) {
-            putAll(initParams);
+            setName(servletName);
+            setClassName(POJOWebServiceServlet.class.getName());
+            setInitParameters(initParams);
             if (loadOnStartup != null) {
                 setInitOrder(loadOnStartup.intValue());
             }
@@ -100,7 +104,7 @@
 //        request.setAttribute(POJOWebServiceServlet.WEBSERVICE_CONTAINER, webServiceContainer);
 
         JettyServletHolder.setCurrentServletName(getServletName());
-        PolicyContext.setHandlerData(ServletHttpRequest.unwrap(request));
+        PolicyContext.setHandlerData(Request.getRequest((HttpServletRequest)request));
 
         super.handle(request, response);
     }
@@ -118,12 +122,12 @@
             // put a reference the ID in the init-params
             // put the WebServiceContainer in the webapp context keyed by its ID
             String webServicecontainerID = getServletName() + WebServiceContainerInvoker.WEBSERVICE_CONTAINER + webServiceContainer.hashCode();
-            put(WebServiceContainerInvoker.WEBSERVICE_CONTAINER, webServicecontainerID);
+            setInitParameter(WebServiceContainerInvoker.WEBSERVICE_CONTAINER, webServicecontainerID);
             servletContext.setAttribute(webServicecontainerID, webServiceContainer);
 
             // Same for the POJO Class
             String pojoClassID = getServletName() + POJOWebServiceServlet.POJO_CLASS + pojoClass.hashCode();
-            put(POJOWebServiceServlet.POJO_CLASS, pojoClassID);
+            setInitParameter(POJOWebServiceServlet.POJO_CLASS, pojoClassID);
             servletContext.setAttribute(pojoClassID, pojoClass);
 
             //this now starts the servlet in the appropriate context
@@ -133,7 +137,7 @@
         }
     }
 
-    public void doStop() throws Exception {
+    public void doStop() {
     }
 
     public void doFail() {

Added: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecurityHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecurityHandler.java?rev=417369&view=auto
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecurityHandler.java (added)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecurityHandler.java Tue Jun 27 01:13:10 2006
@@ -0,0 +1,47 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.jetty;
+
+import java.io.IOException;
+
+import org.apache.geronimo.jetty.interceptor.SecurityContextBeforeAfter;
+import org.mortbay.jetty.HttpException;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Response;
+import org.mortbay.jetty.security.SecurityHandler;
+
+public class JettySecurityHandler extends SecurityHandler {
+    
+    private SecurityContextBeforeAfter securityInterceptor;
+    
+    public SecurityContextBeforeAfter getSecurityInterceptor() {
+        return this.securityInterceptor;
+    }
+    
+    public void setSecurityInterceptor (SecurityContextBeforeAfter securityInterceptor) {
+        this.securityInterceptor = securityInterceptor;
+    }
+    
+    public boolean checkSecurityConstraints(String pathInContext, Request request, Response response) throws HttpException, IOException {
+        if (securityInterceptor != null) {
+            return securityInterceptor.checkSecurityConstraints(pathInContext, request, response);
+        }
+        return super.checkSecurityConstraints(pathInContext, request, response);
+    }
+
+
+}

Propchange: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecurityHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecurityHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecurityHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServer.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServer.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServer.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServer.java Tue Jun 27 01:13:10 2006
@@ -16,7 +16,7 @@
  */
 package org.apache.geronimo.jetty;
 
-import org.mortbay.http.UserRealm;
+import org.mortbay.jetty.security.UserRealm;
 import org.mortbay.jetty.Server;
 
 
@@ -29,14 +29,39 @@
  */
 public class JettyServer extends Server {
 
+    public void addUserRealms (UserRealm[] realms) {
+        throw new IllegalArgumentException("You must supply a security-realm-name to every web module using security features");
+    }
+    
+    public void addUserRealm (UserRealm realm) {
+        throw new IllegalArgumentException("You must supply a security-realm-name to every web module using security features");
+    }
+    
+    /**
+     * TODO maybe remove intead?
+     * @param realm
+     * @return
+     * @deprecated
+     */
     public UserRealm addRealm(UserRealm realm) {
         throw new IllegalArgumentException("You must supply a security-realm-name to every web module using security features");
     }
 
+    /**
+     * TODO maybe remove instead?
+     * @param realmName
+     * @return
+     * @deprecated
+     */
     public UserRealm getRealm(String realmName) {
         throw new IllegalArgumentException("You must supply a security-realm-name to every web module using security features");
     }
 
+    /**
+     * TODO maybe remove instead?
+     * @param realm
+     * @deprecated
+     */
     public synchronized void removeRealm(UserRealm realm) {
         throw new IllegalArgumentException("You must supply a security-realm-name to every web module using security features");
     }

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServletHolder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServletHolder.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServletHolder.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServletHolder.java Tue Jun 27 01:13:10 2006
@@ -62,11 +62,14 @@
                               String runAsRole,
                               ServletHolder previous,  //dependency for startup ordering
                               JettyServletRegistration context) throws Exception {
-        super(context == null? null: context.getServletHandler(), servletName, servletClassName, jspFile);
+        super();
+        setName(servletName);
+        setClassName(servletClassName);
         //context will be null only for use as "default servlet info holder" in deployer.
 
         if (context != null) {
-            putAll(initParams);
+            setInitParameters(initParams);
+            setForcedPath(jspFile);
             if (loadOnStartup != null) {
                 //This has no effect on the actual start order, the gbean references "previous" control that.
                 setInitOrder(loadOnStartup.intValue());

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java Tue Jun 27 01:13:10 2006
@@ -64,25 +64,29 @@
 import org.apache.geronimo.transaction.TrackedConnectionAssociator;
 import org.apache.geronimo.transaction.context.OnlineUserTransaction;
 import org.apache.geronimo.transaction.context.TransactionContextManager;
-import org.mortbay.http.Authenticator;
-import org.mortbay.http.HttpException;
-import org.mortbay.http.HttpRequest;
-import org.mortbay.http.HttpResponse;
+import org.mortbay.jetty.HttpException;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Response;
+import org.mortbay.jetty.SessionManager;
+import org.mortbay.jetty.handler.ErrorHandler;
 import org.mortbay.jetty.servlet.AbstractSessionManager;
 import org.mortbay.jetty.servlet.Dispatcher;
 import org.mortbay.jetty.servlet.FilterHolder;
-import org.mortbay.jetty.servlet.JSR154Filter;
+import org.mortbay.jetty.servlet.ServletHandler;
 import org.mortbay.jetty.servlet.ServletHolder;
-import org.mortbay.jetty.servlet.SessionManager;
-import org.mortbay.jetty.servlet.WebApplicationContext;
-import org.mortbay.jetty.servlet.WebApplicationHandler;
+import org.mortbay.jetty.servlet.ServletMapping;
+import org.mortbay.jetty.servlet.SessionHandler;
+import org.mortbay.jetty.webapp.Configuration;
+import org.mortbay.jetty.webapp.WebAppContext;
+import org.mortbay.jetty.webapp.WebAppContext.WebAppErrorHandler;
+import org.mortbay.jetty.security.Authenticator;
 
 /**
  * Wrapper for a WebApplicationContext that sets up its J2EE environment.
  *
  * @version $Rev$ $Date$
  */
-public class JettyWebAppContext extends WebApplicationContext implements GBeanLifecycle, JettyServletRegistration, WebModule {
+public class JettyWebAppContext implements GBeanLifecycle, JettyServletRegistration, WebModule {
     private static Log log = LogFactory.getLog(JettyWebAppContext.class);
 
     private final String originalSpecDD;
@@ -94,7 +98,6 @@
 
     private final String webAppRoot;
     private final URL configurationBaseURL;
-    private final WebApplicationHandler handler;
     private String displayName;
     private final String[] welcomeFiles;
 
@@ -103,28 +106,21 @@
     private final SecurityContextBeforeAfter securityInterceptor;
 
     private final String objectName;
+    private String sessionManagerClassName;
+    private WebAppContext webAppContext;//delegate
 
     private final Set servletNames = new HashSet();
 
-    private String sessionManager;
 
 
-    public static class SessionManagerConfiguration implements WebApplicationContext.Configuration {
-
-        private WebApplicationContext webAppContext;
+    public class SessionManagerConfiguration implements Configuration {
 
+       private WebAppContext webAppContext;
 
         public SessionManagerConfiguration() {
         }
 
 
-        public void setWebApplicationContext(WebApplicationContext webAppContext) {
-            this.webAppContext = webAppContext;
-        }
-
-        public WebApplicationContext getWebApplicationContext() {
-            return this.webAppContext;
-        }
 
         public void configureClassPath() throws Exception {
         }
@@ -134,17 +130,30 @@
 
 
         public void configureWebApp() throws Exception {
-            //setup a SessionManager
-            log.debug("About to configure a SessionManager");
-            String sessionManagerClassName = ((JettyWebAppContext) webAppContext).getSessionManager();
-            if (sessionManagerClassName != null) {
-                Class clazz = Thread.currentThread().getContextClassLoader().loadClass(sessionManagerClassName);
-                Object o = clazz.newInstance();
-                log.debug("Setting SessionManager type=" + clazz.getName() + " instance=" + o);
-                this.webAppContext.getServletHandler().setSessionManager((SessionManager) o);
-            }
-        }
+          //setup a SessionManager
+          log.debug("About to configure a SessionManager");
+          String sessionManagerClassName = JettyWebAppContext.this.getSessionManager();
+          if (sessionManagerClassName != null && sessionManagerClassName.trim().length() != 0) {
+            Class clazz = Thread.currentThread().getContextClassLoader().loadClass(sessionManagerClassName);
+            SessionManager sm = (SessionManager)clazz.newInstance();
+            log.debug("Setting SessionManager type=" + clazz.getName() + " instance=" + sm);
+            getWebAppContext().getSessionHandler().setSessionManager(sm);
+          }
+       }
+
+      public void setWebAppContext(WebAppContext webAppContext) {
+        this.webAppContext = webAppContext;
+      }
+   
+      public WebAppContext getWebAppContext() {
+        return this.webAppContext;
+      }
+
+      public void configureClassLoader() throws Exception {
+      }
 
+      public void deconfigureWebApp() throws Exception {
+      }
     }
 
     /**
@@ -157,14 +166,13 @@
         webClassLoader = null;
         jettyContainer = null;
         webAppRoot = null;
-        handler = null;
         chain = null;
         contextLength = 0;
         securityInterceptor = null;
         welcomeFiles = null;
         objectName = null;
-        sessionManager = null;
-        configurationBaseURL = null;
+        sessionManagerClassName = null;
+        webAppContext = null;
     }
 
     public JettyWebAppContext(String objectName,
@@ -212,6 +220,8 @@
         assert transactionContextManager != null;
         assert trackedConnectionAssociator != null;
         assert jettyContainer != null;
+        this.webAppContext = new WebAppContext(new JettySecurityHandler(), null, null, null);
+        this.sessionManagerClassName = sessionManager;
 
         this.server = server;
         this.application = application;
@@ -223,37 +233,38 @@
         this.configurationBaseURL = configurationBaseUrl;
 
         this.jettyContainer = jettyContainer;
-
         this.originalSpecDD = originalSpecDD;
+        this.webAppContext.setConfigurationClasses(new String[]{});
 
-        setConfigurationClassNames(new String[]{});
 
         webAppRoot = configurationBaseUrl.toString();
         this.webClassLoader = classLoader;
-        setClassLoader(this.webClassLoader);
+        this.webAppContext.setClassLoader(this.webClassLoader);
 
         if (host != null) {
-            setHosts(host.getHosts());
-            setVirtualHosts(host.getVirtualHosts());
+            this.webAppContext.setHosts(host.getHosts());
+            this.webAppContext.setVirtualHosts(host.getVirtualHosts());
         }
 
         //use our wrapper to avoid leaking subject back to the caller
-        handler = new JettyWebApplicationHandler();
-        addHandler(handler);
+        //TODO: this isn't right for jetty6, work out what the point is
+        //and replace with jetty6ism
+        //handler = new JettyWebApplicationHandler();
+        //addHandler(handler);
 
         userTransaction.setUp(transactionContextManager, trackedConnectionAssociator);
 
         //stuff from spec dd
-        setDisplayName(displayName);
-        setContextParamMap(contextParamMap);
+        this.webAppContext.setDisplayName(displayName);
+        this.webAppContext.setInitParams(contextParamMap);
         setListenerClassNames(listenerClassNames);
-        setDistributable(distributable);
-        setMimeMap(mimeMap);
+        this.webAppContext.setDistributable(distributable);
+        //TODO: for jetty6
+        //setMimeMap(mimeMap);
         this.welcomeFiles = welcomeFiles;
         setLocaleEncodingMapping(localeEncodingMapping);
         setErrorPages(errorPages);
-        setAuthenticator(authenticator);
-        setRealmName(realmName);
+        this.webAppContext.getSecurityHandler().setAuthenticator(authenticator);
         setTagLibMap(tagLibMap);
         setSessionTimeoutSeconds(sessionTimeoutSeconds);
 
@@ -267,7 +278,7 @@
                 ((ClassLoaderAwareReference) value).setClassLoader(this.webClassLoader);
             }
         }
-        Context enc = EnterpriseNamingContext.createEnterpriseNamingContext(componentContext);
+        javax.naming.Context enc = EnterpriseNamingContext.createEnterpriseNamingContext(componentContext);
 
         int index = 0;
         BeforeAfter interceptor = new InstanceContextBeforeAfter(null, index++, unshareableResources, applicationManagedSecurityResources, trackedConnectionAssociator);
@@ -285,25 +296,18 @@
             InternalJAASJettyRealm internalJAASJettyRealm = jettyContainer.addRealm(securityRealmName);
             //wrap jetty realm with something that knows the dumb realmName
             JAASJettyRealm realm = new JAASJettyRealm(realmName, internalJAASJettyRealm);
-            setRealm(realm);
+            this.webAppContext.getSecurityHandler().setUserRealm(realm);
             this.securityInterceptor = new SecurityContextBeforeAfter(interceptor, index++, index++, policyContextID, defaultPrincipal, authenticator, checkedPermissions, excludedPermissions, roleDesignates, realm, classLoader);
             interceptor = this.securityInterceptor;
         } else {
             securityInterceptor = null;
         }
 //      end JACC
-        interceptor = new RequestWrappingBeforeAfter(interceptor, handler);
+        interceptor = new RequestWrappingBeforeAfter(interceptor, getServletHandler());
         chain = interceptor;
         contextLength = index;
 
-        //cheat -- add jsr154 filter not as a gbean
-        FilterHolder jsr154FilterHolder = new FilterHolder(handler, "jsr154", JSR154Filter.class.getName());
-        handler.addFilterHolder(jsr154FilterHolder);
-        jsr154FilterHolder.setInitParameter("unwrappedDispatch", "true");
-        handler.addFilterPathMapping("/*", "jsr154", Dispatcher.__REQUEST | Dispatcher.__FORWARD | Dispatcher.__INCLUDE | Dispatcher.__ERROR);
-
         configureSessionManager(sessionManager);
-
     }
 
 
@@ -363,14 +367,18 @@
             return null;
         }
     }
+    
+    public String getContextPath () {
+        return this.webAppContext.getContextPath();
+    }
 
-    public Object enterContextScope(HttpRequest httpRequest, HttpResponse httpResponse) {
+    public Object enterContextScope(Request httpRequest, Response httpResponse) {
         Object[] context = new Object[contextLength];
         chain.before(context, httpRequest, httpResponse);
         return context;
     }
 
-    public void leaveContextScope(HttpRequest httpRequest, HttpResponse httpResponse, Object oldScope) {
+    public void leaveContextScope(Request httpRequest, Response httpResponse, Object oldScope) {
         Object[] context = (Object[]) oldScope;
         chain.after(context, httpRequest, httpResponse);
     }
@@ -382,36 +390,37 @@
 
     public void doStart() throws Exception {
         // reset the classsloader... jetty likes to set it to null when stopping
-        setClassLoader(webClassLoader);
+        this.webAppContext.setClassLoader(webClassLoader);
 
         // merge Geronimo and Jetty Lifecycles
-        if (!isStarting()) {
-            super.start();
+        if (!this.webAppContext.isStarting()) {
+            this.webAppContext.start();
             return;
         }
 
-        ((AbstractSessionManager) getServletHandler().getSessionManager()).setUseRequestedId(true);
 
-        setWAR(webAppRoot);
+        this.webAppContext.setWar(webAppRoot.toString());
 
-        jettyContainer.addContext(this);
+        jettyContainer.addContext(this.webAppContext);
 
         Object context = enterContextScope(null, null);
         try {
-            super.doStart();
+          //TODO: this used to be doStart() not start() - why?
+            this.webAppContext.start();
         } finally {
             leaveContextScope(null, null, context);
         }
+        //TODO: probably not true for jetty6
         //super.doStart sets welcomefiles to null!!
-        setWelcomeFiles(welcomeFiles);
+        //this.webAppContext.setWelcomeFiles(welcomeFiles);
 
         log.debug("JettyWebAppContext started");
     }
 
     public void doStop() throws Exception {
         // merge Geronimo and Jetty Lifecycles
-        if (!isStopping()) {
-            super.stop();
+        if (!this.webAppContext.isStopping()) {
+            this.webAppContext.stop();
             return;
         }
 
@@ -420,10 +429,10 @@
         }
         Object context = enterContextScope(null, null);
         try {
-            super.doStop();
+            this.webAppContext.stop();
         } finally {
             leaveContextScope(null, null, context);
-            jettyContainer.removeContext(this);
+            jettyContainer.removeContext(this.webAppContext);
         }
 
         // No more logging will occur for this ClassLoader. Inform the LogFactory to avoid a memory leak.
@@ -434,31 +443,20 @@
 
     public void doFail() {
         try {
-            //this will call doStop
-            super.stop();
-        } catch (InterruptedException e) {
+            this.webAppContext.stop();
+        } catch (Exception e) {
         }
 
         log.warn("JettyWebAppContext failed");
     }
 
-    //pass through attributes.  They should be constructor params
-
-    //TODO encourage jetty to improve their naming convention.
-    public void setContextParamMap(Map initParameters) {
-        if (initParameters != null) {
-            for (Iterator iterator = initParameters.entrySet().iterator(); iterator.hasNext();) {
-                Map.Entry entry = (Map.Entry) iterator.next();
-                setInitParameter((String) entry.getKey(), (String) entry.getValue());
-            }
-        }
-    }
+   
 
     public void setLocaleEncodingMapping(Map localeEncodingMap) {
         if (localeEncodingMap != null) {
             for (Iterator iterator = localeEncodingMap.entrySet().iterator(); iterator.hasNext();) {
                 Map.Entry entry = (Map.Entry) iterator.next();
-                addLocaleEncoding((String) entry.getKey(), (String) entry.getValue());
+                this.webAppContext.addLocaleEncoding((String) entry.getKey(), (String) entry.getValue());
             }
         }
     }
@@ -467,20 +465,16 @@
         if (eventListeners != null) {
             for (Iterator iterator = eventListeners.iterator(); iterator.hasNext();) {
                 String listenerClassName = (String) iterator.next();
-                Class clazz = loadClass(listenerClassName);
+                Class clazz = this.webAppContext.loadClass(listenerClassName);
                 EventListener listener = (EventListener) clazz.newInstance();
-                addEventListener(listener);
-                handler.addEventListener(listener);
+                this.webAppContext.addEventListener(listener);
             }
         }
     }
 
     public void setErrorPages(Map errorPageMap) {
         if (errorPageMap != null) {
-            for (Iterator iterator = errorPageMap.entrySet().iterator(); iterator.hasNext();) {
-                Map.Entry entry = (Map.Entry) iterator.next();
-                setErrorPage((String) entry.getKey(), (String) entry.getValue());
-            }
+            ((WebAppErrorHandler)this.webAppContext.getErrorHandler()).setErrorPages(errorPageMap);
         }
     }
 
@@ -488,13 +482,13 @@
         if (tagLibMap != null) {
             for (Iterator iterator = tagLibMap.entrySet().iterator(); iterator.hasNext();) {
                 Map.Entry entry = (Map.Entry) iterator.next();
-                setResourceAlias((String) entry.getKey(), (String) entry.getValue());
+                this.webAppContext.setResourceAlias((String) entry.getKey(), (String) entry.getValue());
             }
         }
     }
 
     public void setSessionTimeoutSeconds(int seconds) {
-        handler.setSessionInactiveInterval(seconds);
+        this.webAppContext.getSessionHandler().getSessionManager().setMaxInactiveInterval(seconds);
     }
 
 
@@ -505,7 +499,7 @@
 
     public void setDisplayName(String displayName) {
         this.displayName = displayName;
-        super.setDisplayName(displayName);
+        this.webAppContext.setDisplayName(displayName);
     }
 
     public String getDeploymentDescriptor() {
@@ -533,24 +527,40 @@
         }
     }
 
+    public ServletHandler getServletHandler() {
+        return this.webAppContext.getServletHandler();
+    }
+
     public String getSessionManager() {
-        return this.sessionManager;
+        return this.sessionManagerClassName;
     }
 
 
     private void configureSessionManager(String sessionManagerClassName) {
-        this.sessionManager = sessionManagerClassName;
-        if (this.sessionManager != null) {
-            addConfiguration(SessionManagerConfiguration.class.getName());
-        }
+      if (this.webAppContext.isDistributable())
+        this.sessionManagerClassName = jettyContainer.getDistributableSessionManager();
+      else
+        this.sessionManagerClassName = jettyContainer.getLocalSessionManager();
+      log.debug("SessionManager classname=" + this.sessionManagerClassName);
+      if (this.sessionManagerClassName != null) {
+        addConfiguration(SessionManagerConfiguration.class.getName());
+      }
+
     }
 
     private void addConfiguration(String configClassName) {
-        String[] configClassNames = getConfigurationClassNames();
-        String[] newConfigClassNames = new String[configClassNames == null ? 1 : configClassNames.length + 1];
-        System.arraycopy(configClassNames, 0, newConfigClassNames, 0, configClassNames.length);
+      String[] configClassNames = this.webAppContext.getConfigurationClasses();
+      String[] newConfigClassNames = new String[configClassNames == null ? 1 : configClassNames.length + 1];
+      for (int i = 0; (configClassNames != null) && (i < configClassNames.length); i++)
+        newConfigClassNames[i] = configClassNames[i];
+
+      newConfigClassNames[newConfigClassNames.length - 1] = configClassName;
+      this.webAppContext.setConfigurationClasses(newConfigClassNames);
+      if (log.isDebugEnabled()) {
+        for (int i = 0; i < newConfigClassNames.length; i++)
+          log.debug("Configuration: "+newConfigClassNames[i] + " ");
+      }
 
-        newConfigClassNames[newConfigClassNames.length - 1] = configClassName;
     }
 
     /**
@@ -582,11 +592,14 @@
 
     public void registerServletHolder(ServletHolder servletHolder, String servletName, Set servletMappings, String objectName) throws Exception {
         //TODO filters
-        handler.addServletHolder(servletHolder);
+        this.webAppContext.getServletHandler().addServlet(servletHolder);
         if (servletMappings != null) {
             for (Iterator iterator = servletMappings.iterator(); iterator.hasNext();) {
                 String urlPattern = (String) iterator.next();
-                handler.mapPathToServlet(urlPattern, servletName);
+                ServletMapping servletMapping = new ServletMapping();
+                servletMapping.setPathSpec(urlPattern);
+                servletMapping.setServletName(servletName);
+                this.webAppContext.getServletHandler().addServletMapping(servletMapping);
             }
         }
         Object context = enterContextScope(null, null);
@@ -602,12 +615,6 @@
         }
     }
 
-    public boolean checkSecurityConstraints(String pathInContext, HttpRequest request, HttpResponse response) throws HttpException, IOException {
-        if (securityInterceptor != null) {
-            return securityInterceptor.checkSecurityConstraints(pathInContext, request, response);
-        }
-        return super.checkSecurityConstraints(pathInContext, request, response);
-    }
 
 
     public static final GBeanInfo GBEAN_INFO;
@@ -662,7 +669,7 @@
 
         infoBuilder.addAttribute("kernel", Kernel.class, false);
         infoBuilder.addAttribute("objectName", String.class, false);
-        infoBuilder.addAttribute("server", String.class, false);
+        infoBuilder.addAttribute("serverObjectName", String.class, false);
         infoBuilder.addAttribute("application", String.class, false);
         infoBuilder.addAttribute("javaVMs", String[].class, false);
         infoBuilder.addAttribute("servlets", String[].class, false);

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebConnector.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebConnector.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebConnector.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebConnector.java Tue Jun 27 01:13:10 2006
@@ -25,33 +25,7 @@
  */
 public interface JettyWebConnector extends WebConnector {
 
-    /**
-     * Gets the minimum number of threads used to service connections from
-     * this connector.
-     */
-    public int getMinThreads();
-
-    /**
-     * Sets the minimum number of threads used to service connections from
-     * this connector.
-     */
-    public void setMinThreads(int threads);
-
-    public int getThreads();
-
-    public int getIdlethreads();
-
-    public String getDefaultScheme();
-
-    public void setMaxIdleTimeMs(int max);
-
-    public int getMaxIdleTimeMs();
-
-    public void setLowThreadsMaxIdleTimeMs(int max);
-
-    public int getLowThreadsMaxIdleTimeMs();
-
-    public void setLowThreads(int lowThreads);
-
-    public int getLowThreads();
+    public void setMaxIdleTime(long maxIdleTime);
+    
+    public long getMaxIdleTime();
 }

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/NonAuthenticator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/NonAuthenticator.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/NonAuthenticator.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/NonAuthenticator.java Tue Jun 27 01:13:10 2006
@@ -1,9 +1,9 @@
 package org.apache.geronimo.jetty;
 
-import org.mortbay.http.Authenticator;
-import org.mortbay.http.UserRealm;
-import org.mortbay.http.HttpRequest;
-import org.mortbay.http.HttpResponse;
+import org.mortbay.jetty.security.Authenticator;
+import org.mortbay.jetty.security.UserRealm;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Response;
 
 import java.security.Principal;
 import java.io.IOException;
@@ -13,7 +13,7 @@
  * in an unsecured web app.
  */
 public class NonAuthenticator implements Authenticator {
-    public Principal authenticate(UserRealm realm, String pathInContext, HttpRequest request, HttpResponse response) throws IOException {
+    public Principal authenticate(UserRealm realm, String pathInContext, Request request, Response response) throws IOException {
         return null;
     }
 

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/AJP13Connector.java Tue Jun 27 01:13:10 2006
@@ -21,14 +21,16 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.jetty.JettyContainer;
 import org.apache.geronimo.management.geronimo.WebManager;
-import org.mortbay.http.ajp.AJP13Listener;
+//TODO: no AJP13 Connector for jetty6
+//import org.mortbay.http.ajp.AJP13Listener;
 
 /**
  * @version $Rev$ $Date$
  */
 public class AJP13Connector extends JettyConnector {
     public AJP13Connector(JettyContainer container) {
-        super(container, new AJP13Listener());
+        //throw new UnsupportedOperationException("No AJP13Connector for jetty6
+        //TODO:there is no ajp13 connector, but just ignore this for now
     }
 
     public String getProtocol() {

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/GeronimoSSLListener.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/GeronimoSSLListener.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/GeronimoSSLListener.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/GeronimoSSLListener.java Tue Jun 27 01:13:10 2006
@@ -16,7 +16,7 @@
  */
 package org.apache.geronimo.jetty.connector;
 
-import org.mortbay.http.SslListener;
+import org.mortbay.jetty.security.SslSocketConnector;
 import org.apache.geronimo.management.geronimo.KeystoreManager;
 
 import javax.net.ssl.SSLServerSocketFactory;
@@ -26,7 +26,7 @@
  *
  * @version $Rev$ $Date$
  */
-public class GeronimoSSLListener extends SslListener {
+public class GeronimoSSLListener extends SslSocketConnector {
     private KeystoreManager manager;
     private String keyStore;
     private String trustStore;
@@ -38,7 +38,7 @@
 
     protected SSLServerSocketFactory createFactory() throws Exception {
         // we need the server factory version.
-        return manager.createSSLServerFactory(null, getProtocol(), getAlgorithm(), keyStore, keyAlias, trustStore, SslListener.class.getClassLoader());
+        return manager.createSSLServerFactory(null, getProtocol(), getAlgorithm(), keyStore, keyAlias, trustStore, SslSocketConnector.class.getClassLoader());
     }
 
     public String getKeyStore() {

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPConnector.java Tue Jun 27 01:13:10 2006
@@ -21,14 +21,14 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.jetty.JettyContainer;
 import org.apache.geronimo.management.geronimo.WebManager;
-import org.mortbay.http.SocketListener;
+import org.mortbay.jetty.bio.SocketConnector;
 
 /**
  * @version $Rev$ $Date$
  */
 public class HTTPConnector extends JettyConnector {
     public HTTPConnector(JettyContainer container) {
-        super(container, new SocketListener());
+        super(container, new SocketConnector());
     }
 
     public String getProtocol() {

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java Tue Jun 27 01:13:10 2006
@@ -27,10 +27,10 @@
 import org.apache.geronimo.jetty.JettyContainer;
 import org.apache.geronimo.jetty.JettyWebConnector;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.mortbay.http.HttpListener;
-import org.mortbay.http.SocketListener;
-import org.mortbay.http.ajp.AJP13Listener;
-import org.mortbay.util.ThreadedServer;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.bio.SocketConnector;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.jetty.AbstractConnector;
 
 /**
  * Base class for GBeans for Jetty network connectors (HTTP, HTTPS, AJP, etc.).
@@ -40,7 +40,7 @@
 public abstract class JettyConnector implements GBeanLifecycle, JettyWebConnector {
     public final static String CONNECTOR_CONTAINER_REFERENCE = "JettyContainer";
     private final JettyContainer container;
-    protected final HttpListener listener;
+    protected final Connector listener;
     private String connectHost;
 
     /**
@@ -56,15 +56,14 @@
         this.listener = null;
     }
 
-    public JettyConnector(JettyContainer container, HttpListener listener) {
+    public JettyConnector(JettyContainer container, Connector listener) {
         this.container = container;
         this.listener = listener;
     }
 
-    public String getDefaultScheme() {
-        return listener.getDefaultScheme();
-    }
 
+    //TODO: support the jetty6 specific methods
+   
     public String getHost() {
         return listener.getHost();
     }
@@ -106,122 +105,126 @@
         return getProtocol().toLowerCase()+"://"+connectHost+(getPort() == getDefaultPort() ? "" : ":"+getPort());
     }
 
-    public void setMinThreads(int minThreads) {
-      ((ThreadedServer)listener).setMinThreads(minThreads);
-    }
-
-    public int getMinThreads() {
-      return ((ThreadedServer)listener).getMinThreads();
-    }
-
-
-    public void setMaxThreads(int maxThreads) {
-      ((ThreadedServer)listener).setMaxThreads(maxThreads);
-    }
-
-    public int getMaxThreads() {
-      return ((ThreadedServer)listener).getMaxThreads();
+    public long getMaxIdleTimeMs () {
+        return ((AbstractConnector)listener).getMaxIdleTime();
     }
-
-    public void setMaxIdleTimeMs(int max) {
-        ((ThreadedServer)listener).setMaxIdleTimeMs(max);
+    
+    public void setMaxIdleTimeMs (int idleTime) {
+        ((AbstractConnector)listener).setMaxIdleTime(idleTime);
     }
 
-    public int getMaxIdleTimeMs() {
-      return ((ThreadedServer)listener).getMaxIdleTimeMs();
-    }
 
     public void setLowThreadsMaxIdleTimeMs(int max) {
-      if (listener instanceof SocketListener)
-        ((SocketListener)listener).setLowResourcePersistTimeMs(max);
+      //TODO: not supported on jetty6 connectors
     }
 
     public int getLowThreadsMaxIdleTimeMs() {
-      if (listener instanceof SocketListener)
-        return ((SocketListener)listener).getLowResourcePersistTimeMs();
-      return -1;
-    }
+        //TODO: not supported on jetty6 connectors
+        return -1;
+     }
+
+     public void setLowThreads(int lowThreads) {
+       //TODO: no supported on jetty6 connectors
+     }
+
+     public int getLowThreads() {
+      //TODO: not supported on jetty6 connectors
+         return -1;
+     }
+
+     public int getThreads() {
+       //TODO: should this get the entire threadpool?
+       return 0;
+     }
+
+     public int getIdlethreads() {
+       //TODO: not supported in jetty6
+       return 0;
+     }
 
-    public void setLowThreads(int lowThreads) {
-      if (listener instanceof SocketListener)
-        ((SocketListener)listener).setLowResources(lowThreads);
-    }
-
-    public int getLowThreads() {
-      if (listener instanceof SocketListener)
-        return ((SocketListener)listener).getLowResources();
-      return -1;
-    }
-
-    public int getThreads() {
-      return ((ThreadedServer)listener).getThreads();
-    }
-
-    public int getIdlethreads() {
-      return ((ThreadedServer)listener).getIdleThreads();
-    }
-    
-    public InetSocketAddress getListenAddress() {
-        return new InetSocketAddress(getHost(), getPort());
-    }
 
+   
     public int getBufferSizeBytes() {
-        return listener.getBufferSize();
+        //TODO return the request buffer size, what about the response and header buffer size?
+        return listener.getRequestBufferSize();
     }
 
     public void setBufferSizeBytes(int bytes) {
-        if(listener instanceof SocketListener) {
-            SocketListener socketListener = (SocketListener)listener;
-            socketListener.setBufferSize(bytes);
-        } else if(listener instanceof AJP13Listener) {
-            ((AJP13Listener)listener).setBufferSize(bytes);
-        } else {
-            throw new UnsupportedOperationException(listener == null ? "No Listener" : listener.getClass().getName()); //todo: can this happen?
-        }
+        //TODO what about the response and header buffer size?
+        listener.setRequestBufferSize(bytes);
     }
 
     public int getAcceptQueueSize() {
-        return ((ThreadedServer)listener).getAcceptQueueSize();
+        return ((AbstractConnector)listener).getAcceptQueueSize();
     }
 
     public void setAcceptQueueSize(int size) {
-        ((ThreadedServer)listener).setAcceptQueueSize(size);
+        ((AbstractConnector)listener).setAcceptQueueSize(size);
     }
 
     public int getLingerMillis() {
-        return ((ThreadedServer)listener).getLingerTimeSecs()*1000;
+        return (int)((AbstractConnector)listener).getSoLingerTime();
     }
 
     public void setLingerMillis(int millis) {
-        ((ThreadedServer)listener).setLingerTimeSecs(Math.round((float)millis/1000f));
+        ((AbstractConnector)listener).setSoLingerTime(millis);
     }
 
     public boolean isTcpNoDelay() {
-        return ((ThreadedServer)listener).getTcpNoDelay();
+        return true;
     }
 
     public void setTcpNoDelay(boolean enable) {
-        ((ThreadedServer)listener).setTcpNoDelay(enable);
+        throw new UnsupportedOperationException(listener == null ? "No Listener" : listener.getClass().getName());
+    }
+    
+    public void setMaxThreads (int maxThreads) {
+      //TODO: in jetty6 connectors have a number of acceptor threads
+      ((AbstractConnector)listener).setAcceptors(maxThreads);
+    }
+    
+    public int getMaxThreads () {
+      //TODO: confirm that this is reasonable
+      return ((AbstractConnector)listener).getAcceptors();
     }
 
     public int getRedirectPort() {
         return listener.getConfidentialPort();
     }
 
+    public InetSocketAddress getListenAddress () {
+        try {
+            return new InetSocketAddress(InetAddress.getByName(listener.getHost()), listener.getPort());
+        } catch (UnknownHostException e) {
+            throw new IllegalStateException("InetSocketAddress cannot be determined for host="+listener.getHost());
+        }
+    }
+    
     public void setRedirectPort(int port) {
-        if(listener instanceof SocketListener) {
-            SocketListener socketListener = (SocketListener)listener;
+        if(listener instanceof SocketConnector) {
+            SocketConnector socketListener = (SocketConnector)listener;
             socketListener.setConfidentialPort(port);
             socketListener.setIntegralPort(port);
             socketListener.setIntegralScheme("https");
             socketListener.setConfidentialScheme("https");
-        } else if(listener instanceof AJP13Listener) {
+        } else if(listener instanceof SelectChannelConnector) {
+            SelectChannelConnector connector = (SelectChannelConnector)listener;
+            connector.setConfidentialPort(port);
+            connector.setIntegralPort(port);
+            connector.setIntegralScheme("https");
+            connector.setConfidentialScheme("https");
+        }
+        /*
+         * don't have one of these yet
+        else if(listener instanceof AJP13Listener) {
             AJP13Listener ajpListener = (AJP13Listener) listener;
             ajpListener.setConfidentialPort(port);
             ajpListener.setIntegralPort(port);
             ajpListener.setIntegralScheme("https");
             ajpListener.setConfidentialScheme("https");
-        } else {
+        } 
+        */
+        else {
             throw new UnsupportedOperationException(listener == null ? "No Listener" : listener.getClass().getName()); //todo: can this happen?
         }
     }
@@ -230,7 +233,6 @@
 
     public void doStart() throws Exception {
         container.addListener(listener);
-        ((ThreadedServer) listener).open();
         listener.start();
     }
 
@@ -240,7 +242,7 @@
                 listener.stop();
                 container.removeListener(listener);
                 return;
-            } catch (InterruptedException e) {
+            } catch (Exception e) {
                 continue;
             }
         }
@@ -252,7 +254,7 @@
                 listener.stop();
                 container.removeListener(listener);
                 return;
-            } catch (InterruptedException e) {
+            } catch (Exception e) {
                 continue;
             }
         }

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/BeforeAfter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/BeforeAfter.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/BeforeAfter.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/BeforeAfter.java Tue Jun 27 01:13:10 2006
@@ -16,16 +16,16 @@
  */
 package org.apache.geronimo.jetty.interceptor;
 
-import org.mortbay.http.HttpRequest;
-import org.mortbay.http.HttpResponse;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Response;
 
 /**
  * @version $Rev$ $Date$
  */
 public interface BeforeAfter {
 
-    void before(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse);
+    void before(Object[] context, Request httpRequest, Response httpResponse);
 
-    void after(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse);
+    void after(Object[] context, Request httpRequest, Response httpResponse);
 
 }

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/ComponentContextBeforeAfter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/ComponentContextBeforeAfter.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/ComponentContextBeforeAfter.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/ComponentContextBeforeAfter.java Tue Jun 27 01:13:10 2006
@@ -19,8 +19,8 @@
 import javax.naming.Context;
 
 import org.apache.geronimo.naming.java.RootContext;
-import org.mortbay.http.HttpRequest;
-import org.mortbay.http.HttpResponse;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Response;
 
 /**
  * @version $Rev$ $Date$
@@ -37,7 +37,7 @@
         this.componentContext = componentContext;
     }
 
-    public void before(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse) {
+    public void before(Object[] context, Request httpRequest, Response httpResponse) {
         context[index] = RootContext.getComponentContext();
         RootContext.setComponentContext(componentContext);
         if (next != null) {
@@ -45,7 +45,7 @@
         }
     }
 
-    public void after(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse) {
+    public void after(Object[] context, Request httpRequest, Response httpResponse) {
         if (next != null) {
             next.after(context, httpRequest, httpResponse);
         }

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/InstanceContextBeforeAfter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/InstanceContextBeforeAfter.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/InstanceContextBeforeAfter.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/InstanceContextBeforeAfter.java Tue Jun 27 01:13:10 2006
@@ -22,8 +22,8 @@
 import org.apache.geronimo.transaction.DefaultInstanceContext;
 import org.apache.geronimo.transaction.InstanceContext;
 import org.apache.geronimo.transaction.TrackedConnectionAssociator;
-import org.mortbay.http.HttpRequest;
-import org.mortbay.http.HttpResponse;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Response;
 
 /**
  * @version $Rev$ $Date$
@@ -44,7 +44,7 @@
         this.trackedConnectionAssociator = trackedConnectionAssociator;
     }
 
-    public void before(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse) {
+    public void before(Object[] context, Request httpRequest, Response httpResponse) {
         try {
             context[index] = trackedConnectionAssociator.enter(new DefaultInstanceContext(unshareableResources, applicationManagedSecurityResources));
         } catch (ResourceException e) {
@@ -55,7 +55,7 @@
         }
     }
 
-    public void after(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse) {
+    public void after(Object[] context, Request httpRequest, Response httpResponse) {
         if (next != null) {
             next.after(context, httpRequest, httpResponse);
         }

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/RequestWrappingBeforeAfter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/RequestWrappingBeforeAfter.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/RequestWrappingBeforeAfter.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/RequestWrappingBeforeAfter.java Tue Jun 27 01:13:10 2006
@@ -16,11 +16,10 @@
  */
 package org.apache.geronimo.jetty.interceptor;
 
-import org.mortbay.http.HttpRequest;
-import org.mortbay.http.HttpResponse;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Response;
 import org.mortbay.jetty.servlet.ServletHandler;
-import org.mortbay.jetty.servlet.ServletHttpRequest;
-import org.mortbay.jetty.servlet.ServletHttpResponse;
+
 
 /**
  * @version $Rev$ $Date$
@@ -34,8 +33,10 @@
         this.handler = handler;
     }
     
-    public void before(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse) {
-        if (httpRequest != null) {
+    public void before(Object[] context, Request httpRequest, Response httpResponse) {
+        //TODO - I think this interceptor is no longer necessary
+/*        if (httpRequest != null) {
+            
             ServletHttpRequest request = (ServletHttpRequest) httpRequest.getWrapper();
             if (request == null)
             {
@@ -45,11 +46,11 @@
                 httpRequest.setWrapper(request);
                 httpResponse.setWrapper(response);
             }
-        }
+        }*/
         next.before(context, httpRequest, httpResponse);
     }
 
-    public void after(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse) {
+    public void after(Object[] context, Request httpRequest, Response httpResponse) {
         next.after(context, httpRequest, httpResponse);
     }
 }

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/SecurityContextBeforeAfter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/SecurityContextBeforeAfter.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/SecurityContextBeforeAfter.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/SecurityContextBeforeAfter.java Tue Jun 27 01:13:10 2006
@@ -26,9 +26,13 @@
 import org.apache.geronimo.security.SubjectId;
 import org.apache.geronimo.security.deploy.DefaultPrincipal;
 import org.apache.geronimo.security.util.ConfigurationUtil;
-import org.mortbay.http.*;
-import org.mortbay.jetty.servlet.FormAuthenticator;
-import org.mortbay.jetty.servlet.ServletHttpRequest;
+
+import org.mortbay.jetty.security.Authenticator;
+import org.mortbay.jetty.security.FormAuthenticator;
+import org.mortbay.jetty.security.SecurityHandler;
+import org.mortbay.jetty.HttpException;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Response;
 
 import javax.security.auth.Subject;
 import javax.security.jacc.PolicyContext;
@@ -114,24 +118,21 @@
         jettyContainer.removeRealm(realm.getSecurityRealmName());
     }
 
-    public void before(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse) {
+    public void before(Object[] context, Request httpRequest, Response httpResponse) {
         context[policyContextIDIndex] = PolicyContext.getContextID();
         context[webAppContextIndex] = getCurrentSecurityInterceptor();
 
         PolicyContext.setContextID(policyContextID);
         setCurrentSecurityInterceptor(this);
 
-        if (httpRequest != null) {
-            ServletHttpRequest request = (ServletHttpRequest) httpRequest.getWrapper();
-            PolicyContext.setHandlerData(request);
-        }
+        PolicyContext.setHandlerData(httpRequest);
 
         if (next != null) {
             next.before(context, httpRequest, httpResponse);
         }
     }
 
-    public void after(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse) {
+    public void after(Object[] context, Request httpRequest, Response httpResponse) {
         if (next != null) {
             next.after(context, httpRequest, httpResponse);
         }
@@ -172,7 +173,7 @@
      * @return true if the path in context passes the security check,
      *         false if it fails or a redirection has occured during authentication.
      */
-    public boolean checkSecurityConstraints(String pathInContext, HttpRequest request, HttpResponse response) throws HttpException, IOException {
+    public boolean checkSecurityConstraints(String pathInContext, Request request, Response response) throws HttpException, IOException {
         if (formLoginPath != null) {
             String pathToBeTested = (pathInContext.indexOf('?') > 0 ? pathInContext.substring(0, pathInContext.indexOf('?')) : pathInContext);
 
@@ -182,23 +183,22 @@
         }
 
         try {
-            ServletHttpRequest servletHttpRequest = (ServletHttpRequest) request.getWrapper();
             String transportType;
-            if (request.isConfidential()) {
+            if (request.isSecure()) {
                 transportType = "CONFIDENTIAL";
-            } else if (request.isIntegral()) {
+            } else if (request.getConnection().isIntegral(request)) {
                 transportType = "INTEGRAL";
             } else {
                 transportType = "NONE";
             }
-            WebUserDataPermission wudp = new WebUserDataPermission(servletHttpRequest.getServletPath(), new String[]{servletHttpRequest.getMethod()}, transportType);
-            WebResourcePermission webResourcePermission = new WebResourcePermission(servletHttpRequest);
+            WebUserDataPermission wudp = new WebUserDataPermission(request.getServletPath(), new String[]{request.getMethod()}, transportType);
+            WebResourcePermission webResourcePermission = new WebResourcePermission(request);
             Principal user = obtainUser(pathInContext, request, response, webResourcePermission, wudp);
 
             if (user == null) {
                 return false;
             }
-            if (user == SecurityConstraint.__NOBODY) {
+            if (user == SecurityHandler.__NOBODY) {
                 return true;
             }
 
@@ -215,10 +215,10 @@
              */
             acc.checkPermission(webResourcePermission);
         } catch (HttpException he) {
-            response.sendError(he.getCode(), he.getReason());
+            response.sendError(he.getStatus(), he.getReason());
             return false;
         } catch (AccessControlException ace) {
-            response.sendError(HttpResponse.__403_Forbidden);
+            response.sendError(403);
             return false;
         }
         return true;
@@ -240,7 +240,7 @@
      *         security checking should not proceed and servlet handling should proceed,
      *         e.g. login page.
      */
-    private Principal obtainUser(String pathInContext, HttpRequest request, HttpResponse response, WebResourcePermission resourcePermission, WebUserDataPermission dataPermission) throws IOException {
+    private Principal obtainUser(String pathInContext, Request request, Response response, WebResourcePermission resourcePermission, WebUserDataPermission dataPermission) throws IOException {
         boolean unauthenticated = !(checked.implies(resourcePermission) || checked.implies(dataPermission));
         boolean forbidden = excludedPermissions.implies(resourcePermission) || excludedPermissions.implies(dataPermission);
 

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/ThreadClassloaderBeforeAfter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/ThreadClassloaderBeforeAfter.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/ThreadClassloaderBeforeAfter.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/ThreadClassloaderBeforeAfter.java Tue Jun 27 01:13:10 2006
@@ -16,8 +16,8 @@
  */
 package org.apache.geronimo.jetty.interceptor;
 
-import org.mortbay.http.HttpRequest;
-import org.mortbay.http.HttpResponse;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Response;
 
 
 /**
@@ -37,7 +37,7 @@
         this.classLoader = classLoader;
     }
 
-    public void before(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse) {
+    public void before(Object[] context, Request httpRequest, Response httpResponse) {
         Thread thread = Thread.currentThread();
         context[threadIndex] = thread;
         context[classLoaderIndex] = thread.getContextClassLoader();
@@ -47,7 +47,7 @@
         }
     }
 
-    public void after(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse) {
+    public void after(Object[] context, Request httpRequest, Response httpResponse) {
         if (next != null) {
             next.after(context, httpRequest, httpResponse);
         }

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/TransactionContextBeforeAfter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/TransactionContextBeforeAfter.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/TransactionContextBeforeAfter.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/TransactionContextBeforeAfter.java Tue Jun 27 01:13:10 2006
@@ -23,8 +23,8 @@
 
 import org.apache.geronimo.transaction.context.TransactionContext;
 import org.apache.geronimo.transaction.context.TransactionContextManager;
-import org.mortbay.http.HttpRequest;
-import org.mortbay.http.HttpResponse;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Response;
 
 /**
  * @version $Rev$ $Date$
@@ -43,7 +43,7 @@
         this.transactionContextManager = transactionContextManager;
     }
 
-    public void before(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse) {
+    public void before(Object[] context, Request httpRequest, Response httpResponse) {
         TransactionContext oldTransactionContext = transactionContextManager.getContext();
         TransactionContext newTransactionContext = null;
         if (oldTransactionContext == null || !oldTransactionContext.isInheritable()) {
@@ -57,7 +57,7 @@
         }
     }
 
-    public void after(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse) {
+    public void after(Object[] context, Request httpRequest, Response httpResponse) {
         try {
             if (next != null) {
                 next.after(context, httpRequest, httpResponse);

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/WebApplicationContextBeforeAfter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/WebApplicationContextBeforeAfter.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/WebApplicationContextBeforeAfter.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/WebApplicationContextBeforeAfter.java Tue Jun 27 01:13:10 2006
@@ -16,9 +16,8 @@
  */
 package org.apache.geronimo.jetty.interceptor;
 
-import org.mortbay.http.HttpRequest;
-import org.mortbay.http.HttpResponse;
-import org.mortbay.http.HttpContext;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Response;
 import org.apache.geronimo.jetty.JettyWebAppContext;
 
 /**
@@ -36,22 +35,24 @@
         this.webAppContext = webAppContext;
     }
 
-    public void before(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse) {
-        if (httpResponse != null) {
+    public void before(Object[] context, Request httpRequest, Response httpResponse) {
+        //TODO - I think this interceptor is no longer necessary
+/*        if (httpResponse != null) {
             context[index] = httpResponse.getHttpContext();
             httpResponse.setHttpContext(webAppContext);
-        }
+        }*/
         if (next != null) {
             next.before(context, httpRequest, httpResponse);
         }
     }
 
-    public void after(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse) {
+    public void after(Object[] context, Request httpRequest, Response httpResponse) {
         if (next != null) {
             next.after(context, httpRequest, httpResponse);
         }
-        if (httpResponse != null) {
+        //TODO - not necessary?
+/*        if (httpResponse != null) {
             httpResponse.setHttpContext((HttpContext) context[index]);
-        }
+        }*/
     }
 }

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/NCSARequestLog.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/NCSARequestLog.java?rev=417369&r1=417368&r2=417369&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/NCSARequestLog.java (original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/requestlog/NCSARequestLog.java Tue Jun 27 01:13:10 2006
@@ -22,6 +22,7 @@
 import org.apache.geronimo.jetty.JettyContainer;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.mortbay.jetty.RequestLog;
 
 /**
  * @version $Rev$ $Date$
@@ -29,14 +30,14 @@
 public class NCSARequestLog implements GBeanLifecycle, JettyRequestLog {
     private final JettyContainer container;
     private final ServerInfo serverInfo;
-    private final org.mortbay.http.NCSARequestLog requestLog;
+    private final RequestLog requestLog;
     private boolean preferProxiedForAddress;
     private String filename;
 
     public NCSARequestLog(JettyContainer container, ServerInfo serverInfo) {
         this.container = container;
         this.serverInfo = serverInfo;
-        requestLog = new org.mortbay.http.NCSARequestLog();
+        requestLog = new org.mortbay.jetty.NCSARequestLog();
     }
 
     public void setFilename(String filename) {
@@ -48,56 +49,56 @@
     }
 
     public void setLogDateFormat(String format) {
-        requestLog.setLogDateFormat(format);
+        ((org.mortbay.jetty.NCSARequestLog)requestLog).setLogDateFormat(format);
     }
 
     public String getLogDateFormat() {
-        return requestLog.getLogDateFormat();
+        return ((org.mortbay.jetty.NCSARequestLog)requestLog).getLogDateFormat();
     }
 
     public void setLogTimeZone(String tz) {
-        requestLog.setLogTimeZone(tz);
+        ((org.mortbay.jetty.NCSARequestLog)requestLog).setLogTimeZone(tz);
     }
 
     public String getLogTimeZone() {
-        return requestLog.getLogTimeZone();
+        return ((org.mortbay.jetty.NCSARequestLog)requestLog).getLogTimeZone();
     }
 
     public int getRetainDays() {
-        return requestLog.getRetainDays();
+        return ((org.mortbay.jetty.NCSARequestLog)requestLog).getRetainDays();
     }
 
     public void setRetainDays(int retainDays) {
-        requestLog.setRetainDays(retainDays);
+        ((org.mortbay.jetty.NCSARequestLog)requestLog).setRetainDays(retainDays);
     }
 
     public boolean isExtended() {
-        return requestLog.isExtended();
+        return ((org.mortbay.jetty.NCSARequestLog)requestLog).isExtended();
     }
 
     public void setExtended(boolean e) {
-        requestLog.setExtended(e);
+        ((org.mortbay.jetty.NCSARequestLog)requestLog).setExtended(e);
     }
 
     public boolean isAppend() {
-        return requestLog.isAppend();
+        return ((org.mortbay.jetty.NCSARequestLog)requestLog).isAppend();
     }
 
     public void setAppend(boolean a) {
-        requestLog.setAppend(a);
+        ((org.mortbay.jetty.NCSARequestLog)requestLog).setAppend(a);
     }
 
     public void setIgnorePaths(String[] ignorePaths) {
-        requestLog.setIgnorePaths(ignorePaths);
+        ((org.mortbay.jetty.NCSARequestLog)requestLog).setIgnorePaths(ignorePaths);
     }
 
     public String[] getIgnorePaths() {
-        return requestLog.getIgnorePaths();
+        return ((org.mortbay.jetty.NCSARequestLog)requestLog).getIgnorePaths();
     }
 
     public void setPreferProxiedForAddress(boolean value) {
         this.preferProxiedForAddress = value;
-        requestLog.setPreferProxiedForAddress(value);
+        ((org.mortbay.jetty.NCSARequestLog)requestLog).setPreferProxiedForAddress(value);
     }
 
     public boolean isPreferProxiedForAddress() {
@@ -105,23 +106,20 @@
     }
 
     public String getAbsoluteFilePath() {
-        return requestLog == null ? null : requestLog.getDatedFilename();
+        return requestLog == null ? null : ((org.mortbay.jetty.NCSARequestLog)requestLog).getDatedFilename();
     }
 
     public void doStart() throws Exception {
-        requestLog.setFilename(serverInfo.resolveServerPath(filename));
+        ((org.mortbay.jetty.NCSARequestLog)requestLog).setFilename(serverInfo.resolveServerPath(filename));
         container.setRequestLog(requestLog);
-        requestLog.start();
     }
 
     public void doStop() throws Exception {
-        requestLog.stop();
         container.setRequestLog(null);
     }
 
     public void doFail() {
         container.setRequestLog(null);
-        requestLog.stop();
     }
 
     public static final GBeanInfo GBEAN_INFO;



Mime
View raw message