Class WebSocketUpgradeFilter
java.lang.Object
org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter
- All Implemented Interfaces:
jakarta.servlet.Filter
,Dumpable
@ManagedObject("WebSocket Upgrade Filter")
public class WebSocketUpgradeFilter
extends Object
implements jakarta.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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
void
doFilter
(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) void
dump
(Appendable out, String indent) Dump this object (and children) into an Appendable using the provided indent after any new lines.static FilterHolder
ensureFilter
(jakarta.servlet.ServletContext servletContext) Ensure aWebSocketUpgradeFilter
is available on the providedServletContext
, a new filter will added if one does not already exist.static FilterHolder
getFilter
(jakarta.servlet.ServletContext servletContext) Return the defaultWebSocketUpgradeFilter
if present on theServletContext
.void
init
(jakarta.servlet.FilterConfig config)
-
Constructor Details
-
WebSocketUpgradeFilter
public WebSocketUpgradeFilter()
-
-
Method Details
-
getFilter
Return the defaultWebSocketUpgradeFilter
if present on theServletContext
.- Parameters:
servletContext
- theServletContext
to use.- Returns:
- the configured default
WebSocketUpgradeFilter
instance.
-
ensureFilter
Ensure aWebSocketUpgradeFilter
is available on the providedServletContext
, a new filter will added if one does not already exist.The default
WebSocketUpgradeFilter
is also available via theServletContext
attribute namedorg.eclipse.jetty.websocket.server.WebSocketUpgradeFilter
- Parameters:
servletContext
- theServletContext
to use.- Returns:
- the configured default
WebSocketUpgradeFilter
instance.
-
doFilter
public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException - Specified by:
doFilter
in interfacejakarta.servlet.Filter
- Throws:
IOException
jakarta.servlet.ServletException
-
dump
Description copied from interface:Dumpable
Dump 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:
dump
in 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(jakarta.servlet.FilterConfig config) throws jakarta.servlet.ServletException - Specified by:
init
in interfacejakarta.servlet.Filter
- Throws:
jakarta.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroy
in interfacejakarta.servlet.Filter
-