Avoid adding Jetty's upgrade filter to non-Jetty servers
Fixes gh-38181
This commit is contained in:
@@ -108,7 +108,7 @@ class WebSocketServletAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
@Servlet5ClassPathOverrides
|
||||
void jettyWebSocketUpgradeFilterIsAddedToServletContext() {
|
||||
void jettyWebSocketUpgradeFilterIsAddedToServletContextOfJettyServer() {
|
||||
try (AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext(
|
||||
JettyConfiguration.class, WebSocketServletAutoConfiguration.JettyWebSocketConfiguration.class)) {
|
||||
assertThat(context.getServletContext().getFilterRegistration(WebSocketUpgradeFilter.class.getName()))
|
||||
@@ -116,6 +116,15 @@ class WebSocketServletAutoConfigurationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void jettyWebSocketUpgradeFilterIsNotAddedToServletContextOfTomcatServer() {
|
||||
try (AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext(
|
||||
TomcatConfiguration.class, WebSocketServletAutoConfiguration.JettyWebSocketConfiguration.class)) {
|
||||
assertThat(context.getServletContext().getFilterRegistration(WebSocketUpgradeFilter.class.getName()))
|
||||
.isNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
void jettyWebSocketUpgradeFilterIsNotExposedAsABean() {
|
||||
|
||||
Reference in New Issue
Block a user