@Filter(value="/**") public class CorsFilter extends Object implements HttpServerFilter
| Modifier and Type | Field and Description |
|---|---|
protected HttpServerConfiguration.CorsConfiguration |
corsConfiguration |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
CorsFilter(HttpServerConfiguration.CorsConfiguration corsConfiguration) |
| Modifier and Type | Method and Description |
|---|---|
Publisher<MutableHttpResponse<?>> |
doFilter(HttpRequest<?> request,
ServerFilterChain chain)
Variation of the
HttpServerFilter.doFilter(HttpRequest, FilterChain) method that accepts a ServerFilterChain
which allows to mutate the outgoing HTTP response. |
int |
getOrder() |
protected Optional<MutableHttpResponse<?>> |
handleRequest(HttpRequest request)
Handles a CORS
HttpRequest. |
protected void |
handleResponse(HttpRequest<?> request,
MutableHttpResponse<?> response)
Handles a CORS response.
|
protected void |
setAllowCredentials(CorsOriginConfiguration config,
MutableHttpResponse<?> response) |
protected void |
setAllowHeaders(List<?> optionalAllowHeaders,
MutableHttpResponse response) |
protected void |
setAllowMethods(HttpMethod method,
MutableHttpResponse response) |
protected void |
setExposeHeaders(List<String> exposedHeaders,
MutableHttpResponse<?> response) |
protected void |
setMaxAge(long maxAge,
MutableHttpResponse response) |
protected void |
setOrigin(String origin,
MutableHttpResponse response) |
protected void |
setVary(MutableHttpResponse<?> response) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdoFilterprotected final HttpServerConfiguration.CorsConfiguration corsConfiguration
public CorsFilter(HttpServerConfiguration.CorsConfiguration corsConfiguration)
corsConfiguration - The CorsOriginConfiguration instancepublic Publisher<MutableHttpResponse<?>> doFilter(HttpRequest<?> request, ServerFilterChain chain)
HttpServerFilterHttpServerFilter.doFilter(HttpRequest, FilterChain) method that accepts a ServerFilterChain
which allows to mutate the outgoing HTTP response.doFilter in interface HttpServerFilterrequest - The requestchain - The chainPublisher that emits a MutableHttpResponseHttpServerFilter.doFilter(HttpRequest, FilterChain)public int getOrder()
protected void handleResponse(HttpRequest<?> request, MutableHttpResponse<?> response)
request - The HttpRequest objectresponse - The MutableHttpResponse objectprotected Optional<MutableHttpResponse<?>> handleRequest(HttpRequest request)
HttpRequest.request - The HttpRequest objectMutableHttpResponse. The request should proceed normally if emptyprotected void setAllowCredentials(CorsOriginConfiguration config, MutableHttpResponse<?> response)
config - The CorsOriginConfiguration instanceresponse - The MutableHttpResponse objectprotected void setExposeHeaders(List<String> exposedHeaders, MutableHttpResponse<?> response)
exposedHeaders - A list of the exposed headersresponse - The MutableHttpResponse objectprotected void setVary(MutableHttpResponse<?> response)
response - The MutableHttpResponse objectprotected void setOrigin(String origin, MutableHttpResponse response)
origin - The originresponse - The MutableHttpResponse objectprotected void setAllowMethods(HttpMethod method, MutableHttpResponse response)
method - The HttpMethod objectresponse - The MutableHttpResponse objectprotected void setAllowHeaders(List<?> optionalAllowHeaders, MutableHttpResponse response)
optionalAllowHeaders - A list with optional allow headersresponse - The MutableHttpResponse objectprotected void setMaxAge(long maxAge,
MutableHttpResponse response)
maxAge - The max ageresponse - The MutableHttpResponse object