Package org.apache.wicket.protocol.ws
Class AbstractUpgradeFilter
java.lang.Object
org.apache.wicket.protocol.http.WicketFilter
org.apache.wicket.protocol.ws.AbstractUpgradeFilter
- All Implemented Interfaces:
jakarta.servlet.Filter
- Direct Known Subclasses:
JavaxWebSocketFilter
An extension of WicketFilter that is used to check whether
the processed HttpServletRequest needs to upgrade its protocol
from HTTP to something else
- Since:
- 6.0
-
Field Summary
Fields inherited from class org.apache.wicket.protocol.http.WicketFilter
APP_FACT_PARAM, FILTER_MAPPING_PARAM, IGNORE_PATHS_PARAM
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
acceptWebSocket
(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) getTokensFromHeader
(jakarta.servlet.http.HttpServletRequest req, String headerName) protected boolean
processRequestCycle
(RequestCycle requestCycle, WebResponse webResponse, jakarta.servlet.http.HttpServletRequest httpServletRequest, jakarta.servlet.http.HttpServletResponse httpServletResponse, jakarta.servlet.FilterChain chain) Process the request cycleprotected String
selectSubProtocol
(List<String> subProtocols) Intended to be overridden by sub-classes that wish to select a sub-protocol if the client provides a list of supported protocols.protected boolean
verifyOrigin
(String origin) Intended to be overridden by sub-classes that wish to verify the origin of a WebSocket request before processing it.Methods inherited from class org.apache.wicket.protocol.http.WicketFilter
checkIfRedirectRequired, destroy, doFilter, getApplication, getApplicationFactory, getClassLoader, getFilterConfig, getFilterPath, getFilterPath, getFilterPathFromAnnotation, getFilterPathFromConfig, getFilterPathFromWebXml, getRelativePath, init, init, setFilterPath
-
Constructor Details
-
AbstractUpgradeFilter
public AbstractUpgradeFilter() -
AbstractUpgradeFilter
-
-
Method Details
-
processRequestCycle
protected boolean processRequestCycle(RequestCycle requestCycle, WebResponse webResponse, jakarta.servlet.http.HttpServletRequest httpServletRequest, jakarta.servlet.http.HttpServletResponse httpServletResponse, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException Description copied from class:WicketFilter
Process the request cycle- Overrides:
processRequestCycle
in classWicketFilter
- Returns:
- false, if the request could not be processed
- Throws:
IOException
jakarta.servlet.ServletException
-
acceptWebSocket
protected boolean acceptWebSocket(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException - Throws:
jakarta.servlet.ServletException
IOException
-
getTokensFromHeader
protected List<String> getTokensFromHeader(jakarta.servlet.http.HttpServletRequest req, String headerName) -
verifyOrigin
Intended to be overridden by sub-classes that wish to verify the origin of a WebSocket request before processing it.- Parameters:
origin
- The value of the origin header from the request which may benull
- Returns:
true
to accept the request.false
to reject it. This default implementation always returnstrue
.
-
selectSubProtocol
Intended to be overridden by sub-classes that wish to select a sub-protocol if the client provides a list of supported protocols.- Parameters:
subProtocols
- The list of sub-protocols supported by the client in client preference order. The server is under no obligation to respect the declared preference- Returns:
null
if no sub-protocol is selected or the name of the protocol which must be one of the protocols listed by the client. This default implementation always returnsnull
.
-