Merge pull request #5406 from eclipse/jetty-10.0.x-WebSocketSCI

throw ISE if the WebSocketSCI configure() is called on a started ServletContextHandler
This commit is contained in:
Lachlan 2020-10-16 17:13:19 +11:00 committed by GitHub
commit 681f46bd2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -99,6 +99,9 @@ public class JavaxWebSocketServletContainerInitializer implements ServletContain
*/
public static void configure(ServletContextHandler context, Configurator configurator)
{
if (!context.isStopped())
throw new IllegalStateException("configure should be called before starting");
// In this embedded-jetty usage, allow ServletContext.addListener() to
// add other ServletContextListeners (such as the ContextDestroyListener) after
// the initialization phase is over. (important for this SCI to function)

View File

@ -53,6 +53,9 @@ public class JettyWebSocketServletContainerInitializer implements ServletContain
*/
public static void configure(ServletContextHandler context, Configurator configurator)
{
if (!context.isStopped())
throw new IllegalStateException("configure should be called before starting");
context.addEventListener(
ContainerInitializer
.asContextListener(new JettyWebSocketServletContainerInitializer())