geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r882333 [6/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/JettyContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyContainerImpl.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyContainerImpl.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyContainerImpl.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,311 @@
+/**
+ *  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.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.security.Permission;
+import java.security.Permissions;
+import java.security.PermissionCollection;
+
+import javax.management.j2ee.statistics.Stats;
+import javax.security.jacc.WebUserDataPermission;
+
+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.management.LazyStatisticsProvider;
+import org.apache.geronimo.management.geronimo.NetworkConnector;
+import org.apache.geronimo.management.geronimo.WebManager;
+import org.apache.geronimo.management.geronimo.stats.JettyWebContainerStatsImpl;
+import org.apache.geronimo.security.jaas.ConfigurationFactory;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.apache.geronimo.webservices.SoapHandler;
+import org.apache.geronimo.webservices.WebServiceContainer;
+import org.apache.geronimo.jetty8.handler.EJBServletHandler;
+import org.apache.geronimo.jetty8.handler.EJBWebServiceContext;
+import org.apache.geronimo.jetty8.security.JettySecurityHandlerFactory;
+import org.apache.geronimo.jetty8.security.BuiltInAuthMethod;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.RequestLog;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.ContextHandlerCollection;
+import org.eclipse.jetty.server.handler.DefaultHandler;
+import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.server.handler.RequestLogHandler;
+import org.eclipse.jetty.server.handler.StatisticsHandler;
+import org.eclipse.jetty.servlet.ServletHandler;
+import org.eclipse.jetty.security.SecurityHandler;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@GBean
+public class JettyContainerImpl implements JettyContainer, SoapHandler, GBeanLifecycle, LazyStatisticsProvider {
+    /**
+     * The default value of JETTY_HOME variable
+     */
+    private static final String DEFAULT_JETTY_HOME = "var/jetty";
+
+    private final Server server;
+    private final Map<String, EJBWebServiceContext> webServices = new HashMap<String, EJBWebServiceContext>();
+    private final String objectName;
+    private final BundleContext bundleContext;
+    private final WebManager manager;
+    private final String jettyHome;
+    private final ServerInfo serverInfo;
+    private File jettyHomeDir;
+    private JettyWebContainerStatsImpl stats;
+    // list of handlers
+    private StatisticsHandler statsHandler = new StatisticsHandler();
+    private ContextHandlerCollection contextHandlerCollection = new ContextHandlerCollection();
+    private RequestLogHandler requestLogHandler = new RequestLogHandler();
+    //    private boolean statsHandlerInPlace = false;
+    private boolean statsOn = false;
+
+    public JettyContainerImpl(@ParamSpecial(type = SpecialAttributeType.objectName) String objectName,
+                              @ParamSpecial(type = SpecialAttributeType.bundleContext) BundleContext bundleContext,
+                              @ParamReference(name = "WebManager") WebManager manager,
+                              @ParamAttribute(name = "jettyHome") String jettyHome,
+                              @ParamReference(name = "ServerInfo") ServerInfo serverInfo) {
+        this.objectName = objectName;
+        this.bundleContext = bundleContext;
+        this.jettyHome = jettyHome;
+        this.serverInfo = serverInfo;
+
+        server = new Server();
+
+        //set up the jetty8+ handler structure which is to have a HandlerCollection,
+        //each element of which is always tried on each request.
+        //The first element of the HandlerCollection is a
+        //ContextHandlerCollection, which is itself is a collection
+        //of Handlers. It's special property is that only one of it's
+        //handlers will respond to a request.
+        //The second element of the HandlerCollection is a DefaultHandler
+        //which is responsible for serving static content or anything not
+        //handled by a Handler in the ContextHandlerCollection.
+        //The third element is the RequestLogHandler, which requires
+        //a RequestLog impl to be set.
+        DefaultHandler defaultHandler = new DefaultHandler();
+        Handler[] handlers = {contextHandlerCollection, defaultHandler, requestLogHandler, statsHandler};
+        HandlerCollection handlerCollection = new HandlerCollection();
+        handlerCollection.setHandlers(handlers);
+        server.setHandler(handlerCollection);
+
+        stats = new JettyWebContainerStatsImpl();
+        this.manager = manager;
+    }
+
+    public String getObjectName() {
+        return objectName;
+    }
+
+    public boolean isStateManageable() {
+        return true;
+    }
+
+    public boolean isStatisticsProvider() {
+        return true;
+    }
+
+    public boolean isEventProvider() {
+        return true;
+    }
+
+    public NetworkConnector[] getConnectors() {
+        return manager.getConnectorsForContainer(this);
+    }
+
+    public NetworkConnector[] getConnectors(String protocol) {
+        return manager.getConnectorsForContainer(this, protocol);
+    }
+
+    public void resetStats() {
+        statsHandler.statsReset();
+        stats.setStartTime();
+    }
+
+    public long getCollectStatisticsStarted() {
+        return statsHandler.getStatsOnMs();
+    }
+
+    public boolean isStatsOn() {
+        return statsOn;
+    }
+
+    public void setStatsOn(boolean on) {
+        try {
+            if (on) {
+                // set the statistics handler if not already done so
+//                if (!statsHandlerInPlace) {
+//                    handlerCollection.addHandler(statsHandler);
+//                    statsHandlerInPlace = true;
+//                }
+                // clear previous data and set start time
+                resetStats();
+                // start the handler
+                statsHandler.start();
+            } else {
+                statsHandler.stop();
+                // hack because stats collection really doesn't really stop when statsHandler.stop() is invoked
+//                if (statsHandlerInPlace) {
+//                    handlerCollection.removeHandler(statsHandler);
+//                    statsHandlerInPlace=false;
+//                }
+            }
+            statsOn = on;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public Stats getStats() {
+        if (isStatsOn()) {
+            stats.setLastSampleTime();
+
+            /* set active request range values */
+            stats.getActiveRequestCountImpl().setCurrent((long) statsHandler.getRequestsActive());
+//            stats.getActiveRequestCountImpl().setLowWaterMark((long) statsHandler.getRequestsActiveMin());
+            stats.getActiveRequestCountImpl().setHighWaterMark((long) statsHandler.getRequestsActiveMax());
+
+            /* set request duration time values, avg = Totaltime/Count */
+            /* set active request count */
+            stats.getRequestDurationImpl().setCount((long) statsHandler.getRequests());
+//            stats.getRequestDurationImpl().setMaxTime((long) statsHandler.getRequestsDurationMax());
+//            stats.getRequestDurationImpl().setMinTime((long) statsHandler.getRequestsDurationMin());
+//            stats.getRequestDurationImpl().setTotalTime((long) statsHandler.getRequestsDurationTotal());
+
+            /* set request count values*/
+            stats.getResponses1xxImpl().setCount((long) statsHandler.getResponses1xx());
+            stats.getResponses2xxImpl().setCount((long) statsHandler.getResponses2xx());
+            stats.getResponses3xxImpl().setCount((long) statsHandler.getResponses3xx());
+            stats.getResponses4xxImpl().setCount((long) statsHandler.getResponses4xx());
+            stats.getResponses5xxImpl().setCount((long) statsHandler.getResponses5xx());
+
+            /* set elapsed time for stats collection */
+            stats.getStatsOnMsImpl().setCount((long) statsHandler.getStatsOnMs());
+        }
+        return stats;
+    }
+
+    public void addListener(Connector listener) {
+        server.addConnector(listener);
+    }
+
+    public void removeListener(Connector listener) {
+        server.removeConnector(listener);
+    }
+
+    public void addContext(Handler context) {
+        contextHandlerCollection.addHandler(context);
+    }
+
+    public void removeContext(Handler context) {
+        contextHandlerCollection.removeHandler(context);
+    }
+
+    public void addWebService(String contextPath,
+                              String[] virtualHosts,
+                              WebServiceContainer webServiceContainer,
+                              String contextID,
+                              ConfigurationFactory configurationFactory,
+                              String realmName,
+                              String authMethod,
+                              Properties properties,
+                              ClassLoader classLoader) throws Exception {
+        SecurityHandler securityHandler = null;
+        if (configurationFactory != null) {
+            BuiltInAuthMethod builtInAuthMethod = BuiltInAuthMethod.getValueOf(authMethod);
+            JettySecurityHandlerFactory  factory = new JettySecurityHandlerFactory(builtInAuthMethod, null, null, realmName, configurationFactory);
+            //TODO use actual default subject here.
+            securityHandler = factory.buildSecurityHandler(contextID, null, null, false);
+        }
+        ServletHandler servletHandler = new EJBServletHandler(webServiceContainer);
+        EJBWebServiceContext webServiceContext = new EJBWebServiceContext(contextPath, securityHandler, servletHandler, classLoader);
+        webServiceContext.setVirtualHosts(virtualHosts);
+        addContext(webServiceContext);
+        webServiceContext.start();
+        webServices.put(contextPath, webServiceContext);
+    }
+
+    public void removeWebService(String contextPath) {
+        EJBWebServiceContext webServiceContext = webServices.remove(contextPath);
+        try {
+            removeContext(webServiceContext);
+        } catch (Exception e) {
+            throw new IllegalStateException(e.getMessage(), e);
+        }
+    }
+
+    public void setRequestLog(RequestLog log) {
+        this.requestLogHandler.setRequestLog(log);
+    }
+
+    public File resolveToJettyHome(String workDir) {
+        if (workDir == null) {
+            return null;
+        }
+        return new File(jettyHomeDir, workDir);
+    }
+
+    public RequestLog getRequestLog() {
+        return this.requestLogHandler.getRequestLog();
+    }
+
+    public void doStart() throws Exception {
+        jettyHomeDir = new File(serverInfo.resolveServerPath(jettyHome != null ? jettyHome : DEFAULT_JETTY_HOME));
+        if (!jettyHomeDir.exists()) {
+            jettyHomeDir.mkdirs();
+        }
+        // start the server
+        server.start();
+    }
+
+    public void doStop() {
+        try {
+            server.stop();
+        } catch (Exception e) {
+        }
+    }
+
+    public void doFail() {
+        try {
+            server.stop();
+        } catch (Exception e) {
+            // continue
+        }
+    }
+
+    /**
+     * Returns the configuration BundleContext associated with
+     * this network container.
+     *
+     * @return The BundleContext instance for the container's configuration.
+     */
+    public BundleContext getBundleContext() {
+        return bundleContext;
+    }
+}

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

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

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

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyFilterMapping.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyFilterMapping.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyFilterMapping.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyFilterMapping.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,166 @@
+/**
+ *  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.util.Collection;
+import java.util.EnumSet;
+
+
+import javax.servlet.DispatcherType;
+import org.apache.geronimo.gbean.ReferenceCollection;
+import org.apache.geronimo.gbean.ReferenceCollectionEvent;
+import org.apache.geronimo.gbean.ReferenceCollectionListener;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.eclipse.jetty.servlet.FilterMapping;
+import org.eclipse.jetty.servlet.ServletHandler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@GBean(j2eeType = NameFactory.URL_WEB_FILTER_MAPPING)
+public class JettyFilterMapping extends FilterMapping {
+
+    private final String[] urlPatterns;
+    private final boolean requestDispatch;
+    private final boolean forwardDispatch;
+    private final boolean includeDispatch;
+    private final boolean errorDispatch;
+    private final FilterHolderWrapper jettyFilterHolder;
+    private final Collection<ServletNameSource> jettyServletHolders;
+    private final JettyFilterMapping previous;
+    private final JettyServletRegistration jettyServletRegistration;
+
+    public JettyFilterMapping(@ParamAttribute(name = "urlPatterns")String[] urlPatterns,
+            @ParamAttribute(name = "requestDispatch")boolean requestDispatch,
+            @ParamAttribute(name = "forwardDispatch")boolean forwardDispatch,
+            @ParamAttribute(name = "includeDispatch")boolean includeDispatch,
+            @ParamAttribute(name = "errorDispatch")boolean errorDispatch,
+            @ParamReference(name="Filter", namingType = NameFactory.WEB_FILTER) FilterHolderWrapper jettyFilterHolder,
+            @ParamReference(name="Servlets", namingType = NameFactory.SERVLET)Collection<ServletNameSource> jettyServletHolders,
+            @ParamReference(name="Previous", namingType = NameFactory.URL_WEB_FILTER_MAPPING)JettyFilterMapping previous,
+            @ParamReference(name="JettyServletRegistration", namingType = NameFactory.WEB_MODULE)JettyServletRegistration jettyServletRegistration) {
+        this.urlPatterns = urlPatterns;
+        this.requestDispatch = requestDispatch;
+        this.forwardDispatch = forwardDispatch;
+        this.includeDispatch = includeDispatch;
+        this.errorDispatch = errorDispatch;
+        this.jettyFilterHolder = jettyFilterHolder;
+        this.jettyServletHolders = jettyServletHolders;
+        this.previous = previous;
+        this.jettyServletRegistration = jettyServletRegistration;
+
+        if (jettyServletRegistration != null) {
+            assert jettyServletHolders != null ^ urlPatterns != null;
+
+            String filterName = jettyFilterHolder.getFilterName();
+            EnumSet<DispatcherType> dispatches = EnumSet.noneOf(DispatcherType.class);
+            if (requestDispatch) {
+                dispatches.add(DispatcherType.REQUEST);
+            }
+            if (forwardDispatch) {
+                dispatches.add(DispatcherType.FORWARD);
+            }
+            if (includeDispatch) {
+                dispatches.add(DispatcherType.INCLUDE);
+            }
+            if (errorDispatch) {
+                dispatches.add(DispatcherType.ERROR);
+            }
+
+            setFilterName(filterName);
+            setDispatcherTypes(dispatches);
+            setPathSpecs(urlPatterns);
+            if (jettyServletHolders != null) {
+                resetServlets();
+                if (jettyServletHolders instanceof ReferenceCollection) {
+                    ((ReferenceCollection) jettyServletHolders).addReferenceCollectionListener(new ReferenceCollectionListener() {
+
+                        public void memberAdded(ReferenceCollectionEvent event) {
+                            resetServlets();
+                            resetJettyFilterMappings();
+                        }
+
+                        public void memberRemoved(ReferenceCollectionEvent event) {
+                            resetServlets();
+                            resetJettyFilterMappings();
+                        }
+                    });
+                }
+            }
+
+            jettyServletRegistration.getServletHandler().addFilterMapping(this);
+        }
+    }
+
+    private void resetJettyFilterMappings() {
+        //This causes jetty to recompute the filter to servlet mappings based on the
+        //current servlet names in the filter mappings.  Pretty inefficient.
+        ServletHandler servletHandler = jettyServletRegistration.getServletHandler();
+        FilterMapping[] filterMappings = servletHandler.getFilterMappings();
+        FilterMapping[] copy = filterMappings.clone();
+        servletHandler.setFilterMappings(copy);
+    }
+
+    private void resetServlets() {
+        String[] servletNames = new String[jettyServletHolders.size()];
+        int i = 0;
+        for (ServletNameSource jettyServletHolder : jettyServletHolders) {
+            servletNames[i++] = jettyServletHolder.getServletName();
+        }
+        setServletNames(servletNames);
+    }
+
+    public String[] getUrlPatterns() {
+        return urlPatterns;
+    }
+
+    public boolean isRequestDispatch() {
+        return requestDispatch;
+    }
+
+    public boolean isForwardDispatch() {
+        return forwardDispatch;
+    }
+
+    public boolean isIncludeDispatch() {
+        return includeDispatch;
+    }
+
+    public boolean isErrorDispatch() {
+        return errorDispatch;
+    }
+
+    public FilterHolderWrapper getFilter() {
+        return jettyFilterHolder;
+    }
+
+    public Collection<ServletNameSource> getServlets() {
+        return jettyServletHolders;
+    }
+
+    public JettyFilterMapping getPrevious() {
+        return previous;
+    }
+
+    public JettyServletRegistration getJettyServletRegistration() {
+        return jettyServletRegistration;
+    }
+
+}

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

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

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

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyManagerImpl.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyManagerImpl.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyManagerImpl.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,423 @@
+/**
+ *  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.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.ReferencePatterns;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.geronimo.jetty8.connector.AJP13Connector;
+import org.apache.geronimo.jetty8.connector.HTTPBlockingConnector;
+import org.apache.geronimo.jetty8.connector.HTTPSSelectChannelConnector;
+import org.apache.geronimo.jetty8.connector.HTTPSSocketConnector;
+import org.apache.geronimo.jetty8.connector.HTTPSelectChannelConnector;
+import org.apache.geronimo.jetty8.connector.HTTPSocketConnector;
+import org.apache.geronimo.jetty8.connector.JettyConnector;
+import org.apache.geronimo.jetty8.requestlog.JettyLogManager;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.EditableConfigurationManager;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.proxy.ProxyManager;
+import org.apache.geronimo.management.geronimo.KeystoreManager;
+import org.apache.geronimo.management.geronimo.NetworkConnector;
+import org.apache.geronimo.management.geronimo.WebAccessLog;
+import org.apache.geronimo.management.geronimo.WebContainer;
+import org.apache.geronimo.management.geronimo.WebManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Jetty implementation of WebManager.  Knows how to manipulate
+ * other Jetty objects for management purposes.
+ *
+ * @version $Rev:386276 $ $Date$
+ */
+
+@GBean
+public class JettyManagerImpl implements WebManager {
+    private static final Logger log = LoggerFactory.getLogger(JettyManagerImpl.class);
+
+    private static final ConnectorType HTTP_NIO = new ConnectorType(Messages.getString("JettyManagerImpl.0")); //$NON-NLS-1$
+    private static final ConnectorType HTTPS_NIO = new ConnectorType(Messages.getString("JettyManagerImpl.1")); //$NON-NLS-1$
+    private static final ConnectorType HTTP_BLOCKING_NIO = new ConnectorType(Messages.getString("JettyManagerImpl.2")); //$NON-NLS-1$
+    private static final ConnectorType HTTP_BIO = new ConnectorType(Messages.getString("JettyManagerImpl.3")); //$NON-NLS-1$
+    private static final ConnectorType HTTPS_BIO = new ConnectorType(Messages.getString("JettyManagerImpl.4")); //$NON-NLS-1$
+    private static final ConnectorType AJP_NIO = new ConnectorType(Messages.getString("JettyManagerImpl.5")); //$NON-NLS-1$
+    private static List<ConnectorType> CONNECTOR_TYPES = Arrays.asList(
+            HTTP_NIO,
+            HTTPS_NIO,
+            HTTP_BLOCKING_NIO,
+            HTTP_BIO,
+            HTTPS_BIO,
+            AJP_NIO
+    );
+
+    private static Map<ConnectorType, List<ConnectorAttribute>> CONNECTOR_ATTRIBUTES = new HashMap<ConnectorType, List<ConnectorAttribute>>();
+
+    static {
+        List<ConnectorAttribute> connectorAttributes = new ArrayList<ConnectorAttribute>();
+        addCommonConnectorAttributes(connectorAttributes);
+        CONNECTOR_ATTRIBUTES.put(HTTP_NIO, connectorAttributes);
+
+        connectorAttributes = new ArrayList<ConnectorAttribute>();
+        addCommonConnectorAttributes(connectorAttributes);
+        addSslConnectorAttributes(connectorAttributes);
+        setAttribute(connectorAttributes, "port", 8443); // SSL port
+        CONNECTOR_ATTRIBUTES.put(HTTPS_NIO, connectorAttributes);
+
+        connectorAttributes = new ArrayList<ConnectorAttribute>();
+        addCommonConnectorAttributes(connectorAttributes);
+        CONNECTOR_ATTRIBUTES.put(HTTP_BIO, connectorAttributes);
+
+        connectorAttributes = new ArrayList<ConnectorAttribute>();
+        addCommonConnectorAttributes(connectorAttributes);
+        addSslConnectorAttributes(connectorAttributes);
+        setAttribute(connectorAttributes, "port", 8443); // SSL port
+        CONNECTOR_ATTRIBUTES.put(HTTPS_BIO, connectorAttributes);
+
+        connectorAttributes = new ArrayList<ConnectorAttribute>();
+        addCommonConnectorAttributes(connectorAttributes);
+        CONNECTOR_ATTRIBUTES.put(HTTP_BLOCKING_NIO, connectorAttributes);
+
+        connectorAttributes = new ArrayList<ConnectorAttribute>();
+        addCommonConnectorAttributes(connectorAttributes);
+        CONNECTOR_ATTRIBUTES.put(AJP_NIO, connectorAttributes);
+
+    }
+
+    private static Map<ConnectorType, GBeanInfo> CONNECTOR_GBEAN_INFOS = new HashMap<ConnectorType, GBeanInfo>();
+
+    static {
+        CONNECTOR_GBEAN_INFOS.put(HTTP_NIO, HTTPSelectChannelConnector.GBEAN_INFO);
+        CONNECTOR_GBEAN_INFOS.put(HTTPS_NIO, HTTPSSelectChannelConnector.GBEAN_INFO);
+        CONNECTOR_GBEAN_INFOS.put(HTTP_BLOCKING_NIO, HTTPBlockingConnector.GBEAN_INFO);
+        CONNECTOR_GBEAN_INFOS.put(HTTP_BIO, HTTPSocketConnector.GBEAN_INFO);
+        CONNECTOR_GBEAN_INFOS.put(HTTPS_BIO, HTTPSSocketConnector.GBEAN_INFO);
+        CONNECTOR_GBEAN_INFOS.put(AJP_NIO, AJP13Connector.GBEAN_INFO);
+    }
+
+    private final Kernel kernel;
+
+    public JettyManagerImpl(@ParamSpecial(type = SpecialAttributeType.kernel)Kernel kernel) {
+        this.kernel = kernel;
+    }
+
+    public String getProductName() {
+        return "Jetty";
+    }
+
+    /**
+     * Get a list of containers for this web implementation.
+     */
+    public Object[] getContainers() {
+        ProxyManager proxyManager = kernel.getProxyManager();
+        AbstractNameQuery query = new AbstractNameQuery(JettyContainer.class.getName());
+        Set names = kernel.listGBeans(query);
+        JettyContainer[] results = new JettyContainer[names.size()];
+        int i = 0;
+        for (Iterator it = names.iterator(); it.hasNext(); i++) {
+            AbstractName name = (AbstractName) it.next();
+            results[i] = (JettyContainer) proxyManager.createProxy(name, JettyContainer.class.getClassLoader());
+        }
+        return results;
+    }
+
+    /**
+     * Gets the protocols that this web container supports (that you can create
+     * connectors for).
+     */
+    public String[] getSupportedProtocols() {
+        return new String[]{PROTOCOL_HTTP, PROTOCOL_HTTPS, PROTOCOL_AJP};
+    }
+
+    /**
+     * Removes a connector.  This shuts it down if necessary, and removes it
+     * from the server environment.  It must be a connector that this container
+     * is responsible for.
+     *
+     * @param connectorName
+     */
+    public void removeConnector(AbstractName connectorName) {
+        try {
+            GBeanInfo info = kernel.getGBeanInfo(connectorName);
+            boolean found = false;
+            Set intfs = info.getInterfaces();
+            for (Iterator it = intfs.iterator(); it.hasNext();) {
+                String intf = (String) it.next();
+                if (intf.equals(JettyWebConnector.class.getName())) {
+                    found = true;
+                }
+            }
+            if (!found) {
+                throw new GBeanNotFoundException(connectorName);
+            }
+            ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
+            if (mgr != null && mgr instanceof EditableConfigurationManager) {
+                try {
+                   ((EditableConfigurationManager)mgr).removeGBeanFromConfiguration(connectorName.getArtifact(), connectorName);
+                } catch (InvalidConfigException e) {
+                    log.error("Unable to add GBean", e);
+                } finally {
+                    ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
+                }
+            } else {
+                log.warn("The ConfigurationManager in the kernel does not allow editing");
+            }
+        } catch (GBeanNotFoundException e) {
+            log.warn("No such GBean '" + connectorName + "'"); //todo: what if we want to remove a failed GBean?
+        } catch (Exception e) {
+            log.error("Failed to remove connector", e);
+        }
+    }
+
+    /**
+     * Gets the ObjectNames of any existing connectors for the specified
+     * protocol.
+     *
+     * @param protocol A protocol as returned by getSupportedProtocols
+     */
+    public NetworkConnector[] getConnectors(String protocol) {
+        if (protocol == null) {
+            return getConnectors();
+        }
+        List result = new ArrayList();
+        ProxyManager proxyManager = kernel.getProxyManager();
+        AbstractNameQuery query = new AbstractNameQuery(JettyWebConnector.class.getName());
+        Set names = kernel.listGBeans(query);
+        for (Iterator it = names.iterator(); it.hasNext();) {
+            AbstractName name = (AbstractName) it.next();
+            try {
+                if (kernel.getAttribute(name, "protocol").equals(protocol)) {
+                    result.add(proxyManager.createProxy(name, JettyWebConnector.class.getClassLoader()));
+                }
+            } catch (Exception e) {
+                log.error("Unable to check the protocol for a connector", e);
+            }
+        }
+        return (JettyWebConnector[]) result.toArray(new JettyWebConnector[names.size()]);
+    }
+
+    public WebAccessLog getAccessLog(WebContainer container) {
+        AbstractNameQuery query = new AbstractNameQuery(JettyLogManager.class.getName());
+        Set names = kernel.listGBeans(query);
+        if (names.size() == 0) {
+            return null;
+        } else if (names.size() > 1) {
+            throw new IllegalStateException("Should not be more than one Jetty access log manager");
+        }
+        return (WebAccessLog) kernel.getProxyManager().createProxy((AbstractName) names.iterator().next(), JettyLogManager.class.getClassLoader());
+    }
+
+    public List<ConnectorType> getConnectorTypes() {
+        return CONNECTOR_TYPES;
+    }
+
+    public List<ConnectorAttribute> getConnectorAttributes(ConnectorType connectorType) {
+        return ConnectorAttribute.copy(CONNECTOR_ATTRIBUTES.get(connectorType));
+    }
+
+    public AbstractName getConnectorConfiguration(ConnectorType connectorType, List<ConnectorAttribute> connectorAttributes, WebContainer container, String uniqueName) {
+        GBeanInfo gbeanInfo = CONNECTOR_GBEAN_INFOS.get(connectorType);
+        AbstractName containerName = kernel.getAbstractNameFor(container);
+        AbstractName name = kernel.getNaming().createSiblingName(containerName, uniqueName, GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
+        GBeanData gbeanData = new GBeanData(name, gbeanInfo);
+        gbeanData.setReferencePattern(JettyConnector.CONNECTOR_CONTAINER_REFERENCE, containerName);
+        for (ConnectorAttribute connectorAttribute : connectorAttributes) {
+            Object value = connectorAttribute.getValue();
+            if (value != null) {
+                gbeanData.setAttribute(connectorAttribute.getAttributeName(), connectorAttribute.getValue());
+            }
+        }
+
+        // provide a reference to KeystoreManager gbean for HTTPS connectors
+        if (connectorType.equals(HTTPS_NIO) || connectorType.equals(HTTPS_BIO)) {
+            AbstractNameQuery query = new AbstractNameQuery(KeystoreManager.class.getName());
+            gbeanData.setReferencePattern("KeystoreManager", query);
+        }
+
+        try {
+            ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
+            if (mgr != null && mgr instanceof EditableConfigurationManager) {
+                ((EditableConfigurationManager)mgr).addGBeanToConfiguration(containerName.getArtifact(), gbeanData, false);
+            } else {
+                log.warn("The ConfigurationManager in the kernel does not allow editing");
+                return null;
+            }
+        } catch (InvalidConfigException e) {
+            log.error("Unable to add GBean", e);
+            return null;
+        } catch (GBeanNotFoundException e) {
+            log.error("Unable to add GBean", e);
+            return null;
+        }
+        return name;
+    }
+
+    public ConnectorType getConnectorType(AbstractName connectorName) {
+        ConnectorType connectorType = null;
+        try {
+            GBeanInfo info = kernel.getGBeanInfo(connectorName);
+            boolean found = false;
+            Set intfs = info.getInterfaces();
+            for (Iterator it = intfs.iterator(); it.hasNext() && !found;) {
+                String intf = (String) it.next();
+                if (intf.equals(JettyWebConnector.class.getName())) {
+                    found = true;
+                }
+            }
+            if (!found) {
+                throw new GBeanNotFoundException(connectorName);
+            }
+            String searchingFor = info.getName();
+            for (Entry<ConnectorType, GBeanInfo> entry : CONNECTOR_GBEAN_INFOS.entrySet() ) {
+                String candidate = entry.getValue().getName();
+                if (candidate.equals(searchingFor)) {
+                    return entry.getKey();
+                }
+            }
+        } catch (GBeanNotFoundException e) {
+            log.warn("No such GBean '" + connectorName + "'");
+        } catch (Exception e) {
+            log.error("Failed to get connector type", e);
+        }
+
+        return connectorType;
+    }
+
+    /**
+     * Gets the ObjectNames of any existing connectors.
+     */
+    public NetworkConnector[] getConnectors() {
+        ProxyManager proxyManager = kernel.getProxyManager();
+        AbstractNameQuery query = new AbstractNameQuery(JettyWebConnector.class.getName());
+        Set names = kernel.listGBeans(query);
+        JettyWebConnector[] results = new JettyWebConnector[names.size()];
+        int i = 0;
+        for (Iterator it = names.iterator(); it.hasNext(); i++) {
+            AbstractName name = (AbstractName) it.next();
+            results[i] = (JettyWebConnector) proxyManager.createProxy(name, JettyWebConnector.class.getClassLoader());
+        }
+        return results;
+    }
+
+    public NetworkConnector[] getConnectorsForContainer(Object container, String protocol) {
+        if (protocol == null) {
+            return getConnectorsForContainer(container);
+        }
+        AbstractName containerName = kernel.getAbstractNameFor(container);
+        ProxyManager mgr = kernel.getProxyManager();
+        try {
+            List results = new ArrayList();
+            AbstractNameQuery query = new AbstractNameQuery(JettyWebConnector.class.getName());
+            Set set = kernel.listGBeans(query); // all Jetty connectors
+            for (Iterator it = set.iterator(); it.hasNext();) {
+                AbstractName name = (AbstractName) it.next(); // a single Jetty connector
+                GBeanData data = kernel.getGBeanData(name);
+                ReferencePatterns refs = data.getReferencePatterns(JettyConnector.CONNECTOR_CONTAINER_REFERENCE);
+                if (containerName.equals(refs.getAbstractName())) {
+                    try {
+                        String testProtocol = (String) kernel.getAttribute(name, "protocol");
+                        if (testProtocol != null && testProtocol.equals(protocol)) {
+                            results.add(mgr.createProxy(name, JettyWebConnector.class.getClassLoader()));
+                        }
+                    } catch (Exception e) {
+                        log.error("Unable to look up protocol for connector '" + name + "'", e);
+                    }
+                    break;
+                }
+            }
+            return (JettyWebConnector[]) results.toArray(new JettyWebConnector[results.size()]);
+        } catch (Exception e) {
+            throw (IllegalArgumentException) new IllegalArgumentException("Unable to look up connectors for Jetty container '" + containerName + "': ").initCause(e);
+        }
+    }
+
+    public NetworkConnector[] getConnectorsForContainer(Object container) {
+        AbstractName containerName = kernel.getAbstractNameFor(container);
+        ProxyManager mgr = kernel.getProxyManager();
+        try {
+            List results = new ArrayList();
+            AbstractNameQuery query = new AbstractNameQuery(JettyWebConnector.class.getName());
+            Set set = kernel.listGBeans(query); // all Jetty connectors
+            for (Iterator it = set.iterator(); it.hasNext();) {
+                AbstractName name = (AbstractName) it.next(); // a single Jetty connector
+                GBeanData data = kernel.getGBeanData(name);
+                ReferencePatterns refs = data.getReferencePatterns(JettyConnector.CONNECTOR_CONTAINER_REFERENCE);
+                if (containerName.equals(refs.getAbstractName())) {
+                    results.add(mgr.createProxy(name, JettyWebConnector.class.getClassLoader()));
+                }
+            }
+            return (JettyWebConnector[]) results.toArray(new JettyWebConnector[results.size()]);
+        } catch (Exception e) {
+            throw (IllegalArgumentException) new IllegalArgumentException("Unable to look up connectors for Jetty container '" + containerName + "'").initCause(e);
+        }
+    }
+
+    private static void addCommonConnectorAttributes(List<ConnectorAttribute> connectorAttributes) {
+        connectorAttributes.add(new ConnectorAttribute<String>("host", "0.0.0.0", Messages.getString("JettyManagerImpl.30"), String.class, true)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        connectorAttributes.add(new ConnectorAttribute<Integer>("port", 8080, Messages.getString("JettyManagerImpl.32"), Integer.class, true)); //$NON-NLS-1$ //$NON-NLS-2$
+        connectorAttributes.add(new ConnectorAttribute<Integer>("maxThreads", 10, Messages.getString("JettyManagerImpl.34"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
+        connectorAttributes.add(new ConnectorAttribute<Integer>("bufferSizeBytes", 8096, Messages.getString("JettyManagerImpl.36"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
+        connectorAttributes.add(new ConnectorAttribute<Integer>("headerBufferSizeBytes", 8192, Messages.getString("JettyManagerImpl.57"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
+        connectorAttributes.add(new ConnectorAttribute<Integer>("acceptQueueSize", 10, Messages.getString("JettyManagerImpl.38"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
+        connectorAttributes.add(new ConnectorAttribute<Integer>("lingerMillis", 30000, Messages.getString("JettyManagerImpl.40"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
+        //connectorAttributes.add(new ConnectorAttribute<Boolean>("tcpNoDelay", false, "If true then setTcpNoDelay(true) is called on accepted sockets.", Boolean.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("redirectPort", 8443, Messages.getString("JettyManagerImpl.42"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
+        //connectorAttributes.add(new ConnectorAttribute<Integer>("maxIdleTimeMs", 30000, " The time in milliseconds that a connection can be idle before being closed.", Integer.class));
+    }
+
+    private static void addSslConnectorAttributes(List<ConnectorAttribute> connectorAttributes) {
+        //connectorAttributes.add(new ConnectorAttribute<Boolean>("clientAuthRequested", false, "clientAuthRequested", Boolean.class));
+        connectorAttributes.add(new ConnectorAttribute<Boolean>("clientAuthRequired", false, Messages.getString("JettyManagerImpl.44"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
+        connectorAttributes.add(new ConnectorAttribute<String>("keyStore", "", Messages.getString("JettyManagerImpl.47"), String.class, true)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        connectorAttributes.add(new ConnectorAttribute<String>("trustStore", "", Messages.getString("JettyManagerImpl.50"), String.class)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        //connectorAttributes.add(new ConnectorAttribute<String>("keyAlias", "", "keyAlias", String.class, true));
+        connectorAttributes.add(new ConnectorAttribute<String>("secureProtocol", "", Messages.getString("JettyManagerImpl.53"), String.class)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        connectorAttributes.add(new ConnectorAttribute<String>("algorithm", "Default", Messages.getString("JettyManagerImpl.56"), String.class)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    private static <T> void setAttribute (List<ConnectorAttribute> connectorAttributes, String attributeName, T value) {
+        for (ConnectorAttribute connectorAttribute : connectorAttributes) {
+            if (connectorAttribute.getAttributeName().equals(attributeName)) {
+                connectorAttribute.setValue(value);
+                return;
+            }
+        }
+    }
+
+    public void updateConnectorConfig(AbstractName connectorName)  throws Exception {
+        // do nothing for Jetty, only tomcat needs this to update server.xml file.
+    }
+
+}

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

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

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

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettySecureConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettySecureConnector.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettySecureConnector.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettySecureConnector.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,34 @@
+/**
+ *  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 org.apache.geronimo.management.geronimo.SecureConnector;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface JettySecureConnector extends SecureConnector {
+    
+    public void setKeyStore(String keyStore);
+    public String getKeyStore();
+
+    public void setTrustStore(String trustStore);
+    public String getTrustStore();
+
+    public void setKeyAlias(String keyAlias);
+    public String getKeyAlias();
+}

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

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

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

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyServletRegistration.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyServletRegistration.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyServletRegistration.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyServletRegistration.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,46 @@
+/**
+ *  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.util.Set;
+
+import javax.security.auth.Subject;
+import javax.security.auth.login.LoginException;
+
+import org.apache.geronimo.jetty8.handler.IntegrationContext;
+import org.eclipse.jetty.servlet.ServletHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface JettyServletRegistration {
+
+    void registerServletHolder(ServletHolder servletHolder, String servletName, Set<String> servletMappings, String objectName) throws Exception;
+
+    void unregisterServletHolder(ServletHolder servletHolder, String servletName, Set<String> servletMappings, String objectName) throws Exception;
+
+    ServletHandler getServletHandler();
+
+    ClassLoader getWebClassLoader();
+
+    Object newInstance(String className) throws InstantiationException, IllegalAccessException;
+
+    void destroyInstance(Object o) throws Exception;
+
+    IntegrationContext getIntegrationContext();
+}

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

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

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

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyWebConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyWebConnector.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyWebConnector.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyWebConnector.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,28 @@
+/**
+ *  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 org.apache.geronimo.management.geronimo.WebConnector;
+
+/**
+ * A Jetty-specific extension to the standard Geronimo web connector interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JettyWebConnector extends WebConnector {
+
+}

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

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

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

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JspServletHolderWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JspServletHolderWrapper.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JspServletHolderWrapper.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JspServletHolderWrapper.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,54 @@
+/*
+ * 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.util.Map;
+import java.util.Set;
+
+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.j2eeobjectnames.NameFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@GBean(j2eeType = NameFactory.SERVLET_TEMPLATE)
+public class JspServletHolderWrapper extends ServletHolderWrapper {
+
+    public JspServletHolderWrapper() {
+    }
+
+    public JspServletHolderWrapper(@ParamSpecial(type = SpecialAttributeType.objectName) String objectName,
+                                 @ParamAttribute(name = "servletName") String servletName,
+                                 @ParamAttribute(name = "servletClass") String servletClassName,
+                                 @ParamAttribute(name = "jspFile") String jspFile,
+                                 @ParamAttribute(name = "initParams") Map initParams,
+                                 @ParamAttribute(name = "loadOnStartup") Integer loadOnStartup,
+                                 @ParamAttribute(name = "servletMappings") Set<String> servletMappings,
+                                 @ParamAttribute(name = "runAsRole") String runAsRole,
+                                 @ParamReference(name = "JettyServletRegistration", namingType = NameFactory.WEB_MODULE) JettyServletRegistration context) throws Exception {
+        super(objectName, servletName, servletClassName, jspFile, initParams, loadOnStartup, servletMappings, runAsRole, context);
+    }
+
+}

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

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

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

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/Messages.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/Messages.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/Messages.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/Messages.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,37 @@
+/**
+ *  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.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages {
+    private static final String BUNDLE_NAME = "org.apache.geronimo.jetty.messages"; //$NON-NLS-1$
+
+    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
+    private Messages() {
+    }
+
+    public static String getString(String key) {
+        try {
+            return RESOURCE_BUNDLE.getString(key);
+        } catch (MissingResourceException e) {
+            return '!' + key + '!';
+        }
+    }
+}

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

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

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

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/POJOWebServiceHolderWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/POJOWebServiceHolderWrapper.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/POJOWebServiceHolderWrapper.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/POJOWebServiceHolderWrapper.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,133 @@
+/**
+ *  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.io.IOException;
+import java.util.Map;
+import java.util.Set;
+
+import javax.security.auth.Subject;
+import javax.security.jacc.PolicyContext;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.UnavailableException;
+import javax.servlet.http.HttpServletRequest;
+
+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.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.webservices.POJOWebServiceServlet;
+import org.apache.geronimo.webservices.WebServiceContainer;
+import org.apache.geronimo.webservices.WebServiceContainerFactory;
+import org.apache.geronimo.webservices.WebServiceContainerInvoker;
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.servlet.ServletHolder;
+
+
+/**
+ * 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$ $Date$
+ */
+
+@GBean(j2eeType = NameFactory.SERVLET_WEB_SERVICE_TEMPLATE)
+public class POJOWebServiceHolderWrapper implements ServletNameSource, GBeanLifecycle {
+    private final ServletHolder servletHolder;
+    private final WebServiceContainer webServiceContainer;
+    private final Set<String> servletMappings;
+    private final JettyServletRegistration context;
+    private final String pojoClassName;
+
+    public POJOWebServiceHolderWrapper(@ParamAttribute(name = "pojoClassName") String pojoClassName,
+                                     @ParamAttribute(name = "servletName") String servletName,
+                                     @ParamAttribute(name = "initParams") Map<String, String> initParams,
+                                     @ParamAttribute(name = "loadOnStartup") Integer loadOnStartup,
+                                     @ParamAttribute(name = "servletMappings") Set<String> servletMappings,
+                                     @ParamAttribute(name = "runAsRole") String runAsRole,
+                                     @ParamReference(name = "WebServiceContainerFactory") WebServiceContainerFactory webServiceContainerFactory,
+                                     @ParamReference(name = "JettyServletRegistration", namingType = NameFactory.WEB_MODULE) JettyServletRegistration context) throws Exception {
+        servletHolder = new GeronimoServletHolder(context == null ? null : context.getIntegrationContext(), context);
+        //context will be null only for use as "default servlet info holder" in deployer.
+
+        this.pojoClassName = pojoClassName;
+        this.context = context;
+        this.webServiceContainer = webServiceContainerFactory == null ? null : webServiceContainerFactory.getWebServiceContainer();
+        this.servletMappings = servletMappings;
+        if (context != null) {
+            servletHolder.setName(servletName);
+            servletHolder.setClassName(POJOWebServiceServlet.class.getName());
+            servletHolder.getRegistration().setRunAsRole(runAsRole);
+            servletHolder.setInitParameters(initParams);
+            if (loadOnStartup != null) {
+                servletHolder.setInitOrder(loadOnStartup);
+            }
+        }
+    }
+
+    //todo how do we stop/destroy the servlet?
+    //todo is start called twice???
+
+    public String getServletName() {
+        return servletHolder.getName();
+    }
+
+    public void doStart() throws Exception {
+        if (context != null) {
+            Class pojoClass = context.getWebClassLoader().loadClass(pojoClassName);
+
+            /* DMB: Hack! I really just want to override initServlet and give a reference of the WebServiceContainer to the servlet before we call init on it.
+             * But this will have to do instead....
+             */
+            ServletContext servletContext = this.context.getServletHandler().getServletContext();
+
+            // Make up an ID for the WebServiceContainer
+            // 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();
+            servletHolder.setInitParameter(WebServiceContainerInvoker.WEBSERVICE_CONTAINER, webServicecontainerID);
+            servletContext.setAttribute(webServicecontainerID, webServiceContainer);
+
+            // Same for the POJO Class
+            String pojoClassID = getServletName() + POJOWebServiceServlet.POJO_CLASS + pojoClass.hashCode();
+            servletHolder.setInitParameter(POJOWebServiceServlet.POJO_CLASS, pojoClassID);
+            servletContext.setAttribute(pojoClassID, pojoClass);
+
+            //this now starts the servlet in the appropriate context
+            //TODO check that we should not call this a servlet for jsr-77 benefit.
+            context.registerServletHolder(servletHolder, getServletName(), this.servletMappings, null);
+            servletHolder.start();
+        }
+    }
+
+    public void doStop() throws Exception {
+        servletHolder.stop();
+    }
+
+    public void doFail() {
+        try {
+            servletHolder.stop();
+        } catch (Exception e) {
+            //ignore ??
+        }
+    }
+
+}

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

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

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

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/PreHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/PreHandler.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/PreHandler.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/PreHandler.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,27 @@
+/**
+ *  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 org.eclipse.jetty.server.Handler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface PreHandler extends Handler {
+    void setNextHandler(Handler next);
+}

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

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

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

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/PreHandlerFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/PreHandlerFactory.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/PreHandlerFactory.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/PreHandlerFactory.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,26 @@
+/**
+ *  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;
+
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PreHandlerFactory {
+    PreHandler createHandler();
+}

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

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

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

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/ServletHolderWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/ServletHolderWrapper.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/ServletHolderWrapper.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/ServletHolderWrapper.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,131 @@
+/**
+ *  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.util.Map;
+import java.util.Set;
+
+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.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.management.Servlet;
+import org.eclipse.jetty.servlet.ServletHolder;
+
+
+/**
+ * This ServletHolder's sole purpose is to provide the thread's current
+ * ServletHolder for realms that are interested in the current servlet, e.g.
+ * current servlet name.
+ * <p/>
+ * It is also being our servlet gbean for now.  We could gbean-ize the superclass to avoid the thread local access.
+ *
+ * @version $Rev$ $Date$
+ */
+
+@GBean(j2eeType = NameFactory.SERVLET)
+public class ServletHolderWrapper implements ServletNameSource, Servlet, GBeanLifecycle {
+
+
+    private final JettyServletRegistration servletRegistration;
+    private final ServletHolder servletHolder;
+    private final String objectName;
+
+    //todo consider interface instead of this constructor for endpoint use.
+    public ServletHolderWrapper() {
+        servletRegistration = null;
+        servletHolder = null;
+        objectName = null;
+    }
+
+    public ServletHolderWrapper(@ParamSpecial(type = SpecialAttributeType.objectName) String objectName,
+                              @ParamAttribute(name = "servletName") String servletName,
+                              @ParamAttribute(name = "servletClass") String servletClassName,
+                              @ParamAttribute(name = "jspFile") String jspFile,
+                              @ParamAttribute(name = "initParams") Map initParams,
+                              @ParamAttribute(name = "loadOnStartup") Integer loadOnStartup,
+                              @ParamAttribute(name = "servletMappings") Set<String> servletMappings,
+                              @ParamAttribute(name = "runAsRole") String runAsRole,
+                              @ParamReference(name = "JettyServletRegistration", namingType = NameFactory.WEB_MODULE) JettyServletRegistration context) throws Exception {
+        servletRegistration = context;
+        servletHolder = new GeronimoServletHolder(context == null ? null : context.getIntegrationContext(), servletRegistration);
+        servletHolder.setName(servletName);
+        servletHolder.setClassName(servletClassName);
+        servletHolder.getRegistration().setRunAsRole(runAsRole);
+        //context will be null only for use as "default servlet info holder" in deployer.
+
+        if (context != null) {
+            servletHolder.setInitParameters(initParams);
+            servletHolder.setForcedPath(jspFile);
+            if (loadOnStartup != null) {
+                //This has no effect on the actual start order, the gbean references "previous" control that.
+                servletHolder.setInitOrder(loadOnStartup);
+            }
+            //this now starts the servlet in the appropriate context
+            context.registerServletHolder(servletHolder, servletName, servletMappings, objectName);
+        }
+        this.objectName = objectName;
+    }
+
+    public String getServletName() {
+        return servletHolder.getName();
+    }
+
+    public String getServletClassName() {
+        return servletHolder.getClassName();
+    }
+
+    public String getObjectName() {
+        return objectName;
+    }
+
+    public boolean isStateManageable() {
+        return false;
+    }
+
+    public boolean isStatisticsProvider() {
+        return false;
+    }
+
+    public boolean isEventProvider() {
+        return false;
+    }
+
+    public void doStart() throws Exception {
+        //start actually handled in constructor
+//        servletHolder.start();
+    }
+
+    public void doStop() throws Exception {
+        servletHolder.stop();
+        if (servletRegistration != null) {
+            servletRegistration.unregisterServletHolder(servletHolder, servletHolder.getName(), null, objectName);
+        }
+    }
+
+    public void doFail() {
+        try {
+            doStop();
+        } catch (Exception e) {
+            //?? ignore
+        }
+    }
+
+}

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

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

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

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/ServletNameSource.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/ServletNameSource.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/ServletNameSource.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/ServletNameSource.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface ServletNameSource {
+    String getServletName();
+}

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

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

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

Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/SessionHandlerFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/SessionHandlerFactory.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/SessionHandlerFactory.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/SessionHandlerFactory.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,27 @@
+/**
+ *  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 org.eclipse.jetty.server.session.SessionHandler;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SessionHandlerFactory {
+    SessionHandler createHandler(PreHandler preHandler);
+}

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

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

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



Mime
View raw message