public final class CorsConfig extends Object
CorsServiceBuilder,
CorsService.config()| Modifier and Type | Field and Description |
|---|---|
static CorsConfig |
DISABLED
CorsConfig with CORS disabled. |
| Modifier and Type | Method and Description |
|---|---|
CorsPolicy |
getPolicy(String origin,
RoutingContext routingContext)
Returns the policy for the specified
origin. |
boolean |
isAnyOriginSupported()
Determines whether a wildcard origin, '*', is supported.
|
boolean |
isEnabled()
Determines if support for CORS is enabled.
|
boolean |
isShortCircuit()
Determines whether a CORS request should be rejected if it's invalid before being
further processing.
|
List<CorsPolicy> |
policies()
Returns the policies.
|
String |
toString() |
public static final CorsConfig DISABLED
CorsConfig with CORS disabled.public boolean isEnabled()
true if support for CORS is enabled, false otherwise.public boolean isAnyOriginSupported()
true if any origin is allowed.IllegalStateException - if CORS support is not enabledpublic boolean isShortCircuit()
CORS headers are set after a request is processed. This may not always be desired and this setting will check that the Origin is valid and if it is not valid no further processing will take place, and a error will be returned to the calling client.
true if a CORS request should short-circuit upon receiving an invalid Origin header.public List<CorsPolicy> policies()
IllegalStateException - if CORS support is not enabled.@Nullable public CorsPolicy getPolicy(@Nullable String origin, RoutingContext routingContext)
origin.CorsPolicy which allows the origin,
null if the origin is null or not allowed in any policy.Copyright © 2020 LeanCloud. All rights reserved.