geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r882333 [7/11] - in /geronimo/server/trunk/plugins: ./ jetty7/ jetty8/ jetty8/geronimo-jetty7-builder/ jetty8/geronimo-jetty7-clustering-builder-wadi/ jetty8/geronimo-jetty7-clustering-wadi/ jetty8/geronimo-jetty7/ jetty8/geronimo-jetty8-bu...
Date Thu, 19 Nov 2009 22:21:55 GMT
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/WebAppContextWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/WebAppContextWrapper.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/WebAppContextWrapper.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/WebAppContextWrapper.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,486 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.jetty8;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EventListener;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.naming.Context;
+import javax.security.auth.Subject;
+import javax.transaction.TransactionManager;
+
+import org.apache.geronimo.connector.outbound.connectiontracking.TrackedConnectionAssociator;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.geronimo.j2ee.RuntimeCustomizer;
+import org.apache.geronimo.j2ee.annotation.Holder;
+import org.apache.geronimo.j2ee.annotation.LifecycleMethod;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.management.impl.InvalidObjectNameException;
+import org.apache.geronimo.jetty8.handler.GeronimoWebAppContext;
+import org.apache.geronimo.jetty8.handler.IntegrationContext;
+import org.apache.geronimo.jetty8.security.SecurityHandlerFactory;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.ObjectNameUtil;
+import org.apache.geronimo.management.J2EEApplication;
+import org.apache.geronimo.management.J2EEServer;
+import org.apache.geronimo.management.geronimo.WebContainer;
+import org.apache.geronimo.management.geronimo.WebModule;
+import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
+import org.apache.geronimo.security.jacc.RunAsSource;
+import org.apache.geronimo.transaction.GeronimoUserTransaction;
+import org.eclipse.jetty.http.MimeTypes;
+import org.eclipse.jetty.security.SecurityHandler;
+import org.eclipse.jetty.server.session.SessionHandler;
+import org.eclipse.jetty.servlet.ErrorPageErrorHandler;
+import org.eclipse.jetty.servlet.ServletHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.servlet.ServletMapping;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Wrapper for a WebApplicationContext that sets up its J2EE environment.
+ *
+ * @version $Rev$ $Date$
+ */
+
+@GBean(name="Jetty WebApplication Context",
+j2eeType=NameFactory.WEB_MODULE)
+public class WebAppContextWrapper implements GBeanLifecycle, JettyServletRegistration, WebModule {
+    private static final Logger log = LoggerFactory.getLogger(WebAppContextWrapper.class);
+
+    private final String originalSpecDD;
+    private final J2EEServer server;
+    private final J2EEApplication application;
+
+    private final ClassLoader webClassLoader;
+    private final JettyContainer jettyContainer;
+
+    private final URL configurationBaseURL;
+    private String displayName;
+
+    private final String objectName;
+    private final GeronimoWebAppContext webAppContext;
+    private final Context componentContext;
+    private final Holder holder;
+
+    private final Set<String> servletNames = new HashSet<String>();
+
+    public static final String GBEAN_ATTR_SESSION_TIMEOUT = "sessionTimeoutSeconds";
+
+    public static final String GBEAN_REF_SESSION_HANDLER_FACTORY = "SessionHandlerFactory";
+    public static final String GBEAN_REF_PRE_HANDLER_FACTORY = "PreHandlerFactory";
+    private IntegrationContext integrationContext;
+
+
+    public WebAppContextWrapper(@ParamSpecial(type = SpecialAttributeType.objectName) String objectName,
+                              @ParamAttribute(name = "contextPath") String contextPath,
+                              @ParamAttribute(name = "deploymentDescriptor") String originalSpecDD,
+                              @ParamAttribute(name = "componentContext") Map<String, Object> componentContext,
+                              @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader,
+                              @ParamAttribute(name = "configurationBaseUrl") URL configurationBaseUrl,
+                              @ParamAttribute(name = "workDir") String workDir,
+                              @ParamAttribute(name = "unshareableResources") Set<String> unshareableResources,
+                              @ParamAttribute(name = "applicationManagedSecurityResources") Set<String> applicationManagedSecurityResources,
+                              @ParamAttribute(name = "displayName") String displayName,
+                              @ParamAttribute(name = "contextParamMap") Map<String, String> contextParamMap,
+                              @ParamAttribute(name = "listenerClassNames") Collection<String> listenerClassNames,
+                              @ParamAttribute(name = "distributable") boolean distributable,
+                              @ParamAttribute(name = "mimeMap") Map mimeMap,
+                              @ParamAttribute(name = "welcomeFiles") String[] welcomeFiles,
+                              @ParamAttribute(name = "localeEncodingMapping") Map<String, String> localeEncodingMapping,
+                              @ParamAttribute(name = "errorPages") Map errorPages,
+                              @ParamAttribute(name = "tagLibMap") Map<String, String> tagLibMap,
+                              @ParamAttribute(name = "compactPath") boolean compactPath,
+
+                              @ParamAttribute(name = GBEAN_ATTR_SESSION_TIMEOUT) int sessionTimeoutSeconds,
+                              @ParamReference(name = GBEAN_REF_SESSION_HANDLER_FACTORY) SessionHandlerFactory handlerFactory,
+                              @ParamReference(name = GBEAN_REF_PRE_HANDLER_FACTORY) PreHandlerFactory preHandlerFactory,
+
+                              @ParamAttribute(name = "policyContextID") String policyContextID,
+                              @ParamReference(name = "SecurityHandlerFactory") SecurityHandlerFactory securityHandlerFactory,
+                              @ParamReference(name = "RunAsSource") RunAsSource runAsSource,
+
+                              @ParamAttribute(name = "holder") Holder holder,
+
+                              @ParamReference(name = "Host") Host host,
+                              @ParamReference(name = "TransactionManager") TransactionManager transactionManager,
+                              @ParamReference(name = "TrackedConnectionAssociator") TrackedConnectionAssociator trackedConnectionAssociator,
+                              @ParamReference(name = "JettyContainer") JettyContainer jettyContainer,
+                              @ParamReference(name = "ContextCustomizer") RuntimeCustomizer contextCustomizer,
+
+                              @ParamReference(name = "J2EEServer") J2EEServer server,
+                              @ParamReference(name = "J2EEApplication") J2EEApplication application,
+                              @ParamSpecial(type = SpecialAttributeType.kernel) Kernel kernel) throws Exception {
+
+        assert componentContext != null;
+        assert classLoader != null;
+        assert configurationBaseUrl != null;
+        assert transactionManager != null;
+        assert trackedConnectionAssociator != null;
+        assert jettyContainer != null;
+        if (contextPath == null || !contextPath.startsWith("/")) {
+            throw new IllegalArgumentException("context contextPath must be non-null and start with '/', not " + contextPath);
+        }
+
+        this.holder = holder == null ? Holder.EMPTY : holder;
+
+        RunAsSource runAsSource1 = runAsSource == null ? RunAsSource.NULL : runAsSource;
+
+        SessionHandler sessionHandler;
+        if (null != handlerFactory) {
+            if (null == preHandlerFactory) {
+                throw new IllegalStateException("A preHandlerFactory must be set if an handler factory is set.");
+            }
+            PreHandler preHandler = preHandlerFactory.createHandler();
+            sessionHandler = handlerFactory.createHandler(preHandler);
+        } else {
+            sessionHandler = new SessionHandler();
+        }
+        SecurityHandler securityHandler = null;
+//        if (securityRealmName != null) {
+//            InternalJAASJettyRealm internalJAASJettyRealm = jettyContainer.addRealm(securityRealmName);
+            //wrap jetty realm with something that knows the dumb realmName
+//            JAASJettyRealm realm = new JAASJettyRealm(realmName, internalJAASJettyRealm);
+        if (securityHandlerFactory != null) {
+            Subject defaultSubject =  runAsSource1.getDefaultSubject();
+            securityHandler = securityHandlerFactory.buildSecurityHandler(policyContextID, defaultSubject, runAsSource, true);
+        } else {
+            //TODO may need to turn off security with Context._options.
+//            securityHandler = new NoSecurityHandler();
+        }
+
+        ServletHandler servletHandler = new ServletHandler();
+
+        //wrap the web app context with the jndi handler
+        GeronimoUserTransaction userTransaction = new GeronimoUserTransaction(transactionManager);
+        this.componentContext = EnterpriseNamingContext.createEnterpriseNamingContext(componentContext, userTransaction, kernel, classLoader);
+        integrationContext = new IntegrationContext(this.componentContext, unshareableResources, applicationManagedSecurityResources, trackedConnectionAssociator, userTransaction);
+        webAppContext = new GeronimoWebAppContext(securityHandler, sessionHandler, servletHandler, null, integrationContext, classLoader);
+        webAppContext.setContextPath(contextPath);
+        //See Jetty-386.  Setting this to true can expose secured content.
+        webAppContext.setCompactPath(compactPath);
+
+        if (workDir == null) {
+            workDir = contextPath.replace('/', '_');
+        }
+        webAppContext.setTempDirectory(jettyContainer.resolveToJettyHome(workDir));
+
+
+        //install jasper injection support if required
+        if (contextCustomizer != null) {
+            Map<String, Object> servletContext = new HashMap<String, Object>();
+            Map<Class, Object> customizerContext = new HashMap<Class, Object>();
+            customizerContext.put(Map.class, servletContext);
+            customizerContext.put(Context.class, WebAppContextWrapper.this.componentContext);
+            contextCustomizer.customize(customizerContext);
+            for (Map.Entry<String, Object> entry: servletContext.entrySet()) {
+                webAppContext.setAttribute(entry.getKey(), entry.getValue());
+            }
+        }
+
+        MimeTypes mimeTypes = new MimeTypes();
+        mimeTypes.setMimeMap(mimeMap);
+        webAppContext.setMimeTypes(mimeTypes);
+
+        this.server = server;
+        this.application = application;
+        this.objectName = objectName;
+        if (objectName != null) {
+            ObjectName myObjectName = ObjectNameUtil.getObjectName(objectName);
+            verifyObjectName(myObjectName);
+        }
+        this.configurationBaseURL = configurationBaseUrl;
+        this.jettyContainer = jettyContainer;
+        this.originalSpecDD = originalSpecDD;
+
+        //DONT install the jetty TLD configuration as we find and create all the listeners ourselves
+        webAppContext.setConfigurationClasses(new String[]{});
+
+        String webAppRoot = configurationBaseUrl.toString();
+        webAppContext.setResourceBase(webAppRoot);
+        webAppContext.setWar(webAppRoot);
+        webClassLoader = classLoader;
+        webAppContext.setClassLoader(webClassLoader);
+
+        if (host != null) {
+            webAppContext.setConnectorNames(host.getHosts());
+            webAppContext.setVirtualHosts(host.getVirtualHosts());
+        }
+
+        //stuff from spec dd
+        setDisplayName(displayName);
+        webAppContext.setInitParams(contextParamMap);
+        setListenerClassNames(listenerClassNames);
+        webAppContext.setDistributable(distributable);
+        webAppContext.setWelcomeFiles(welcomeFiles);
+        setLocaleEncodingMapping(localeEncodingMapping);
+        setErrorPages(errorPages);
+        setTagLibMap(tagLibMap);
+
+        if (!distributable) {
+            setSessionTimeoutSeconds(sessionTimeoutSeconds);
+        }
+
+    }
+
+
+    public String getObjectName() {
+        return objectName;
+    }
+
+    public boolean isStateManageable() {
+        return true;
+    }
+
+    public boolean isStatisticsProvider() {
+        return false;
+    }
+
+    public boolean isEventProvider() {
+        return true;
+    }
+
+    public URL getWARDirectory() {
+        return configurationBaseURL;
+    }
+
+    public String getWARName() {
+        //todo: make this return something more consistent
+        try {
+            return ObjectName.getInstance(objectName).getKeyProperty(NameFactory.J2EE_NAME);
+        } catch (MalformedObjectNameException e) {
+            return null;
+        }
+    }
+
+    public WebContainer getContainer() {
+        return jettyContainer;
+    }
+
+    public String getContextPath() {
+        return this.webAppContext.getContextPath();
+    }
+
+    public ClassLoader getWebClassLoader() {
+        return webClassLoader;
+    }
+
+    public IntegrationContext getIntegrationContext() {
+        return integrationContext;
+    }
+
+    public Object newInstance(String className) throws InstantiationException, IllegalAccessException {
+        if (className == null) {
+            throw new InstantiationException("no class loaded");
+        }
+        return holder.newInstance(className, webClassLoader, componentContext);
+    }
+
+    public void destroyInstance(Object o) throws Exception {
+        Class clazz = o.getClass();
+        if (holder != null) {
+            Map<String, LifecycleMethod> preDestroy = holder.getPreDestroy();
+            if (preDestroy != null) {
+                Holder.apply(o, clazz, preDestroy);
+            }
+        }
+    }
+
+    public void doStart() throws Exception {
+        // reset the classsloader... jetty likes to set it to null when stopping
+        this.webAppContext.setClassLoader(webClassLoader);
+        jettyContainer.addContext(webAppContext);
+        webAppContext.start();
+    }
+
+    public void doStop() throws Exception {
+        webAppContext.stop();
+        jettyContainer.removeContext(webAppContext);
+        log.debug("WebAppContextWrapper stopped");
+    }
+
+    public void doFail() {
+        try {
+            doStop();
+        } catch (Exception e) {
+            //ignore
+        }
+
+        log.warn("WebAppContextWrapper failed");
+    }
+    //pass through attributes.  They should be constructor params
+
+    public void setLocaleEncodingMapping(@ParamAttribute(name = "localeEncodingMapping")Map<String, String> localeEncodingMap) {
+        if (localeEncodingMap != null) {
+            for (Map.Entry<String, String> entry : localeEncodingMap.entrySet()) {
+                this.webAppContext.addLocaleEncoding(entry.getKey(), entry.getValue());
+            }
+        }
+    }
+
+    public void setListenerClassNames(@ParamAttribute(name = "listenerClassNames")Collection<String> eventListeners) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
+        if (eventListeners != null) {
+            Collection<EventListener> listeners = new ArrayList<EventListener>();
+            for (String listenerClassName : eventListeners) {
+                EventListener listener = (EventListener) newInstance(listenerClassName);
+                listeners.add(listener);
+            }
+            webAppContext.setEventListeners(listeners.toArray(new EventListener[listeners.size()]));
+        }
+    }
+
+    public void setErrorPages(@ParamAttribute(name = "errorPages")Map errorPageMap) {
+        if (errorPageMap != null) {
+            ((ErrorPageErrorHandler) this.webAppContext.getErrorHandler()).setErrorPages(errorPageMap);
+        }
+    }
+
+    public void setTagLibMap(@ParamAttribute(name = "tagLibMap")Map<String, String> tagLibMap) {
+        if (tagLibMap != null) {
+            for (Map.Entry<String, String> entry : tagLibMap.entrySet()) {
+                this.webAppContext.setResourceAlias(entry.getKey(), entry.getValue());
+            }
+        }
+    }
+
+    public void setSessionTimeoutSeconds(@ParamAttribute(name = "sessionTimeoutSeconds")int seconds) {
+        this.webAppContext.getSessionHandler().getSessionManager().setMaxInactiveInterval(seconds);
+    }
+
+
+    //TODO this is really dumb, but jetty5 liked to set the displayname to null frequently.
+    //we need to re-check for jetty8
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;
+        this.webAppContext.setDisplayName(displayName);
+    }
+
+    public String getDeploymentDescriptor() {
+        return originalSpecDD;
+    }
+
+    public String getServer() {
+        return server.getObjectName();
+    }
+
+    public String getApplication() {
+        if (application == null) {
+            return null;
+        }
+        return application.getObjectName();
+    }
+
+    public String[] getJavaVMs() {
+        return server.getJavaVMs();
+    }
+
+    public String[] getServlets() {
+        synchronized (servletNames) {
+            return servletNames.toArray(new String[servletNames.size()]);
+        }
+    }
+
+    public ServletHandler getServletHandler() {
+        return this.webAppContext.getServletHandler();
+    }
+
+    /**
+     * ObjectName must match this pattern:
+     * <p/>
+     * domain:j2eeType=WebModule,name=MyName,J2EEServer=MyServer,J2EEApplication=MyApplication
+     *
+     * @param objectName ObjectName to verify
+     */
+    private void verifyObjectName(ObjectName objectName) {
+        if (objectName.isPattern()) {
+            throw new InvalidObjectNameException("ObjectName can not be a pattern", objectName);
+        }
+        Hashtable keyPropertyList = objectName.getKeyPropertyList();
+        if (!NameFactory.WEB_MODULE.equals(keyPropertyList.get("j2eeType"))) {
+            throw new InvalidObjectNameException("WebModule object name j2eeType property must be 'WebModule'", objectName);
+        }
+        if (!keyPropertyList.containsKey(NameFactory.J2EE_NAME)) {
+            throw new InvalidObjectNameException("WebModule object must contain a name property", objectName);
+        }
+        if (!keyPropertyList.containsKey(NameFactory.J2EE_SERVER)) {
+            throw new InvalidObjectNameException("WebModule object name must contain a J2EEServer property", objectName);
+        }
+        if (!keyPropertyList.containsKey(NameFactory.J2EE_APPLICATION)) {
+            throw new InvalidObjectNameException("WebModule object name must contain a J2EEApplication property", objectName);
+        }
+        if (keyPropertyList.size() != 4) {
+            throw new InvalidObjectNameException("WebModule object name can only have j2eeType, name, J2EEApplication, and J2EEServer properties", objectName);
+        }
+    }
+
+    public void registerServletHolder(ServletHolder servletHolder, String servletName, Set<String> servletMappings, String objectName) throws Exception {
+        webAppContext.getServletHandler().addServlet(servletHolder);
+        if (servletMappings != null) {
+            for (String urlPattern : servletMappings) {
+                ServletMapping servletMapping = new ServletMapping();
+                servletMapping.setPathSpec(urlPattern);
+                servletMapping.setServletName(servletName);
+                this.webAppContext.getServletHandler().addServletMapping(servletMapping);
+            }
+        }
+        if (objectName != null) {
+            synchronized (servletNames) {
+                servletNames.add(objectName);
+            }
+        }
+    }
+
+    public void unregisterServletHolder(ServletHolder servletHolder, String servletName, Set<String> servletMappings, String objectName) throws Exception {
+        //no way to remove servlets
+//        webAppContext.getServletHandler().removeServlet(servletHolder);
+//        if (servletMappings != null) {
+//            for (Iterator iterator = servletMappings.iterator(); iterator.hasNext();) {
+//                String urlPattern = (String) iterator.next();
+//                ServletMapping servletMapping = new ServletMapping();
+//                servletMapping.setPathSpec(urlPattern);
+//                servletMapping.setServletName(servletName);
+//                webAppContext.getServletHandler().removeServletMapping(servletMapping);
+//            }
+//        }
+        if (objectName != null) {
+            synchronized (servletNames) {
+                servletNames.remove(objectName);
+            }
+        }
+    }
+
+}

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/WebAppContextWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/WebAppContextWrapper.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/WebAppContextWrapper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/AJP13Connector.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/AJP13Connector.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/AJP13Connector.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/AJP13Connector.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,62 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.jetty8.connector;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.jetty8.JettyContainer;
+import org.apache.geronimo.management.geronimo.WebManager;
+import org.apache.geronimo.system.threads.ThreadPool;
+import org.eclipse.jetty.ajp.Ajp13SocketConnector;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AJP13Connector extends JettyConnector {
+    public AJP13Connector(JettyContainer container, ThreadPool threadPool) {
+        super(container, new Ajp13SocketConnector(), threadPool, "AJP13Connector");
+    }
+
+    public String getProtocol() {
+        return WebManager.PROTOCOL_AJP;
+    }
+
+    public int getDefaultPort() {
+        return -1;
+    }
+
+    public void setRedirectPort(int port) {
+        Ajp13SocketConnector ajpListener = (Ajp13SocketConnector) listener;
+        ajpListener.setConfidentialPort(port);
+        ajpListener.setIntegralPort(port);
+        ajpListener.setIntegralScheme("https");
+        ajpListener.setConfidentialScheme("https");
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Jetty Connector AJP13", AJP13Connector.class, JettyConnector.GBEAN_INFO);
+        infoFactory.setConstructor(new String[]{"JettyContainer", "ThreadPool"});
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/AJP13Connector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/AJP13Connector.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/AJP13Connector.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/GeronimoSelectChannelSSLListener.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/GeronimoSelectChannelSSLListener.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/GeronimoSelectChannelSSLListener.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/GeronimoSelectChannelSSLListener.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.jetty8.connector;
+
+import javax.net.ssl.SSLContext;
+
+import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
+import org.eclipse.jetty.server.ssl.SslSocketConnector;
+import org.apache.geronimo.management.geronimo.KeystoreManager;
+
+/**
+ * SSL listener that hooks into the Geronimo keystore infrastructure.
+ *
+ * @version $Rev$ $Date$
+ */
+public class GeronimoSelectChannelSSLListener extends SslSelectChannelConnector {
+    private KeystoreManager manager;
+    private String keyStore;
+    private String trustStore;
+    private String keyAlias;
+
+    public GeronimoSelectChannelSSLListener(KeystoreManager manager) {
+        this.manager = manager;
+    }
+
+    protected SSLContext createSSLContext() throws Exception {
+        return manager.createSSLContext(null, getProtocol(), getSslKeyManagerFactoryAlgorithm(), keyStore, keyAlias, trustStore, SslSocketConnector.class.getClassLoader());
+    }
+
+    public String getKeyStore() {
+        return keyStore;
+    }
+
+    public void setKeyStore(String keyStore) {
+        this.keyStore = keyStore;
+    }
+
+    public String getTrustStore() {
+        return trustStore;
+    }
+
+    public void setTrustStore(String trustStore) {
+        this.trustStore = trustStore;
+    }
+
+    public String getKeyAlias() {
+        return keyAlias;
+    }
+
+    public void setKeyAlias(String keyAlias) {
+        this.keyAlias = keyAlias;
+    }
+}

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/GeronimoSelectChannelSSLListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/GeronimoSelectChannelSSLListener.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/GeronimoSelectChannelSSLListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/GeronimoSocketSSLListener.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/GeronimoSocketSSLListener.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/GeronimoSocketSSLListener.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/GeronimoSocketSSLListener.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,67 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.jetty8.connector;
+
+import org.eclipse.jetty.server.ssl.SslSocketConnector;
+import org.apache.geronimo.management.geronimo.KeystoreManager;
+
+import javax.net.ssl.SSLServerSocketFactory;
+
+/**
+ * SSL listener that hooks into the Geronimo keystore infrastructure.
+ *
+ * @version $Rev$ $Date$
+ */
+public class GeronimoSocketSSLListener extends SslSocketConnector {
+    private KeystoreManager manager;
+    private String keyStore;
+    private String trustStore;
+    private String keyAlias;
+
+    public GeronimoSocketSSLListener(KeystoreManager manager) {
+        this.manager = manager;
+    }
+
+    protected SSLServerSocketFactory createFactory() throws Exception {
+        // we need the server factory version.
+        return manager.createSSLServerFactory(null, getProtocol(), getSslKeyManagerFactoryAlgorithm(), keyStore, keyAlias, trustStore, SslSocketConnector.class.getClassLoader());
+    }
+
+    public String getKeyStore() {
+        return keyStore;
+    }
+
+    public void setKeyStore(String keyStore) {
+        this.keyStore = keyStore;
+    }
+
+    public String getTrustStore() {
+        return trustStore;
+    }
+
+    public void setTrustStore(String trustStore) {
+        this.trustStore = trustStore;
+    }
+
+    public String getKeyAlias() {
+        return keyAlias;
+    }
+
+    public void setKeyAlias(String keyAlias) {
+        this.keyAlias = keyAlias;
+    }
+}

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/GeronimoSocketSSLListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/GeronimoSocketSSLListener.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/GeronimoSocketSSLListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPBlockingConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPBlockingConnector.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPBlockingConnector.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPBlockingConnector.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.jetty8.connector;
+
+import org.apache.geronimo.jetty8.JettyContainer;
+import org.apache.geronimo.management.geronimo.WebManager;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.system.threads.ThreadPool;
+import org.eclipse.jetty.server.nio.BlockingChannelConnector;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HTTPBlockingConnector extends JettyConnector {
+    public HTTPBlockingConnector(JettyContainer container, ThreadPool threadPool) {
+        super(container, new BlockingChannelConnector(), threadPool, "HTTPBlockingConnector");
+    }
+
+    public String getProtocol() {
+        return WebManager.PROTOCOL_HTTP;
+    }
+
+    public int getDefaultPort() {
+        return 80;
+    }
+
+    public void setRedirectPort(int port) {
+        BlockingChannelConnector connector = (BlockingChannelConnector) listener;
+        connector.setConfidentialPort(port);
+        connector.setIntegralPort(port);
+        connector.setIntegralScheme("https");
+        connector.setConfidentialScheme("https");
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Jetty Blocking Channel Connector HTTP", HTTPBlockingConnector.class, JettyConnector.GBEAN_INFO);
+        infoFactory.setConstructor(new String[]{"JettyContainer", "ThreadPool"});
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPBlockingConnector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPBlockingConnector.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPBlockingConnector.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSSelectChannelConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSSelectChannelConnector.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSSelectChannelConnector.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSSelectChannelConnector.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.jetty8.connector;
+
+import javax.net.ssl.KeyManagerFactory;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.jetty8.JettyContainer;
+import org.apache.geronimo.jetty8.JettySecureConnector;
+import org.apache.geronimo.management.geronimo.KeystoreManager;
+import org.apache.geronimo.management.geronimo.WebManager;
+import org.apache.geronimo.system.threads.ThreadPool;
+import org.eclipse.jetty.server.nio.SelectChannelConnector;
+
+/**
+ * Implementation of a HTTPS connector based on Jetty's SslConnector (which uses pure JSSE).
+ *
+ * @version $Rev$ $Date$
+ */
+public class HTTPSSelectChannelConnector extends JettyConnector implements JettySecureConnector {
+    private final GeronimoSelectChannelSSLListener https;
+    private String algorithm;
+
+    public HTTPSSelectChannelConnector(JettyContainer container, ThreadPool threadPool, KeystoreManager keystoreManager) {
+        super(container, new GeronimoSelectChannelSSLListener(keystoreManager), threadPool, "HTTPSSelectChannelConnector");
+        https = (GeronimoSelectChannelSSLListener) listener;
+    }
+
+    public int getDefaultPort() {
+        return 443;
+    }
+
+    public String getProtocol() {
+        return WebManager.PROTOCOL_HTTPS;
+    }
+
+    public String getAlgorithm() {
+        return algorithm;
+    }
+
+    /**
+     * Algorithm to use.
+     * As different JVMs have different implementations available, the default algorithm can be used by supplying the value "Default".
+     *
+     * @param algorithm the algorithm to use, or "Default" to use the default from {@link javax.net.ssl.KeyManagerFactory#getDefaultAlgorithm()}
+     */
+    public void setAlgorithm(String algorithm) {
+        // cache the value so the null
+        this.algorithm = algorithm;
+        if ("default".equalsIgnoreCase(algorithm)) {
+            algorithm = KeyManagerFactory.getDefaultAlgorithm();
+        }
+        https.setSslKeyManagerFactoryAlgorithm(algorithm);
+    }
+
+    public String getSecureProtocol() {
+        return https.getProtocol();
+    }
+
+    public void setSecureProtocol(String protocol) {
+        https.setProtocol(protocol);
+    }
+
+    public void setClientAuthRequired(boolean needClientAuth) {
+        https.setNeedClientAuth(needClientAuth);
+    }
+
+    public boolean isClientAuthRequired() {
+        return https.getNeedClientAuth();
+    }
+
+    public void setClientAuthRequested(boolean wantClientAuth) {
+        https.setWantClientAuth(wantClientAuth);
+    }
+
+    public boolean isClientAuthRequested() {
+        return https.getWantClientAuth();
+    }
+
+    public void setKeyStore(String keyStore) {
+        https.setKeyStore(keyStore);
+    }
+
+    public String getKeyStore() {
+        return https.getKeyStore();
+    }
+
+    public void setTrustStore(String trustStore) {
+        https.setTrustStore(trustStore);
+    }
+
+    public String getTrustStore() {
+        return https.getTrustStore();
+    }
+
+    public void setKeyAlias(String keyAlias) {
+        https.setKeyAlias(keyAlias);
+    }
+
+    public String getKeyAlias() {
+        return https.getKeyAlias();
+    }
+
+    //TODO does this make sense???
+    public void setRedirectPort(int port) {
+        SelectChannelConnector socketListener = (SelectChannelConnector) listener;
+        socketListener.setConfidentialPort(port);
+        socketListener.setIntegralPort(port);
+        socketListener.setIntegralScheme("https");
+        socketListener.setConfidentialScheme("https");
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Jetty SelectChannel Connector HTTPS", HTTPSSelectChannelConnector.class, JettyConnector.GBEAN_INFO);
+        infoFactory.addAttribute("algorithm", String.class, true, true);
+        infoFactory.addAttribute("secureProtocol", String.class, true, true);
+        infoFactory.addAttribute("keyStore", String.class, true, true);
+        infoFactory.addAttribute("keyAlias", String.class, true, true);
+        infoFactory.addAttribute("trustStore", String.class, true, true);
+        infoFactory.addAttribute("clientAuthRequired", boolean.class, true, true);
+        infoFactory.addAttribute("clientAuthRequested", boolean.class, true, true);
+        infoFactory.addReference("KeystoreManager", KeystoreManager.class, GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
+        infoFactory.addInterface(JettySecureConnector.class);
+        infoFactory.setConstructor(new String[]{"JettyContainer", "ThreadPool", "KeystoreManager"});
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+    // ================= NO LONGER USED!!! =====================
+    // todo: remove these from the SSL interface
+
+    public String getKeystoreFileName() {
+        return null;
+    }
+
+    public void setKeystoreFileName(String name) {
+    }
+
+    public void setKeystorePassword(String password) {
+    }
+
+    public String getKeystoreType() {
+        return null;
+    }
+
+    public void setKeystoreType(String type) {
+    }
+}

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSSelectChannelConnector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSSelectChannelConnector.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSSelectChannelConnector.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSSocketConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSSocketConnector.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSSocketConnector.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSSocketConnector.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,169 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.jetty8.connector;
+
+import javax.net.ssl.KeyManagerFactory;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.jetty8.JettyContainer;
+import org.apache.geronimo.jetty8.JettySecureConnector;
+import org.apache.geronimo.management.geronimo.KeystoreManager;
+import org.apache.geronimo.management.geronimo.WebManager;
+import org.apache.geronimo.system.threads.ThreadPool;
+import org.eclipse.jetty.server.bio.SocketConnector;
+
+/**
+ * Implementation of a HTTPS connector based on Jetty's SslConnector (which uses pure JSSE).
+ *
+ * @version $Rev$ $Date$
+ */
+public class HTTPSSocketConnector extends JettyConnector implements JettySecureConnector {
+    private final GeronimoSocketSSLListener https;
+    private String algorithm;
+
+    public HTTPSSocketConnector(JettyContainer container, ThreadPool threadPool, KeystoreManager keystoreManager) {
+        super(container, new GeronimoSocketSSLListener(keystoreManager), threadPool, "HTTPSSocketConnector");
+        https = (GeronimoSocketSSLListener) listener;
+    }
+
+    public int getDefaultPort() {
+        return 443;
+    }
+
+    public String getProtocol() {
+        return WebManager.PROTOCOL_HTTPS;
+    }
+
+    public String getAlgorithm() {
+        return algorithm;
+    }
+
+    /**
+     * Algorithm to use.
+     * As different JVMs have different implementations available, the default algorithm can be used by supplying the value "Default".
+     *
+     * @param algorithm the algorithm to use, or "Default" to use the default from {@link javax.net.ssl.KeyManagerFactory#getDefaultAlgorithm()}
+     */
+    public void setAlgorithm(String algorithm) {
+        // cache the value so the null
+        this.algorithm = algorithm;
+        if ("default".equalsIgnoreCase(algorithm)) {
+            algorithm = KeyManagerFactory.getDefaultAlgorithm();
+        }
+        https.setSslKeyManagerFactoryAlgorithm(algorithm);
+    }
+
+    public String getSecureProtocol() {
+        return https.getProtocol();
+    }
+
+    public void setSecureProtocol(String protocol) {
+        https.setProtocol(protocol);
+    }
+
+    public void setClientAuthRequired(boolean needClientAuth) {
+        https.setNeedClientAuth(needClientAuth);
+    }
+
+    public boolean isClientAuthRequired() {
+        return https.getNeedClientAuth();
+    }
+
+    public void setClientAuthRequested(boolean wantClientAuth) {
+        https.setWantClientAuth(wantClientAuth);
+    }
+
+    public boolean isClientAuthRequested() {
+        return https.getWantClientAuth();
+    }
+
+    public void setKeyStore(String keyStore) {
+        https.setKeyStore(keyStore);
+    }
+
+    public String getKeyStore() {
+        return https.getKeyStore();
+    }
+
+    public void setTrustStore(String trustStore) {
+        https.setTrustStore(trustStore);
+    }
+
+    public String getTrustStore() {
+        return https.getTrustStore();
+    }
+
+    public void setKeyAlias(String keyAlias) {
+        https.setKeyAlias(keyAlias);
+    }
+
+    public String getKeyAlias() {
+        return https.getKeyAlias();
+    }
+    
+    //TODO does this make sense???
+    public void setRedirectPort(int port) {
+        SocketConnector socketListener = (SocketConnector) listener;
+        socketListener.setConfidentialPort(port);
+        socketListener.setIntegralPort(port);
+        socketListener.setIntegralScheme("https");
+        socketListener.setConfidentialScheme("https");
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Jetty Connector HTTPS", HTTPSSocketConnector.class, JettyConnector.GBEAN_INFO);
+        infoFactory.addAttribute("algorithm", String.class, true, true);
+        infoFactory.addAttribute("secureProtocol", String.class, true, true);
+        infoFactory.addAttribute("keyStore", String.class, true, true);
+        infoFactory.addAttribute("keyAlias", String.class, true, true);
+        infoFactory.addAttribute("trustStore", String.class, true, true);
+        infoFactory.addAttribute("clientAuthRequired", boolean.class, true, true);
+        infoFactory.addAttribute("clientAuthRequested", boolean.class, true, true);
+        infoFactory.addReference("KeystoreManager", KeystoreManager.class, GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
+        infoFactory.addInterface(JettySecureConnector.class);
+        infoFactory.setConstructor(new String[]{"JettyContainer", "ThreadPool", "KeystoreManager"});
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+    // ================= NO LONGER USED!!! =====================
+    // todo: remove these from the SSL interface
+
+    public String getKeystoreFileName() {
+        return null;
+    }
+
+    public void setKeystoreFileName(String name) {
+    }
+
+    public void setKeystorePassword(String password) {
+    }
+
+    public String getKeystoreType() {
+        return null;
+    }
+
+    public void setKeystoreType(String type) {
+    }
+}

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSSocketConnector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSSocketConnector.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSSocketConnector.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSelectChannelConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSelectChannelConnector.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSelectChannelConnector.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSelectChannelConnector.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.jetty8.connector;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.jetty8.JettyContainer;
+import org.apache.geronimo.management.geronimo.WebManager;
+import org.apache.geronimo.system.threads.ThreadPool;
+import org.eclipse.jetty.server.nio.SelectChannelConnector;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HTTPSelectChannelConnector extends JettyConnector {
+    public HTTPSelectChannelConnector(JettyContainer container, ThreadPool threadPool) {
+        super(container, new SelectChannelConnector(), threadPool, "HTTPSelectChannelConnector");
+    }
+
+    public String getProtocol() {
+        return WebManager.PROTOCOL_HTTP;
+    }
+
+    public int getDefaultPort() {
+        return 80;
+    }
+
+    public void setRedirectPort(int port) {
+        SelectChannelConnector connector = (SelectChannelConnector) listener;
+        connector.setConfidentialPort(port);
+        connector.setIntegralPort(port);
+        connector.setIntegralScheme("https");
+        connector.setConfidentialScheme("https");
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Jetty SelectChannel Connector HTTP", HTTPSelectChannelConnector.class, JettyConnector.GBEAN_INFO);
+        infoFactory.setConstructor(new String[]{"JettyContainer", "ThreadPool"});
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSelectChannelConnector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSelectChannelConnector.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSelectChannelConnector.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSocketConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSocketConnector.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSocketConnector.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSocketConnector.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,62 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.jetty8.connector;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.jetty8.JettyContainer;
+import org.apache.geronimo.management.geronimo.WebManager;
+import org.apache.geronimo.system.threads.ThreadPool;
+import org.eclipse.jetty.server.bio.SocketConnector;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HTTPSocketConnector extends JettyConnector {
+    public HTTPSocketConnector(JettyContainer container, ThreadPool threadPool) {
+        super(container, new SocketConnector(), threadPool, "HTTPSocketConnector");
+    }
+
+    public String getProtocol() {
+        return WebManager.PROTOCOL_HTTP;
+    }
+
+    public int getDefaultPort() {
+        return 80;
+    }
+
+    public void setRedirectPort(int port) {
+        SocketConnector socketListener = (SocketConnector) listener;
+        socketListener.setConfidentialPort(port);
+        socketListener.setIntegralPort(port);
+        socketListener.setIntegralScheme("https");
+        socketListener.setConfidentialScheme("https");
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Jetty BIO Connector HTTP", HTTPSocketConnector.class, JettyConnector.GBEAN_INFO);
+        infoFactory.setConstructor(new String[]{"JettyContainer", "ThreadPool"});
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSocketConnector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSocketConnector.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/HTTPSocketConnector.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/JettyConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/JettyConnector.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/JettyConnector.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/JettyConnector.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,294 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.jetty8.connector;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+
+import javax.management.j2ee.statistics.Stats;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.jetty8.JettyContainer;
+import org.apache.geronimo.jetty8.JettyWebConnector;
+import org.apache.geronimo.management.LazyStatisticsProvider;
+import org.apache.geronimo.management.geronimo.stats.JettyWebConnectorStatsImpl;
+import org.apache.geronimo.system.threads.ThreadPool;
+import org.eclipse.jetty.server.AbstractConnector;
+
+/**
+ * Base class for GBeans for Jetty network connectors (HTTP, HTTPS, AJP, etc.).
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class JettyConnector implements GBeanLifecycle, JettyWebConnector, LazyStatisticsProvider {
+    public final static String CONNECTOR_CONTAINER_REFERENCE = "JettyContainer";
+    private final JettyContainer container;
+    protected final AbstractConnector listener;
+    private JettyWebConnectorStatsImpl stats;           // data structure for jsr77 stats
+    private String connectHost;
+
+    /**
+     * Only used to allow declaration as a reference.
+     */
+    public JettyConnector() {
+        container = null;
+        listener = null;
+    }
+
+    public JettyConnector(JettyContainer container, ThreadPool threadPool) {
+        this.container = container;
+        this.listener = null;
+    }
+
+    public JettyConnector(JettyContainer container, AbstractConnector listener, ThreadPool threadPool, String name) {
+        this.container = container;
+        this.listener = listener;
+        if (threadPool != null) {
+            JettyThreadPool jettyThreadPool = new JettyThreadPool(threadPool, name);
+            listener.setThreadPool(jettyThreadPool);
+        }
+        stats = new JettyWebConnectorStatsImpl();
+    }
+
+    //TODO: support the jetty8 specific methods
+    public String getHost() {
+        return listener.getHost();
+    }
+
+    public void setHost(String host) throws UnknownHostException {
+        // underlying impl treats null as 0.0.0.0
+        listener.setHost(host);
+    }
+
+    public int getPort() {
+        return listener.getPort();
+    }
+
+    public void setPort(int port) {
+        listener.setPort(port);
+    }
+    
+    public int getHeaderBufferSizeBytes() {
+        return listener.getHeaderBufferSize();
+    }
+    public void setHeaderBufferSizeBytes(int size) {
+        listener.setHeaderBufferSize(size);
+    }
+
+    public abstract int getDefaultPort();
+
+    public String getDefaultScheme() {
+        return null;
+    }
+
+    public String getConnectUrl() {
+        if (connectHost == null) {
+            String host = getHost();
+            if (host == null || host.equals("0.0.0.0")) {
+                InetAddress address = null;
+                try {
+                    address = InetAddress.getLocalHost();
+                } catch (UnknownHostException e) {
+                    host = "unknown-host";
+                }
+                if (address != null) {
+                    host = address.getHostName();
+                    if (host == null || host.equals("")) {
+                        host = address.getHostAddress();
+                    }
+                }
+            }
+            connectHost = host;
+        }
+        return getProtocol().toLowerCase() + "://" + connectHost + (getPort() == getDefaultPort() ? "" : ":" + getPort());
+    }
+
+    public int getMaxIdleTimeMs() {
+        return listener.getMaxIdleTime();
+    }
+
+    public void setMaxIdleTimeMs(int idleTime) {
+        listener.setMaxIdleTime(idleTime);
+    }
+
+    public int getBufferSizeBytes() {
+        //TODO return the request buffer size, what about the response and header buffer size?
+        return listener.getRequestBufferSize();
+    }
+
+    public void setBufferSizeBytes(int bytes) {
+        //TODO what about the response and header buffer size?
+        listener.setRequestBufferSize(bytes);
+    }
+
+    public int getAcceptQueueSize() {
+        return listener.getAcceptQueueSize();
+    }
+
+    public void setAcceptQueueSize(int size) {
+        listener.setAcceptQueueSize(size);
+    }
+
+    public int getLingerMillis() {
+        return (int) ((AbstractConnector) listener).getSoLingerTime();
+    }
+
+    public void setLingerMillis(int millis) {
+        listener.setSoLingerTime(millis);
+    }
+
+    public boolean isTcpNoDelay() {
+        return true;
+    }
+
+    public void setTcpNoDelay(boolean enable) {
+        throw new UnsupportedOperationException(listener == null ? "No Listener" : listener.getClass().getName());
+    }
+
+    public void setMaxThreads(int maxThreads) {
+        //TODO: in jetty8 connectors have a number of acceptor threads
+        listener.setAcceptors(maxThreads);
+    }
+
+    public int getMaxThreads() {
+        //TODO: confirm that this is reasonable
+        return 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(), e);
+        }
+    }
+
+    public void setRedirectPort(int port) {
+        throw new UnsupportedOperationException("No redirect port on " + this.getClass().getName());
+    }
+
+    public abstract String getProtocol();
+
+    public void doStart() throws Exception {
+        container.addListener(listener);
+        listener.start();
+    }
+
+    public void doStop() {
+        while (true) {
+            try {
+                listener.stop();
+                container.removeListener(listener);
+                return;
+            } catch (Exception e) {
+                continue;
+            }
+        }
+    }
+
+    public void doFail() {
+        while (true) {
+            try {
+                listener.stop();
+                container.removeListener(listener);
+                return;
+            } catch (Exception e) {
+                continue;
+            }
+        }
+    }
+    
+    public boolean isStatsOn() {
+	return listener.getStatsOn();
+    }
+    
+    public void setStatsOn(boolean on) {
+        listener.setStatsOn(on);
+        if (on) stats.setStartTime();
+    }
+    
+    /**
+     * Gets the statistics collected for this class. 
+     * The first call to this method initializes the startTime for
+     * all statistics. 
+     *
+     * @return gets collected for this class
+     */
+    public Stats getStats() {
+        if(isStatsOn()) {
+            stats.setLastSampleTime();
+            // connections open
+            stats.getOpenConnectionCountImpl().setCurrent(listener.getConnectionsOpen());
+            stats.getOpenConnectionCountImpl().setHighWaterMark(listener.getConnectionsOpenMax());
+            stats.getOpenConnectionCountImpl().setLowWaterMark(listener.getConnectionsOpenMin());
+            // request count
+            stats.getRequestCountImpl().setCount(listener.getRequests());
+            // connections count and durations
+            stats.getConnectionsDurationImpl().setCount(listener.getConnections());
+            stats.getConnectionsDurationImpl().setMaxTime(listener.getConnectionsDurationMax());
+            stats.getConnectionsDurationImpl().setMinTime(listener.getConnectionsDurationMin());
+            stats.getConnectionsDurationImpl().setTotalTime(listener.getConnectionsDurationTotal());
+            // requests per connection (connection requests)
+            stats.getConnectionsRequestImpl().setCurrent(listener.getConnectionsRequestsAve());
+            stats.getConnectionsRequestImpl().setHighWaterMark(listener.getConnectionsRequestsMax());
+            stats.getConnectionsRequestImpl().setLowWaterMark(listener.getConnectionsRequestsMin());
+        }
+        return stats;
+    }
+    
+    /**
+     * Reset the startTime for all statistics
+     */
+    public void resetStats() {
+        listener.statsReset();
+        stats.setStartTime(); // sets atartTime for all stats to Now
+    }
+    
+    public boolean isStateManageable() {
+        return true;
+    }
+
+    public boolean isStatisticsProvider() {
+        return true;
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Jetty HTTP Connector", JettyConnector.class);
+        infoFactory.addReference(CONNECTOR_CONTAINER_REFERENCE, JettyContainer.class, GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
+        infoFactory.addReference("ThreadPool", ThreadPool.class, GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
+        // this is needed because the getters/setters are not added automatically
+        infoFactory.addOperation("setStatsOn", new Class[] { boolean.class }, "void");
+        // removed 'minThreads' from persistent and manageable String[]
+        // removed 'tcpNoDelay' from persistent String[]
+        // added 'protocol' to persistent and manageable String[]
+        infoFactory.addInterface(JettyWebConnector.class, 
+                new String[]{"host", "port", "minThreads", "maxThreads", "bufferSizeBytes", "headerBufferSizeBytes", "acceptQueueSize", "lingerMillis", "redirectPort", "maxIdleTimeMs"},
+                new String[]{"host", "port", "minThreads", "maxThreads", "bufferSizeBytes", "headerBufferSizeBytes", "acceptQueueSize", "lingerMillis", "protocol", "redirectPort"});
+        infoFactory.setConstructor(new String[]{"JettyContainer", "ThreadPool"});
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+}

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/JettyConnector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/JettyConnector.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/JettyConnector.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/JettyThreadPool.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/JettyThreadPool.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/JettyThreadPool.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/JettyThreadPool.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.jetty8.connector;
+
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.TimeUnit;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.geronimo.system.threads.ThreadPool;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JettyThreadPool implements org.eclipse.jetty.util.thread.ThreadPool {
+
+    private static final Logger log = LoggerFactory.getLogger(JettyThreadPool.class);
+    private final ThreadPool executor;
+    private final String name;
+
+    public JettyThreadPool(ThreadPool executor, String name) {
+        this.executor = executor;
+        this.name = name;
+    }
+
+    public boolean dispatch(Runnable runnable) {
+        try {
+            executor.execute(name, runnable);
+            return true;
+        } catch (RejectedExecutionException e) {
+            log.warn("Unable to execute task", e);
+            return false;
+        } catch (InterruptedException e) {
+            log.warn("Thread interrupted", e);
+            return false;
+        }
+    }
+
+    public void join() throws InterruptedException {
+        //umm, this is doubtful
+        executor.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
+    }
+
+    public int getThreads() {
+        return executor.getPoolSize();
+    }
+
+    public int getIdleThreads() {
+        return executor.getMaximumPoolSize() - executor.getPoolSize();
+    }
+
+    public boolean isLowOnThreads() {
+        return executor.getPoolSize() >= executor.getMaximumPoolSize();
+    }
+}

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/JettyThreadPool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/JettyThreadPool.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/connector/JettyThreadPool.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/handler/EJBServletHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/handler/EJBServletHandler.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/handler/EJBServletHandler.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/handler/EJBServletHandler.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.jetty8.handler;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Map;
+import java.util.HashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+
+import org.eclipse.jetty.servlet.ServletHandler;
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.server.Response;
+import org.eclipse.jetty.http.HttpException;
+import org.apache.geronimo.webservices.WebServiceContainer;
+
+/**
+ * ServletHandler that always delegates to a WebServiceContainer, presumably an EJB web service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EJBServletHandler extends ServletHandler {
+
+    private final WebServiceContainer webServiceContainer;
+
+    public EJBServletHandler(WebServiceContainer webServiceContainer) {
+        this.webServiceContainer = webServiceContainer;
+    }
+
+    @Override
+    public void doScope(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
+        if (false)
+            nextScope(target,baseRequest,request,response);
+        else if (_nextScope!=null)
+            _nextScope.doScope(target,baseRequest,request, response);
+        else if (_outerScope!=null)
+            _outerScope.doHandle(target,baseRequest,request, response);
+        else
+            doHandle(target,baseRequest,request, response);
+        // end manual inline (pathentic attempt to reduce stack depth)
+    }
+
+    @Override
+    public void doHandle(String target, Request baseRequest, HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
+        Response jettyResponse = (Response) res;
+        res.setContentType("text/xml");
+        RequestAdapter request = new RequestAdapter(baseRequest);
+        ResponseAdapter response = new ResponseAdapter(jettyResponse);
+
+        request.setAttribute(WebServiceContainer.SERVLET_REQUEST, req);
+        request.setAttribute(WebServiceContainer.SERVLET_RESPONSE, res);
+        // TODO: add support for context
+        request.setAttribute(WebServiceContainer.SERVLET_CONTEXT, null);
+
+        if (isWSDLRequest(req)) {
+            try {
+                webServiceContainer.getWsdl(request, response);
+                baseRequest.setHandled(true);
+            } catch (IOException e) {
+                throw e;
+            } catch (Exception e) {
+                throw (HttpException) new HttpException(500, "Could not fetch wsdl!").initCause(e);
+            }
+        } else {
+            try {
+                webServiceContainer.invoke(request, response);
+                baseRequest.setHandled(true);
+            } catch (IOException e) {
+                throw e;
+            } catch (Exception e) {
+                throw (HttpException) new HttpException(500, "Could not process message!").initCause(e);
+            }
+        }
+    }
+
+    private boolean isWSDLRequest(HttpServletRequest req) {
+        return ("GET".equals(req.getMethod()) && (req.getParameter("wsdl") != null || req.getParameter("xsd") != null));            
+    }
+
+    public static class RequestAdapter implements WebServiceContainer.Request {
+        private final Request request;
+        private URI uri;
+
+        public RequestAdapter(Request request) {
+            this.request = request;
+        }
+
+        public String getHeader(String name) {
+            return request.getHeader(name);
+        }
+
+        public java.net.URI getURI() {
+            if (uri == null) {
+                try {
+                    //String uriString = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getRequestURI();
+                    //return new java.net.URI(uri.getScheme(),uri.getHost(),uri.getPath(),uri.);
+                    uri = new java.net.URI(request.getScheme(), null, request.getServerName(), request.getServerPort(), request.getRequestURI(), request.getQueryString(), null);
+                } catch (URISyntaxException e) {
+                    throw new IllegalStateException(e.getMessage(), e);
+                }
+            }
+            return uri;
+        }
+
+        public int getContentLength() {
+            return request.getContentLength();
+        }
+
+        public String getContentType() {
+            return request.getContentType();
+        }
+
+        public InputStream getInputStream() throws IOException {
+            return request.getInputStream();
+        }
+
+        public int getMethod() {
+            Integer method = methods.get(request.getMethod());
+            return method == null ? UNSUPPORTED : method;
+        }
+
+        public String getParameter(String name) {
+            return request.getParameter(name);
+        }
+
+        public Map getParameters() {
+            return request.getParameterMap();
+        }
+
+        public Object getAttribute(String name) {
+            return request.getAttribute(name);
+        }
+
+        public void setAttribute(String name, Object value) {
+            request.setAttribute(name, value);
+        }
+
+        public String getRemoteAddr() {
+            return request.getRemoteAddr();
+        }
+
+        public String getContextPath() {
+            //request.getContextPath() isn't working correctly and returned null.
+            //use getRequestURI() for now before it is fixed.
+            //return request.getContextPath();
+            return request.getRequestURI();
+        }
+
+        private static final Map<String, Integer> methods = new HashMap<String, Integer>();
+
+        static {
+            methods.put("OPTIONS", OPTIONS);
+            methods.put("GET", GET);
+            methods.put("HEAD", HEAD);
+            methods.put("POST", POST);
+            methods.put("PUT", PUT);
+            methods.put("DELETE", DELETE);
+            methods.put("TRACE", TRACE);
+            methods.put("CONNECT", CONNECT);
+        }
+
+    }
+
+    public static class ResponseAdapter implements WebServiceContainer.Response {
+        private final Response response;
+
+        public ResponseAdapter(Response response) {
+            this.response = response;
+        }
+
+        public void setHeader(String name, String value) {
+            response.setHeader(name, value);
+        }
+
+        public String getHeader(String name) {
+            return response.getHeader(name);
+        }
+
+        public OutputStream getOutputStream() {
+            try {
+                return response.getOutputStream();
+            } catch (IOException e) {
+                throw new IllegalStateException(e.getMessage(), e);
+            }
+        }
+
+        public void setStatusCode(int code) {
+            response.setStatus(code);
+        }
+
+        public int getStatusCode() {
+            return response.getStatus();
+        }
+
+        public void setContentType(String type) {
+            response.setContentType(type);
+        }
+
+        public String getContentType() {
+            return response.getContentType();
+        }
+
+        public void setStatusMessage(String responseString) {
+            response.setStatus(response.getStatus(), responseString);
+        }
+
+        public void flushBuffer() throws java.io.IOException {
+            response.flushBuffer();
+        }
+    }
+    
+}

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/handler/EJBServletHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/handler/EJBServletHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/handler/EJBServletHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message