You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2010/09/30 19:05:55 UTC
svn commit: r1003167 - in /geronimo/server/trunk/plugins:
j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/
j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/
jetty8/geronimo-jetty8-builder/src/main/java/org/a...
Author: djencks
Date: Thu Sep 30 17:05:55 2010
New Revision: 1003167
URL: http://svn.apache.org/viewvc?rev=1003167&view=rev
Log:
GERONIMO-5624 add more goo to WebAppInfo, use in jetty
Added:
geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionConfigInfo.java
geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionCookieConfigInfo.java
Modified:
geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java
geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/WebAppInfo.java
geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/builder/WADIJettyClusteringBuilder.java
geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/WebAppContextWrapper.java
geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java
geronimo/server/trunk/plugins/jetty8/jetty8-clustering-wadi/src/main/history/dependencies.xml
geronimo/server/trunk/plugins/jetty8/jetty8-deployer/src/main/history/dependencies.xml
geronimo/server/trunk/plugins/jetty8/jetty8/src/main/history/dependencies.xml
Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java?rev=1003167&r1=1003166&r2=1003167&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/WebAppInfoBuilder.java Thu Sep 30 17:05:55 2010
@@ -28,6 +28,7 @@ import java.util.List;
import java.util.Map;
import javax.servlet.DispatcherType;
+import javax.servlet.SessionTrackingMode;
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.web.info.AuthConstraintInfo;
import org.apache.geronimo.web.info.ErrorPageInfo;
@@ -38,9 +39,12 @@ import org.apache.geronimo.web.info.Mult
import org.apache.geronimo.web.info.SecurityConstraintInfo;
import org.apache.geronimo.web.info.SecurityRoleRefInfo;
import org.apache.geronimo.web.info.ServletInfo;
+import org.apache.geronimo.web.info.SessionConfigInfo;
+import org.apache.geronimo.web.info.SessionCookieConfigInfo;
import org.apache.geronimo.web.info.WebAppInfo;
import org.apache.geronimo.web.info.WebResourceCollectionInfo;
import org.apache.openejb.jee.Dispatcher;
+import org.apache.openejb.jee.Empty;
import org.apache.openejb.jee.ErrorPage;
import org.apache.openejb.jee.Filter;
import org.apache.openejb.jee.FilterMapping;
@@ -56,6 +60,8 @@ import org.apache.openejb.jee.SecurityRo
import org.apache.openejb.jee.SecurityRoleRef;
import org.apache.openejb.jee.Servlet;
import org.apache.openejb.jee.ServletMapping;
+import org.apache.openejb.jee.SessionConfig;
+import org.apache.openejb.jee.TrackingMode;
import org.apache.openejb.jee.WebApp;
import org.apache.openejb.jee.WebResourceCollection;
import org.apache.openejb.jee.WelcomeFileList;
@@ -82,62 +88,23 @@ public class WebAppInfoBuilder {
}
List<String> problems = new ArrayList<String>();
WebAppInfo webAppInfo = webAppInfoFactory.newWebAppInfo();
+
addParams(webApp.getContextParam(), webAppInfo.contextParams);
+
webAppInfo.contextRoot = webApp.getContextRoot();
- for (Listener listener : webApp.getListener()) {
- webAppInfo.listeners.add(listener.getListenerClass());
- }
+ webAppInfo.displayName = webApp.getDisplayName();
- Map<String, ServletInfo> servletMap = new HashMap<String, ServletInfo>();
- for (Servlet servlet : webApp.getServlet()) {
- ServletInfo servletInfo;
- if (servlet.getServletClass() != null) {
- servletInfo = webAppInfoFactory.newServletInfo();
- servletInfo.servletClass = servlet.getServletClass();
- } else if (servlet.getJspFile() != null) {
- servletInfo = webAppInfoFactory.newJspInfo(servlet.getJspFile());
- } else {
- problems.add("\nNo servlet class or jsp file for servlet " + servlet.getServletName());
- continue;
- }
- servletInfo.servletName = servlet.getServletName();
- if (servlet.getAsyncSupported() != null) {
- servletInfo.asyncSupported = servlet.getAsyncSupported();
- }
- servletInfo.loadOnStartup = servlet.getLoadOnStartup();
- if (servlet.getRunAs() != null) {
- servletInfo.runAsRole = servlet.getRunAs().getRoleName().trim();
- }
- if (servlet.getMultipartConfig() != null) {
- MultipartConfig multipartConfig = servlet.getMultipartConfig();
- MultipartConfigInfo multipartConfigInfo = new MultipartConfigInfo();
- multipartConfigInfo.location = multipartConfig.getLocation();
- multipartConfigInfo.maxFileSize = multipartConfig.getMaxFileSize();
- multipartConfigInfo.maxRequestSize = multipartConfig.getMaxRequestSize();
- multipartConfigInfo.fileSizeThreshold = multipartConfig.getFileSizeThreshold();
- servletInfo.multipartConfigInfo = multipartConfigInfo;
- }
- addParams(servlet.getInitParam(), servletInfo.initParams);
- for (SecurityRoleRef securityRoleRef : servlet.getSecurityRoleRef()) {
- SecurityRoleRefInfo securityRoleRefInfo = new SecurityRoleRefInfo();
- if (securityRoleRef.getRoleLink() != null) {
- securityRoleRefInfo.roleLink = securityRoleRef.getRoleLink().trim();
- }
- securityRoleRefInfo.roleName = securityRoleRef.getRoleName().trim();
- servletInfo.securityRoleRefs.add(securityRoleRefInfo);
- }
- webAppInfo.servlets.add(servletInfo);
- servletMap.put(servletInfo.servletName, servletInfo);
- }
- for (ServletMapping servletMapping : webApp.getServletMapping()) {
- String servletName = servletMapping.getServletName().trim();
- ServletInfo servletInfo = servletMap.get(servletName);
- if (servletInfo == null) {
- problems.add("\nNo servlet matching servlet mappings for " + servletName);
- } else {
- normalizeUrlPatterns(servletMapping.getUrlPattern(), servletInfo.servletMappings);
+ webAppInfo.distributable = !webApp.getDistributable().isEmpty();
+
+ for (ErrorPage errorPage: webApp.getErrorPage()) {
+ ErrorPageInfo errorPageInfo = new ErrorPageInfo();
+ errorPageInfo.location = errorPage.getLocation();
+ if (errorPage.getErrorCode() != null) {
+ errorPageInfo.errorCode = errorPage.getErrorCode().intValue();
}
+ errorPageInfo.exceptionType = errorPage.getExceptionType();
+ webAppInfo.errorPages.add(errorPageInfo);
}
Map<String, FilterInfo> filterMap = new HashMap<String, FilterInfo>();
@@ -171,16 +138,8 @@ public class WebAppInfoBuilder {
}
}
- webAppInfo.displayName = webApp.getDisplayName();
-
- for (ErrorPage errorPage: webApp.getErrorPage()) {
- ErrorPageInfo errorPageInfo = new ErrorPageInfo();
- errorPageInfo.location = errorPage.getLocation();
- if (errorPage.getErrorCode() != null) {
- errorPageInfo.errorCode = errorPage.getErrorCode().intValue();
- }
- errorPageInfo.exceptionType = errorPage.getExceptionType();
- webAppInfo.errorPages.add(errorPageInfo);
+ for (Listener listener : webApp.getListener()) {
+ webAppInfo.listeners.add(listener.getListenerClass());
}
for (LocaleEncodingMappingList localeEncodingMappingList: webApp.getLocaleEncodingMappingList()) {
@@ -188,13 +147,6 @@ public class WebAppInfoBuilder {
webAppInfo.localeEncodingMappings.put(localeEncodingMapping.getLocale(), localeEncodingMapping.getEncoding());
}
}
- for (MimeMapping mimeMapping: webApp.getMimeMapping()) {
- webAppInfo.mimeMappings.put(mimeMapping.getExtension(), mimeMapping.getMimeType());
- }
-
- for (WelcomeFileList welcomeFileList: webApp.getWelcomeFileList()) {
- webAppInfo.welcomeFiles.addAll(welcomeFileList.getWelcomeFile());
- }
for (LoginConfig loginConfig: webApp.getLoginConfig()) {
LoginConfigInfo loginConfigInfo = new LoginConfigInfo();
@@ -208,6 +160,10 @@ public class WebAppInfoBuilder {
break;
}
+ for (MimeMapping mimeMapping: webApp.getMimeMapping()) {
+ webAppInfo.mimeMappings.put(mimeMapping.getExtension(), mimeMapping.getMimeType());
+ }
+
for (SecurityConstraint securityConstraint : webApp.getSecurityConstraint()) {
SecurityConstraintInfo securityConstraintInfo = webAppInfoFactory.newSecurityConstraintInfo();
if (securityConstraint.getAuthConstraint() != null) {
@@ -237,41 +193,85 @@ public class WebAppInfoBuilder {
webAppInfo.securityRoles.add(securityRole.getRoleName().trim());
}
- webAppInfo.displayName = webApp.getDisplayName();
-
- for (ErrorPage errorPage: webApp.getErrorPage()) {
- ErrorPageInfo errorPageInfo = new ErrorPageInfo();
- errorPageInfo.location = errorPage.getLocation();
- if (errorPage.getErrorCode() != null) {
- errorPageInfo.errorCode = errorPage.getErrorCode().intValue();
+ Map<String, ServletInfo> servletMap = new HashMap<String, ServletInfo>();
+ for (Servlet servlet : webApp.getServlet()) {
+ ServletInfo servletInfo;
+ if (servlet.getServletClass() != null) {
+ servletInfo = webAppInfoFactory.newServletInfo();
+ servletInfo.servletClass = servlet.getServletClass();
+ } else if (servlet.getJspFile() != null) {
+ servletInfo = webAppInfoFactory.newJspInfo(servlet.getJspFile());
+ } else {
+ problems.add("\nNo servlet class or jsp file for servlet " + servlet.getServletName());
+ continue;
}
- errorPageInfo.exceptionType = errorPage.getExceptionType();
- webAppInfo.errorPages.add(errorPageInfo);
+ servletInfo.servletName = servlet.getServletName();
+ if (servlet.getAsyncSupported() != null) {
+ servletInfo.asyncSupported = servlet.getAsyncSupported();
+ }
+ servletInfo.loadOnStartup = servlet.getLoadOnStartup();
+ if (servlet.getRunAs() != null) {
+ servletInfo.runAsRole = servlet.getRunAs().getRoleName().trim();
+ }
+ if (servlet.getMultipartConfig() != null) {
+ MultipartConfig multipartConfig = servlet.getMultipartConfig();
+ MultipartConfigInfo multipartConfigInfo = new MultipartConfigInfo();
+ multipartConfigInfo.location = multipartConfig.getLocation();
+ multipartConfigInfo.maxFileSize = multipartConfig.getMaxFileSize();
+ multipartConfigInfo.maxRequestSize = multipartConfig.getMaxRequestSize();
+ multipartConfigInfo.fileSizeThreshold = multipartConfig.getFileSizeThreshold();
+ servletInfo.multipartConfigInfo = multipartConfigInfo;
+ }
+ addParams(servlet.getInitParam(), servletInfo.initParams);
+ for (SecurityRoleRef securityRoleRef : servlet.getSecurityRoleRef()) {
+ SecurityRoleRefInfo securityRoleRefInfo = new SecurityRoleRefInfo();
+ if (securityRoleRef.getRoleLink() != null) {
+ securityRoleRefInfo.roleLink = securityRoleRef.getRoleLink().trim();
+ }
+ securityRoleRefInfo.roleName = securityRoleRef.getRoleName().trim();
+ servletInfo.securityRoleRefs.add(securityRoleRefInfo);
+ }
+ webAppInfo.servlets.add(servletInfo);
+ servletMap.put(servletInfo.servletName, servletInfo);
}
-
- for (LocaleEncodingMappingList localeEncodingMappingList: webApp.getLocaleEncodingMappingList()) {
- for (LocaleEncodingMapping localeEncodingMapping: localeEncodingMappingList.getLocaleEncodingMapping()) {
- webAppInfo.localeEncodingMappings.put(localeEncodingMapping.getLocale(), localeEncodingMapping.getEncoding());
+ for (ServletMapping servletMapping : webApp.getServletMapping()) {
+ String servletName = servletMapping.getServletName().trim();
+ ServletInfo servletInfo = servletMap.get(servletName);
+ if (servletInfo == null) {
+ problems.add("\nNo servlet matching servlet mappings for " + servletName);
+ } else {
+ normalizeUrlPatterns(servletMapping.getUrlPattern(), servletInfo.servletMappings);
}
}
- for (MimeMapping mimeMapping: webApp.getMimeMapping()) {
- webAppInfo.mimeMappings.put(mimeMapping.getExtension(), mimeMapping.getMimeType());
+
+ for (SessionConfig sessionConfig: webApp.getSessionConfig()) {
+ SessionConfigInfo sessionConfigInfo = new SessionConfigInfo();
+ sessionConfigInfo.sessionTimeoutMinutes = sessionConfig.getSessionTimeout() != null? sessionConfig.getSessionTimeout(): -1;
+ List<SessionTrackingMode> modes = new ArrayList<SessionTrackingMode>();
+ for (TrackingMode mode: sessionConfig.getTrackingMode()) {
+ modes.add(SessionTrackingMode.valueOf(mode.value()));
+ }
+ sessionConfigInfo.sessionTrackingModes = modes.isEmpty()? EnumSet.noneOf(SessionTrackingMode.class): EnumSet.copyOf(modes);
+ if (sessionConfig.getCookieConfig() != null) {
+ SessionCookieConfigInfo cookieConfigInfo = new SessionCookieConfigInfo();
+ cookieConfigInfo.name = sessionConfig.getCookieConfig().getName();
+ cookieConfigInfo.domain = sessionConfig.getCookieConfig().getDomain();
+ cookieConfigInfo.comment = sessionConfig.getCookieConfig().getComment();
+ cookieConfigInfo.path = sessionConfig.getCookieConfig().getPath();
+ cookieConfigInfo.httpOnly = sessionConfig.getCookieConfig().getHttpOnly() != null? sessionConfig.getCookieConfig().getHttpOnly(): false;
+ cookieConfigInfo.secure = sessionConfig.getCookieConfig().getSecure() != null? sessionConfig.getCookieConfig().getSecure(): false;
+ cookieConfigInfo.maxAge = sessionConfig.getCookieConfig().getMaxAge() != null? sessionConfig.getCookieConfig().getMaxAge(): -1;
+ sessionConfigInfo.sessionCookieConfig = cookieConfigInfo;
+ }
}
for (WelcomeFileList welcomeFileList: webApp.getWelcomeFileList()) {
webAppInfo.welcomeFiles.addAll(welcomeFileList.getWelcomeFile());
}
- for (LoginConfig loginConfig: webApp.getLoginConfig()) {
- LoginConfigInfo loginConfigInfo = new LoginConfigInfo();
- loginConfigInfo.authMethod = loginConfig.getAuthMethod();
- loginConfigInfo.realmName = loginConfig.getRealmName();
- if (loginConfig.getFormLoginConfig() != null) {
- loginConfigInfo.formLoginPage = loginConfig.getFormLoginConfig().getFormLoginPage();
- loginConfigInfo.formErrorPage = loginConfig.getFormLoginConfig().getFormErrorPage();
- }
- webAppInfo.loginConfig = loginConfigInfo;
- break;
+
+ for (WelcomeFileList welcomeFileList: webApp.getWelcomeFileList()) {
+ webAppInfo.welcomeFiles.addAll(welcomeFileList.getWelcomeFile());
}
webAppInfoFactory.complete(webAppInfo);
Added: geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionConfigInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionConfigInfo.java?rev=1003167&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionConfigInfo.java (added)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionConfigInfo.java Thu Sep 30 17:05:55 2010
@@ -0,0 +1,36 @@
+/*
+ * 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.web.info;
+
+import java.util.EnumSet;
+
+import javax.servlet.SessionTrackingMode;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class SessionConfigInfo {
+
+ public int sessionTimeoutMinutes;
+ public SessionCookieConfigInfo sessionCookieConfig;
+ public EnumSet<SessionTrackingMode> sessionTrackingModes;
+
+}
Added: geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionCookieConfigInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionCookieConfigInfo.java?rev=1003167&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionCookieConfigInfo.java (added)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/SessionCookieConfigInfo.java Thu Sep 30 17:05:55 2010
@@ -0,0 +1,35 @@
+/*
+ * 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.web.info;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class SessionCookieConfigInfo {
+
+ public String name;
+ public String comment;
+ public String domain;
+ public String path;
+ public boolean httpOnly;
+ public boolean secure;
+ public int maxAge;
+}
Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/WebAppInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/WebAppInfo.java?rev=1003167&r1=1003166&r2=1003167&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/WebAppInfo.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web/src/main/java/org/apache/geronimo/web/info/WebAppInfo.java Thu Sep 30 17:05:55 2010
@@ -47,4 +47,6 @@ public class WebAppInfo implements Seria
public final List<String> welcomeFiles = new ArrayList<String>();
public String displayName;
public LoginConfigInfo loginConfig;
+ public boolean distributable;
+ public SessionConfigInfo sessionConfig;
}
Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java?rev=1003167&r1=1003166&r2=1003167&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java Thu Sep 30 17:05:55 2010
@@ -20,14 +20,11 @@ package org.apache.geronimo.jetty8.deplo
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.io.Serializable;
import java.net.URI;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.jar.JarFile;
@@ -100,8 +97,6 @@ import org.apache.geronimo.xbeans.geroni
import org.apache.geronimo.xbeans.geronimo.web.jetty.JettyWebAppType;
import org.apache.geronimo.xbeans.geronimo.web.jetty.config.GerJettyDocument;
import org.apache.openejb.jee.JaxbJavaee;
-import org.apache.openejb.jee.LocaleEncodingMapping;
-import org.apache.openejb.jee.LocaleEncodingMappingList;
import org.apache.openejb.jee.WebApp;
import org.apache.xbean.osgi.bundle.util.BundleUtils;
import org.apache.xmlbeans.XmlException;
@@ -113,9 +108,6 @@ import org.osgi.service.packageadmin.Pac
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static java.lang.Boolean.FALSE;
-import static java.lang.Boolean.TRUE;
-
/**
* @version $Rev:385659 $ $Date$
*/
@@ -154,7 +146,7 @@ public class JettyModuleBuilder extends
protected final NamespaceDrivenBuilderCollection clusteringBuilders;
- private final Integer defaultSessionTimeoutSeconds;
+ private final Integer defaultSessionTimeoutMinutes;
private static final String JETTY_NAMESPACE = JettyWebAppDocument.type.getDocumentElementName().getNamespaceURI();
@@ -174,7 +166,7 @@ public class JettyModuleBuilder extends
@ParamSpecial(type = SpecialAttributeType.bundleContext) BundleContext bundleContext) throws GBeanNotFoundException, DeploymentException {
super(kernel, serviceBuilders, namingBuilders, resourceEnvironmentSetter, webServiceBuilder, moduleBuilderExtensions, bundleContext);
this.defaultEnvironment = defaultEnvironment;
- this.defaultSessionTimeoutSeconds = (defaultSessionTimeoutSeconds == null) ? 30 * 60 : defaultSessionTimeoutSeconds;
+ this.defaultSessionTimeoutMinutes = (defaultSessionTimeoutSeconds == null) ? 30 * 60 : defaultSessionTimeoutSeconds;
this.jettyContainerObjectName = jettyContainerName;
ServletInfo jspServletInfo;
if (jspServlet != null) {
@@ -503,14 +495,14 @@ public class JettyModuleBuilder extends
webModule.getSharedContext().put(WebModule.WEB_APP_INFO, webAppInfoBuilder);
- webModuleData.setAttribute(WebAppContextWrapper.GBEAN_ATTR_SESSION_TIMEOUT,
- (webApp.getSessionConfig().size() == 1 && webApp.getSessionConfig().get(0).getSessionTimeout() != null) ?
- webApp.getSessionConfig().get(0).getSessionTimeout().intValue() * 60 :
- defaultSessionTimeoutSeconds);
-
- Boolean distributable = webApp.getDistributable().size() == 1 ? TRUE : FALSE;
- webModuleData.setAttribute("distributable", distributable);
- if (TRUE == distributable) {
+ //TODO merge from default web app
+ if (webAppInfo.sessionConfig != null) {
+ if (webAppInfo.sessionConfig.sessionTimeoutMinutes == -1 && defaultSessionTimeoutMinutes != -1) {
+ webAppInfo.sessionConfig.sessionTimeoutMinutes = defaultSessionTimeoutMinutes;
+ }
+ }
+
+ if (webAppInfo.distributable) {
clusteringBuilders.build(jettyWebApp, earContext, moduleContext);
if (webModuleData.getReferencePatterns(WebAppContextWrapper.GBEAN_REF_SESSION_HANDLER_FACTORY) == null) {
log.warn("No clustering builders configured: app will not be clustered");
Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/builder/WADIJettyClusteringBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/builder/WADIJettyClusteringBuilder.java?rev=1003167&r1=1003166&r2=1003167&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/builder/WADIJettyClusteringBuilder.java (original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/builder/WADIJettyClusteringBuilder.java Thu Sep 30 17:05:55 2010
@@ -202,6 +202,7 @@ public class WADIJettyClusteringBuilder
}
protected Integer getSessionTimeout(GBeanData webModuleData) throws AssertionError {
+ //TODO this will no longer work, use WebAppInfo
Integer sessionTimeout = (Integer) webModuleData.getAttribute(WebAppContextWrapper.GBEAN_ATTR_SESSION_TIMEOUT);
if (null == sessionTimeout) {
throw new AssertionError();
Modified: 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=1003167&r1=1003166&r2=1003167&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/WebAppContextWrapper.java (original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/WebAppContextWrapper.java Thu Sep 30 17:05:55 2010
@@ -27,6 +27,7 @@ import javax.management.MalformedObjectN
import javax.management.ObjectName;
import javax.naming.Context;
import javax.security.auth.Subject;
+import javax.servlet.SessionCookieConfig;
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;
@@ -58,6 +59,7 @@ import org.apache.geronimo.web.info.Erro
import org.apache.geronimo.web.info.WebAppInfo;
import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.security.SecurityHandler;
+import org.eclipse.jetty.server.SessionManager;
import org.eclipse.jetty.server.session.SessionHandler;
import org.eclipse.jetty.servlet.ErrorPageErrorHandler;
import org.eclipse.jetty.servlet.ServletHandler;
@@ -86,7 +88,7 @@ public class WebAppContextWrapper implem
private final ClassLoader webClassLoader;
private final JettyContainer jettyContainer;
- private String displayName;
+// private String displayName;
private final String objectName;
private final GeronimoWebAppContext webAppContext;
@@ -104,11 +106,9 @@ public class WebAppContextWrapper implem
@ParamAttribute(name = "workDir") String workDir,
@ParamAttribute(name = "unshareableResources") Set<String> unshareableResources,
@ParamAttribute(name = "applicationManagedSecurityResources") Set<String> applicationManagedSecurityResources,
- @ParamAttribute(name = "distributable") boolean distributable,
@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,
@@ -222,9 +222,9 @@ public class WebAppContextWrapper implem
}
//stuff from spec dd
- setDisplayName(webAppInfo.displayName);
+ webAppContext.setDisplayName(webAppInfo.displayName);
webAppContext.getInitParams().putAll(webAppInfo.contextParams);
- webAppContext.setDistributable(distributable);
+ webAppContext.setDistributable(webAppInfo.distributable);
webAppContext.setWelcomeFiles(webAppInfo.welcomeFiles.toArray(new String[webAppInfo.welcomeFiles.size()]));
for (Map.Entry<String, String> entry : webAppInfo.localeEncodingMappings.entrySet()) {
this.webAppContext.addLocaleEncoding(entry.getKey(), entry.getValue());
@@ -243,8 +243,22 @@ public class WebAppContextWrapper implem
}
}
- if (!distributable) {
- setSessionTimeoutSeconds(sessionTimeoutSeconds);
+ if (!webAppInfo.distributable && webAppInfo.sessionConfig != null) {
+ SessionManager sessionManager = this.webAppContext.getSessionHandler().getSessionManager();
+ if (webAppInfo.sessionConfig.sessionTimeoutMinutes != -1) {
+ sessionManager.setMaxInactiveInterval(webAppInfo.sessionConfig.sessionTimeoutMinutes * 60);
+ }
+ sessionManager.setSessionTrackingModes(webAppInfo.sessionConfig.sessionTrackingModes);
+ if (webAppInfo.sessionConfig.sessionCookieConfig != null) {
+ SessionCookieConfig cookieConfig = sessionManager.getSessionCookieConfig();
+ cookieConfig.setName(webAppInfo.sessionConfig.sessionCookieConfig.name);
+ cookieConfig.setPath(webAppInfo.sessionConfig.sessionCookieConfig.path);
+ cookieConfig.setDomain(webAppInfo.sessionConfig.sessionCookieConfig.domain);
+ cookieConfig.setComment(webAppInfo.sessionConfig.sessionCookieConfig.comment);
+ cookieConfig.setHttpOnly(webAppInfo.sessionConfig.sessionCookieConfig.httpOnly);
+ cookieConfig.setSecure(webAppInfo.sessionConfig.sessionCookieConfig.secure);
+ cookieConfig.setMaxAge(webAppInfo.sessionConfig.sessionCookieConfig.maxAge);
+ }
}
//supply web.xml to jasper
webAppContext.setAttribute(JASPER_WEB_XML_NAME, originalSpecDD);
@@ -316,21 +330,17 @@ public class WebAppContextWrapper implem
log.warn("WebAppContextWrapper failed");
}
- public void setSessionTimeoutSeconds(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;
+ return webAppContext.getDisplayName();
}
- public void setDisplayName(String displayName) {
- this.displayName = displayName;
- this.webAppContext.setDisplayName(displayName);
- }
+// public void setDisplayName(String displayName) {
+// this.displayName = displayName;
+// this.webAppContext.setDisplayName(displayName);
+// }
public String getDeploymentDescriptor() {
return originalSpecDD;
Modified: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java?rev=1003167&r1=1003166&r2=1003167&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java (original)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java Thu Sep 30 17:05:55 2010
@@ -160,10 +160,8 @@ public class AbstractWebModuleTest exten
bundle,
null, null,
null,
- false,
null,
false,
- 0,
sessionHandlerFactory,
preHandlerFactory,
policyContextId,
Modified: geronimo/server/trunk/plugins/jetty8/jetty8-clustering-wadi/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/jetty8-clustering-wadi/src/main/history/dependencies.xml?rev=1003167&r1=1003166&r2=1003167&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/jetty8-clustering-wadi/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/jetty8/jetty8-clustering-wadi/src/main/history/dependencies.xml Thu Sep 30 17:05:55 2010
@@ -7,6 +7,11 @@
<type>car</type>
</module-id>
<dependency>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
<groupId>org.apache.geronimo.bundles</groupId>
<artifactId>castor</artifactId>
<type>jar</type>
@@ -72,6 +77,16 @@
<type>jar</type>
</dependency>
<dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>stax2-api</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>woodstox-core-asl</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jaspi</artifactId>
<type>jar</type>
Modified: geronimo/server/trunk/plugins/jetty8/jetty8-deployer/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/jetty8-deployer/src/main/history/dependencies.xml?rev=1003167&r1=1003166&r2=1003167&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/jetty8-deployer/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/jetty8/jetty8-deployer/src/main/history/dependencies.xml Thu Sep 30 17:05:55 2010
@@ -7,6 +7,11 @@
<type>car</type>
</module-id>
<dependency>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
<groupId>org.apache.geronimo.configs</groupId>
<artifactId>connector-deployer-1_6</artifactId>
<type>car</type>
@@ -26,4 +31,39 @@
<artifactId>geronimo-jetty8-builder</artifactId>
<type>jar</type>
</dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-web</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jacc_1.4_spec</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jaspic_1.0_spec</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-osgi-locator</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-bundleutils</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>stax2-api</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>woodstox-core-asl</artifactId>
+ <type>jar</type>
+ </dependency>
</plugin-artifact>
Modified: geronimo/server/trunk/plugins/jetty8/jetty8/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/jetty8/src/main/history/dependencies.xml?rev=1003167&r1=1003166&r2=1003167&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/jetty8/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/jetty8/jetty8/src/main/history/dependencies.xml Thu Sep 30 17:05:55 2010
@@ -7,6 +7,11 @@
<type>car</type>
</module-id>
<dependency>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
<groupId>org.apache.geronimo.bundles</groupId>
<artifactId>castor</artifactId>
<type>jar</type>
@@ -77,6 +82,16 @@
<type>jar</type>
</dependency>
<dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>stax2-api</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>woodstox-core-asl</artifactId>
+ <type>jar</type>
+ </dependency>
+ <dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-ajp</artifactId>
<type>jar</type>