Issue #3698 - Updating javadoc on .initialize() method purpose/meaning

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2019-06-14 08:37:01 -05:00
parent 49ee5ac3c0
commit 8c0f889abd
3 changed files with 32 additions and 10 deletions

View File

@ -170,7 +170,15 @@ public class WebSocketServerContainerInitializer implements ServletContainerInit
* Immediately initialize the {@link ServletContext} with the default (and empty) {@link ServerContainer}.
*
* <p>
* This performs a subset of the behaviors that {@link #onStartup(Set, ServletContext)} does.
* This method is typically called from {@link #onStartup(Set, ServletContext)} itself or from
* another dependent {@link ServletContainerInitializer} that requires minimal setup to
* be performed.
* </p>
* <p>
* This method SHOULD NOT BE CALLED by users of Jetty.
* Use the {@link #configure(ServletContextHandler, Configurator)} method instead.
* </p>
* <p>
* There is no enablement check here, and no automatic deployment of endpoints at this point
* in time. It merely sets up the {@link ServletContext} so with the basics needed to start
* configuring for `javax.websocket.server` based endpoints.
@ -208,7 +216,7 @@ public class WebSocketServerContainerInitializer implements ServletContainerInit
// Create Filter
if (isEnabledViaContext(context.getServletContext(), ADD_DYNAMIC_FILTER_KEY, true))
{
WebSocketUpgradeFilter.initialize(context);
WebSocketUpgradeFilter.configure(context);
}
}
return serverContainer;

View File

@ -38,8 +38,17 @@ public class NativeWebSocketServletContainerInitializer implements ServletContai
* Immediately initialize the {@link ServletContextHandler} with the default {@link NativeWebSocketConfiguration}.
*
* <p>
* This will return the default {@link NativeWebSocketConfiguration} if already initialized,
* and not create a new {@link NativeWebSocketConfiguration} each time it is called.
* This method is typically called from {@link #onStartup(Set, ServletContext)} itself or from
* another dependent {@link ServletContainerInitializer} that requires minimal setup to
* be performed.
* </p>
* <p>
* This method SHOULD NOT BE CALLED by users of Jetty.
* Use the {@link #configure(ServletContextHandler, Configurator)} method instead.
* </p>
* <p>
* This will return the default {@link NativeWebSocketConfiguration} if already initialized,
* and not create a new {@link NativeWebSocketConfiguration} each time it is called.
* </p>
*
* @param context the context to work with

View File

@ -55,17 +55,22 @@ public class WebSocketUpgradeFilter implements Filter, MappedWebSocketCreator, D
public static final String ATTR_KEY = WebSocketUpgradeFilter.class.getName();
/**
* Immediately initialize the default WebSocketUpgradeFilter.
* Configure the default WebSocketUpgradeFilter.
*
* <p>
* Return default {@link WebSocketUpgradeFilter} if
* This will return the default {@link WebSocketUpgradeFilter} on the
* provided {@link ServletContextHandler}, creating the filter if necessary.
* </p>
* <p>
* The default {@link WebSocketUpgradeFilter} is also available via
* the {@link ServletContext} attribute named {@code org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter}
* </p>
*
* @param context the {@link ServletContextHandler} to use
* @return the configured default {@link WebSocketUpgradeFilter} instance
* @throws ServletException if the filer cannot be configured
*/
public static WebSocketUpgradeFilter initialize(ServletContextHandler context) throws ServletException
public static WebSocketUpgradeFilter configure(ServletContextHandler context) throws ServletException
{
// Prevent double configure
WebSocketUpgradeFilter filter = (WebSocketUpgradeFilter) context.getAttribute(ATTR_KEY);
@ -100,12 +105,12 @@ public class WebSocketUpgradeFilter implements Filter, MappedWebSocketCreator, D
* @param context the {@link ServletContextHandler} to use
* @return a configured {@link WebSocketUpgradeFilter} instance
* @throws ServletException if the filer cannot be configured
* @deprecated use {@link #initialize(ServletContextHandler)} instead
* @deprecated use {@link #configure(ServletContextHandler)} instead
*/
@Deprecated
public static WebSocketUpgradeFilter configureContext(ServletContextHandler context) throws ServletException
{
return initialize(context);
return configure(context);
}
/**
@ -122,7 +127,7 @@ public class WebSocketUpgradeFilter implements Filter, MappedWebSocketCreator, D
{
throw new ServletException("Not running on Jetty, WebSocket support unavailable");
}
return initialize(handler);
return configure(handler);
}
private NativeWebSocketConfiguration configuration;