Ensure undertow session cookie path is correct
Explicitly set a ServletSessionConfig when the context path is "". This is a workaround for UNDERTOW-350 to ensure that the session cookie path is correctly set. Fixes gh-2065
This commit is contained in:
parent
e641b47b66
commit
78c22813d3
|
@ -31,6 +31,7 @@ import io.undertow.servlet.api.DeploymentInfo;
|
||||||
import io.undertow.servlet.api.DeploymentManager;
|
import io.undertow.servlet.api.DeploymentManager;
|
||||||
import io.undertow.servlet.api.ListenerInfo;
|
import io.undertow.servlet.api.ListenerInfo;
|
||||||
import io.undertow.servlet.api.MimeMapping;
|
import io.undertow.servlet.api.MimeMapping;
|
||||||
|
import io.undertow.servlet.api.ServletSessionConfig;
|
||||||
import io.undertow.servlet.api.ServletStackTraces;
|
import io.undertow.servlet.api.ServletStackTraces;
|
||||||
import io.undertow.servlet.handlers.DefaultServlet;
|
import io.undertow.servlet.handlers.DefaultServlet;
|
||||||
import io.undertow.servlet.util.ImmediateInstanceFactory;
|
import io.undertow.servlet.util.ImmediateInstanceFactory;
|
||||||
|
@ -68,6 +69,7 @@ import org.springframework.core.io.ResourceLoader;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ResourceUtils;
|
import org.springframework.util.ResourceUtils;
|
||||||
import org.springframework.util.SocketUtils;
|
import org.springframework.util.SocketUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
import org.xnio.Options;
|
import org.xnio.Options;
|
||||||
import org.xnio.SslClientAuthMode;
|
import org.xnio.SslClientAuthMode;
|
||||||
|
|
||||||
|
@ -329,6 +331,12 @@ public class UndertowEmbeddedServletContainerFactory extends
|
||||||
deployment.setServletStackTraces(ServletStackTraces.NONE);
|
deployment.setServletStackTraces(ServletStackTraces.NONE);
|
||||||
deployment.setResourceManager(getDocumentRootResourceManager());
|
deployment.setResourceManager(getDocumentRootResourceManager());
|
||||||
configureMimeMappings(deployment);
|
configureMimeMappings(deployment);
|
||||||
|
if (StringUtils.isEmpty(getContextPath())) {
|
||||||
|
// Work around UNDERTOW-350
|
||||||
|
ServletSessionConfig servletSessionConfig = new ServletSessionConfig();
|
||||||
|
servletSessionConfig.setPath("/");
|
||||||
|
deployment.setServletSessionConfig(servletSessionConfig);
|
||||||
|
}
|
||||||
for (UndertowDeploymentInfoCustomizer customizer : this.deploymentInfoCustomizers) {
|
for (UndertowDeploymentInfoCustomizer customizer : this.deploymentInfoCustomizers) {
|
||||||
customizer.customize(deployment);
|
customizer.customize(deployment);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue