public class WebSocketConnectionOriginFilter extends Object implements IWebSocketConnectionFilter
Modifier and Type | Field and Description |
---|---|
static String |
ORIGIN_MISMATCH
Explanatory text for the client to explain why the connection is getting aborted
|
static int |
POLICY_VIOLATION_ERROR_CODE
Error code 1008 indicates that an endpoint is terminating the connection because it has received a message that
violates its policy.
|
Constructor and Description |
---|
WebSocketConnectionOriginFilter(List<String> allowedDomains) |
Modifier and Type | Method and Description |
---|---|
ConnectionRejected |
doFilter(javax.servlet.http.HttpServletRequest servletRequest)
Method for rejecting connections based on the current request
|
List<String> |
getAllowedDomains()
The list of whitelisted domains which are allowed to initiate a websocket connection.
|
void |
setAllowedDomains(Iterable<String> domains)
The list of whitelisted domains which are allowed to initiate a websocket connection.
|
public static final int POLICY_VIOLATION_ERROR_CODE
public static final String ORIGIN_MISMATCH
public ConnectionRejected doFilter(javax.servlet.http.HttpServletRequest servletRequest)
IWebSocketConnectionFilter
doFilter
in interface IWebSocketConnectionFilter
servletRequest
- The servlet request holding the request headerspublic void setAllowedDomains(Iterable<String> domains)
IWebSocketConnectionFilter
to abort potentially
unsafe connections. Example domain names might be:
http://www.example.com http://ww2.example.com
domains
- The collection of domainspublic List<String> getAllowedDomains()
IWebSocketConnectionFilter
to abort potentially
unsafe connectionsCopyright © 2006–2022 Apache Software Foundation. All rights reserved.