Origin header value against a
collection of allowed origins.
| Modifier and Type | Field and Description |
|---|---|
| private final CorsConfiguration | |
| protected final Log |
| Access | Constructor and Description |
|---|---|
| public | |
| public | OriginHandshakeInterceptor(Collection<String> allowedOrigins)
Constructor using the specified allowed origin values. |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterHandshake(ServerHttpRequest
the current request request, ServerHttpResponse the current response response, WebSocketHandler the target WebSocket handler wsHandler, Exception an exception raised during the handshake, or exception)null if noneImplements org. Invoked after the handshake is done. |
| public boolean | beforeHandshake(ServerHttpRequest
the current request request, ServerHttpResponse the current response response, WebSocketHandler the target WebSocket handler wsHandler, Map<String, Object> the attributes from the HTTP handshake to associate with the WebSocket
session; the provided attributes are copied, the original map is not used. attributes)Implements org. Invoked before the handshake is processed. |
| public Collection | |
| public Collection | |
| public void | setAllowedOriginPatterns(Collection<String> allowedOriginPatterns)
Alternative to |
| public void | setAllowedOrigins(Collection<String> allowedOrigins)
Set the origins for which cross-origin requests are allowed from a browser. |
| corsConfiguration | back to summary |
|---|---|
| private final CorsConfiguration corsConfiguration | |
| logger | back to summary |
|---|---|
| protected final Log logger | |
| OriginHandshakeInterceptor | back to summary |
|---|---|
| public OriginHandshakeInterceptor() Default constructor with only same origin requests allowed. | |
| OriginHandshakeInterceptor | back to summary |
|---|---|
| public OriginHandshakeInterceptor(Collection<String> allowedOrigins) Constructor using the specified allowed origin values.
| |
| afterHandshake | back to summary |
|---|---|
| public void afterHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Exception exception) Implements org. Doc from org. Invoked after the handshake is done. The response status and headers indicate the results of the handshake, i.e. whether it was successful or not.
| |
| beforeHandshake | back to summary |
|---|---|
| public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Map<String, Object> attributes) throws Exception Implements org. Doc from org. Invoked before the handshake is processed.
| |
| getAllowedOriginPatterns | back to summary |
|---|---|
| public Collection Return the
| |
| getAllowedOrigins | back to summary |
|---|---|
| public Collection Return the
| |
| setAllowedOriginPatterns | back to summary |
|---|---|
| public void setAllowedOriginPatterns(Collection<String> allowedOriginPatterns) Alternative to By default this is not set.
| |
| setAllowedOrigins | back to summary |
|---|---|
| public void setAllowedOrigins(Collection<String> allowedOrigins) Set the origins for which cross-origin requests are allowed from a browser.
Please, refer to By default, no origins are allowed. When
Note when SockJS is enabled and origins are restricted, transport types that do not allow to check request origin (Iframe based transports) are disabled. As a consequence, IE 6 to 9 are not supported when origins are restricted. | |