Fixes #1216 to prevent duplicate SCI initialization of WSUF
This commit is contained in:
parent
9324971d20
commit
0fc897233a
|
@ -145,7 +145,12 @@ public class WebSocketServerContainerInitializer implements ServletContainerInit
|
|||
// Create Filter
|
||||
if(isEnabledViaContext(context.getServletContext(), ADD_DYNAMIC_FILTER_KEY, true))
|
||||
{
|
||||
WebSocketUpgradeFilter.configureContext(context);
|
||||
String instanceKey = WebSocketUpgradeFilter.class.getName() + ".SCI";
|
||||
if(context.getAttribute(instanceKey) == null)
|
||||
{
|
||||
WebSocketUpgradeFilter wsuf = WebSocketUpgradeFilter.configureContext(context);
|
||||
context.setAttribute(instanceKey, wsuf);
|
||||
}
|
||||
}
|
||||
|
||||
return jettyContainer;
|
||||
|
|
|
@ -110,7 +110,6 @@ public class WebSocketUpgradeFilter implements Filter, MappedWebSocketCreator, D
|
|||
}
|
||||
|
||||
private NativeWebSocketConfiguration configuration;
|
||||
private ServletContext context;
|
||||
private String instanceKey;
|
||||
private boolean localConfiguration = false;
|
||||
private boolean alreadySetToAttribute = false;
|
||||
|
@ -149,10 +148,8 @@ public class WebSocketUpgradeFilter implements Filter, MappedWebSocketCreator, D
|
|||
@Override
|
||||
public void destroy()
|
||||
{
|
||||
LOG.info(".destroy()");
|
||||
try
|
||||
{
|
||||
context.setAttribute(instanceKey, null);
|
||||
alreadySetToAttribute = false;
|
||||
if(localConfiguration)
|
||||
{
|
||||
|
@ -290,8 +287,6 @@ public class WebSocketUpgradeFilter implements Filter, MappedWebSocketCreator, D
|
|||
@Override
|
||||
public void init(FilterConfig config) throws ServletException
|
||||
{
|
||||
LOG.info(".init()");
|
||||
|
||||
try
|
||||
{
|
||||
String configurationKey = config.getInitParameter(CONFIG_ATTRIBUTE_KEY);
|
||||
|
@ -356,8 +351,6 @@ public class WebSocketUpgradeFilter implements Filter, MappedWebSocketCreator, D
|
|||
instanceKey = WebSocketUpgradeFilter.class.getName();
|
||||
}
|
||||
|
||||
this.context = config.getServletContext();
|
||||
|
||||
// Set instance of this filter to context attribute
|
||||
setToAttribute(config.getServletContext(), instanceKey);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue