Class WebSocketUpgradeFilter
java.lang.Object
org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter
- All Implemented Interfaces:
javax.servlet.Filter,Dumpable
@ManagedObject("WebSocket Upgrade Filter")
public class WebSocketUpgradeFilter
extends Object
implements javax.servlet.Filter, Dumpable
Inline Servlet Filter to capture WebSocket upgrade requests.
The configuration applied to this filter via init params will be used as the the default
configuration of any websocket upgraded by this filter, prior to the configuration of the
websocket applied by the WebSocketMappings.
Configuration / Init-Parameters:
- idleTimeout
- set the time in ms that a websocket may be idle before closing
- maxTextMessageSize
- set the size in UTF-8 bytes that a websocket may be accept as a Text Message before closing
- maxBinaryMessageSize
- set the size in bytes that a websocket may be accept as a Binary Message before closing
- inputBufferSize
- set the size in bytes of the buffer used to read raw bytes from the network layer
- outputBufferSize
- set the size in bytes of the buffer used to write bytes to the network layer
- maxFrameSize
- The maximum frame size sent or received.
- autoFragment
- If true, frames are automatically fragmented to respect the maximum frame size.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()voiddoFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) voiddump(Appendable out, String indent) Dump this object (and children) into an Appendable using the provided indent after any new lines.static FilterHolderensureFilter(javax.servlet.ServletContext servletContext) Ensure aWebSocketUpgradeFilteris available on the providedServletContext, a new filter will added if one does not already exist.static FilterHoldergetFilter(javax.servlet.ServletContext servletContext) Return the defaultWebSocketUpgradeFilterif present on theServletContext.voidinit(javax.servlet.FilterConfig config)
-
Constructor Details
-
WebSocketUpgradeFilter
public WebSocketUpgradeFilter()
-
-
Method Details
-
getFilter
Return the defaultWebSocketUpgradeFilterif present on theServletContext.- Parameters:
servletContext- theServletContextto use.- Returns:
- the configured default
WebSocketUpgradeFilterinstance.
-
ensureFilter
Ensure aWebSocketUpgradeFilteris available on the providedServletContext, a new filter will added if one does not already exist.The default
WebSocketUpgradeFilteris also available via theServletContextattribute namedorg.eclipse.jetty.websocket.server.WebSocketUpgradeFilter- Parameters:
servletContext- theServletContextto use.- Returns:
- the configured default
WebSocketUpgradeFilterinstance.
-
doFilter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException - Specified by:
doFilterin interfacejavax.servlet.Filter- Throws:
IOExceptionjavax.servlet.ServletException
-
dump
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
-
init
public void init(javax.servlet.FilterConfig config) throws javax.servlet.ServletException - Specified by:
initin interfacejavax.servlet.Filter- Throws:
javax.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroyin interfacejavax.servlet.Filter
-