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>
----
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
{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]]
=== Running a project in-place

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

@ -49,8 +49,8 @@ public interface ConfigurableEmbeddedServletContainer {
void setPort(int port);
/**
* The session timeout in seconds (default 30). If 0 or negative then sessions never
* expire.
* The session timeout in seconds (default 30 minutes). If 0 or negative then sessions
* never expire.
* @param sessionTimeout the session timeout
*/
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.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SessionManager;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.handler.ErrorHandler;
import org.eclipse.jetty.servlet.ErrorPageErrorHandler;
@ -237,13 +238,13 @@ public class JettyEmbeddedServletContainerFactory extends
.getClassLoader())) {
addJspServlet(context);
}
ServletContextInitializer[] initializersToUse = mergeInitializers(initializers);
Configuration[] configurations = getWebAppContextConfigurations(context,
initializersToUse);
context.setConfigurations(configurations);
context.getSessionHandler().getSessionManager()
.setMaxInactiveInterval(getSessionTimeout());
int sessionTimeout = (getSessionTimeout() > 0 ? getSessionTimeout() : -1);
SessionManager sessionManager = context.getSessionHandler().getSessionManager();
sessionManager.setMaxInactiveInterval(sessionTimeout);
postProcessWebAppContext(context);
}

@ -343,12 +343,12 @@ public class TomcatEmbeddedServletContainerFactory extends
for (MimeMappings.Mapping mapping : getMimeMappings()) {
context.addMimeMapping(mapping.getExtension(), mapping.getMimeType());
}
long timeout = getSessionTimeout();
if (timeout > 0) {
long sessionTimeout = getSessionTimeout();
if (sessionTimeout > 0) {
// 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) {
customizer.customize(context);
}

Loading…
Cancel
Save