Class WebSocketUpgradeFilter
- java.lang.Object
-
- org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter
-
- All Implemented Interfaces:
Filter,Dumpable,MappedWebSocketCreator
@ManagedObject("WebSocket Upgrade Filter") @Deprecated(since="2021-05-27") public class WebSocketUpgradeFilter extends Object implements Filter, MappedWebSocketCreator, Dumpable
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.Inline Servlet Filter to capture WebSocket upgrade requests and perform path mappings toWebSocketCreatorobjects.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
-
Field Summary
Fields Modifier and Type Field Description static StringATTR_KEYDeprecated.static StringCONFIG_ATTRIBUTE_KEYDeprecated.static StringCONTEXT_ATTRIBUTE_KEYDeprecated.
-
Constructor Summary
Constructors Constructor Description WebSocketUpgradeFilter()Deprecated.WebSocketUpgradeFilter(NativeWebSocketConfiguration configuration)Deprecated.WebSocketUpgradeFilter(WebSocketServerFactory factory)Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddMapping(String spec, WebSocketCreator creator)Deprecated.Add a mapping, of a pathspec to a WebSocketCreator.voidaddMapping(PathSpec spec, WebSocketCreator creator)Deprecated.Add a mapping.voidaddMapping(PathSpec spec, WebSocketCreator creator)Deprecated.static WebSocketUpgradeFilterconfigure(ServletContextHandler context)Deprecated.Configure the default WebSocketUpgradeFilter.static WebSocketUpgradeFilterconfigureContext(ServletContext context)Deprecated.useconfigureContext(ServletContextHandler)insteadstatic WebSocketUpgradeFilterconfigureContext(ServletContextHandler context)Deprecated.useconfigure(ServletContextHandler)insteadvoiddestroy()Deprecated.Called by the web container to indicate to a filter that it is being taken out of service.voiddoFilter(ServletRequest request, ServletResponse response, FilterChain chain)Deprecated.ThedoFiltermethod of the Filter is called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain.Stringdump()Deprecated.voiddump(Appendable out, String indent)Deprecated.Dump this object (and children) into an Appendable using the provided indent after any new lines.NativeWebSocketConfigurationgetConfiguration()Deprecated.WebSocketServletFactorygetFactory()Deprecated.WebSocketCreatorgetMapping(String target)Deprecated./** Returns the creator for the given path spec.voidinit(FilterConfig config)Deprecated.Called by the web container to indicate to a filter that it is being placed into service.booleanremoveMapping(String spec)Deprecated.Removes the mapping based on the given path spec.voidsetToAttribute(ServletContext context, String key)Deprecated.StringtoString()Deprecated.
-
-
-
Field Detail
-
CONTEXT_ATTRIBUTE_KEY
public static final String CONTEXT_ATTRIBUTE_KEY
Deprecated.- See Also:
- Constant Field Values
-
CONFIG_ATTRIBUTE_KEY
public static final String CONFIG_ATTRIBUTE_KEY
Deprecated.- See Also:
- Constant Field Values
-
ATTR_KEY
public static final String ATTR_KEY
Deprecated.
-
-
Constructor Detail
-
WebSocketUpgradeFilter
public WebSocketUpgradeFilter()
Deprecated.
-
WebSocketUpgradeFilter
@Deprecated public WebSocketUpgradeFilter(WebSocketServerFactory factory)
Deprecated.
-
WebSocketUpgradeFilter
@Deprecated public WebSocketUpgradeFilter(NativeWebSocketConfiguration configuration)
Deprecated.
-
-
Method Detail
-
configure
public static WebSocketUpgradeFilter configure(ServletContextHandler context) throws ServletException
Deprecated.Configure the default WebSocketUpgradeFilter.This will return the default
WebSocketUpgradeFilteron the providedServletContextHandler, creating the filter if necessary.The default
WebSocketUpgradeFilteris also available via theServletContextattribute namedorg.eclipse.jetty.websocket.server.WebSocketUpgradeFilter- Parameters:
context- theServletContextHandlerto use- Returns:
- the configured default
WebSocketUpgradeFilterinstance - Throws:
ServletException- if the filer cannot be configured
-
configureContext
@Deprecated public static WebSocketUpgradeFilter configureContext(ServletContextHandler context) throws ServletException
Deprecated.useconfigure(ServletContextHandler)instead- Parameters:
context- theServletContextHandlerto use- Returns:
- a configured
WebSocketUpgradeFilterinstance - Throws:
ServletException- if the filer cannot be configured
-
configureContext
@Deprecated public static WebSocketUpgradeFilter configureContext(ServletContext context) throws ServletException
Deprecated.useconfigureContext(ServletContextHandler)instead- Parameters:
context- the ServletContext to use- Returns:
- a configured
WebSocketUpgradeFilterinstance - Throws:
ServletException- if the filer cannot be configured
-
addMapping
public void addMapping(PathSpec spec, WebSocketCreator creator)
Deprecated.Description copied from interface:MappedWebSocketCreatorAdd a mapping.- Specified by:
addMappingin interfaceMappedWebSocketCreator- Parameters:
spec- the path spec to usecreator- the creator for the mapping
-
addMapping
@Deprecated public void addMapping(PathSpec spec, WebSocketCreator creator)
Deprecated.Description copied from interface:MappedWebSocketCreatorAdd a mapping.- Specified by:
addMappingin interfaceMappedWebSocketCreator- Parameters:
spec- the path spec to usecreator- the creator for the mapping
-
addMapping
public void addMapping(String spec, WebSocketCreator creator)
Deprecated.Description copied from interface:MappedWebSocketCreatorAdd a mapping, of a pathspec to a WebSocketCreator.Recognized Path Spec syntaxes
/path/toor/or*.extorservlet|{spec}- Servlet Syntax
^{spec}orregex|{spec}- Regex Syntax
uri-template|{spec}- URI Template (see JSR356 and RFC6570 level 1)
- Specified by:
addMappingin interfaceMappedWebSocketCreator- Parameters:
spec- the path spec to use.creator- the websocket creator for this specific mapping
-
removeMapping
public boolean removeMapping(String spec)
Deprecated.Description copied from interface:MappedWebSocketCreatorRemoves the mapping based on the given path spec.- Specified by:
removeMappingin interfaceMappedWebSocketCreator- Parameters:
spec- the path spec to remove (using the same spec syntax as seen inMappedWebSocketCreator.addMapping(String, WebSocketCreator))- Returns:
- true if underlying mapping were altered, false otherwise
-
destroy
public void destroy()
Deprecated.Description copied from interface:FilterCalled by the web container to indicate to a filter that it is being taken out of service. This method is only called once all threads within the filter's doFilter method have exited or after a timeout period has passed. After the web container calls this method, it will not call the doFilter method again on this instance of the filter.
This method gives the filter an opportunity to clean up any resources that are being held (for example, memory, file handles, threads) and make sure that any persistent state is synchronized with the filter's current state in memory.
-
doFilter
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
Deprecated.Description copied from interface:FilterThedoFiltermethod of the Filter is called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain. The FilterChain passed in to this method allows the Filter to pass on the request and response to the next entity in the chain.A typical implementation of this method would follow the following pattern:-
1. Examine the request
2. Optionally wrap the request object with a custom implementation to filter content or headers for input filtering
3. Optionally wrap the response object with a custom implementation to filter content or headers for output filtering
4. a) Either invoke the next entity in the chain using the FilterChain object (chain.doFilter()),
4. b) or not pass on the request/response pair to the next entity in the filter chain to block the request processing
5. Directly set headers on the response after invocation of the next entity in the filter chain.- Specified by:
doFilterin interfaceFilter- Parameters:
request- The request to processresponse- The response associated with the requestchain- Provides access to the next filter in the chain for this filter to pass the request and response to for further processing- Throws:
IOException- if an I/O error occurs during this filter's processing of the requestServletException- if the processing fails for any other reason
-
dump
public void dump(Appendable out, String indent) throws IOException
Deprecated.Description copied from interface:DumpableDump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.- Specified by:
dumpin interfaceDumpable- Parameters:
out- The appendable to dump toindent- The indent to apply after any new lines.- Throws:
IOException- if unable to write to Appendable
-
getFactory
public WebSocketServletFactory getFactory()
Deprecated.
-
getConfiguration
@ManagedAttribute(value="configuration", readonly=true) public NativeWebSocketConfiguration getConfiguration()
Deprecated.
-
getMapping
public WebSocketCreator getMapping(String target)
Deprecated.Description copied from interface:MappedWebSocketCreator/** Returns the creator for the given path spec.- Specified by:
getMappingin interfaceMappedWebSocketCreator- Parameters:
target- the spec to test for (using the same spec syntax as seen inMappedWebSocketCreator.addMapping(String, WebSocketCreator))- Returns:
- the websocket creator if path spec exists, or null
-
init
public void init(FilterConfig config) throws ServletException
Deprecated.Description copied from interface:FilterCalled by the web container to indicate to a filter that it is being placed into service. The servlet container calls the init method exactly once after instantiating the filter. The init method must complete successfully before the filter is asked to do any filtering work.The web container cannot place the filter into service if the init method either:
- Throws a ServletException
- Does not return within a time period defined by the web container
- Specified by:
initin interfaceFilter- Parameters:
config- The configuration information associated with the filter instance being initialised- Throws:
ServletException- if the initialisation fails
-
setToAttribute
public void setToAttribute(ServletContext context, String key) throws ServletException
Deprecated.- Throws:
ServletException
-
-