Merge branch '1.1.x'

Conflicts:
	spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java
pull/2090/merge
Phillip Webb 10 years ago
commit 083f9757cd

@ -154,6 +154,9 @@ need to mark the embedded container dependencies as "`provided`", e.g:
</project> </project>
---- ----
TIP: See the "`<<howto-create-a-deployable-war-file>>`" section for more details on
how to create a deployable war file.
Advanced configuration options and examples are available in the Advanced configuration options and examples are available in the
{spring-boot-maven-plugin-site}/[plugin info page]. {spring-boot-maven-plugin-site}/[plugin info page].
@ -359,6 +362,10 @@ named "`providedRuntime`", e.g:
} }
---- ----
TIP: See the "`<<howto-create-a-deployable-war-file>>`" section for more details on
how to create a deployable war file.
[[build-tool-plugins-gradle-running-applications]] [[build-tool-plugins-gradle-running-applications]]
=== Running a project in-place === Running a project in-place

@ -37,6 +37,9 @@ import org.springframework.util.Assert;
public abstract class AbstractConfigurableEmbeddedServletContainer implements public abstract class AbstractConfigurableEmbeddedServletContainer implements
ConfigurableEmbeddedServletContainer { ConfigurableEmbeddedServletContainer {
private static final int DEFAULT_SESSION_TIMEOUT = (int) TimeUnit.SECONDS
.toMinutes(30);
private String contextPath = ""; private String contextPath = "";
private boolean registerDefaultServlet = true; private boolean registerDefaultServlet = true;
@ -57,7 +60,7 @@ public abstract class AbstractConfigurableEmbeddedServletContainer implements
private InetAddress address; private InetAddress address;
private int sessionTimeout; private int sessionTimeout = DEFAULT_SESSION_TIMEOUT;
private Ssl ssl; private Ssl ssl;

@ -49,8 +49,8 @@ public interface ConfigurableEmbeddedServletContainer {
void setPort(int port); void setPort(int port);
/** /**
* The session timeout in seconds (default 30). If 0 or negative then sessions never * The session timeout in seconds (default 30 minutes). If 0 or negative then sessions
* expire. * never expire.
* @param sessionTimeout the session timeout * @param sessionTimeout the session timeout
*/ */
void setSessionTimeout(int sessionTimeout); void setSessionTimeout(int sessionTimeout);

@ -32,6 +32,7 @@ import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SessionManager;
import org.eclipse.jetty.server.SslConnectionFactory; import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.handler.ErrorHandler; import org.eclipse.jetty.server.handler.ErrorHandler;
import org.eclipse.jetty.servlet.ErrorPageErrorHandler; import org.eclipse.jetty.servlet.ErrorPageErrorHandler;
@ -237,13 +238,13 @@ public class JettyEmbeddedServletContainerFactory extends
.getClassLoader())) { .getClassLoader())) {
addJspServlet(context); addJspServlet(context);
} }
ServletContextInitializer[] initializersToUse = mergeInitializers(initializers); ServletContextInitializer[] initializersToUse = mergeInitializers(initializers);
Configuration[] configurations = getWebAppContextConfigurations(context, Configuration[] configurations = getWebAppContextConfigurations(context,
initializersToUse); initializersToUse);
context.setConfigurations(configurations); context.setConfigurations(configurations);
context.getSessionHandler().getSessionManager() int sessionTimeout = (getSessionTimeout() > 0 ? getSessionTimeout() : -1);
.setMaxInactiveInterval(getSessionTimeout()); SessionManager sessionManager = context.getSessionHandler().getSessionManager();
sessionManager.setMaxInactiveInterval(sessionTimeout);
postProcessWebAppContext(context); postProcessWebAppContext(context);
} }

@ -343,12 +343,12 @@ public class TomcatEmbeddedServletContainerFactory extends
for (MimeMappings.Mapping mapping : getMimeMappings()) { for (MimeMappings.Mapping mapping : getMimeMappings()) {
context.addMimeMapping(mapping.getExtension(), mapping.getMimeType()); context.addMimeMapping(mapping.getExtension(), mapping.getMimeType());
} }
long timeout = getSessionTimeout(); long sessionTimeout = getSessionTimeout();
if (timeout > 0) { if (sessionTimeout > 0) {
// Tomcat timeouts are in minutes // Tomcat timeouts are in minutes
timeout = Math.max(TimeUnit.SECONDS.toMinutes(timeout), 1L); sessionTimeout = Math.max(TimeUnit.SECONDS.toMinutes(sessionTimeout), 1L);
} }
context.setSessionTimeout((int) timeout); context.setSessionTimeout((int) sessionTimeout);
for (TomcatContextCustomizer customizer : this.tomcatContextCustomizers) { for (TomcatContextCustomizer customizer : this.tomcatContextCustomizers) {
customizer.customize(context); customizer.customize(context);
} }

Loading…
Cancel
Save