@Repeatable(value=CorsDecorators.class) @Retention(value=RUNTIME) @Target(value={TYPE,METHOD}) public @interface CorsDecorator
CorsService decorator for annotated HTTP services.| Modifier and Type | Required Element and Description |
|---|---|
String[] |
origins
Allowed origins.
|
| Modifier and Type | Optional Element and Description |
|---|---|
String[] |
allowedRequestHeaders
The headers that should be returned in the CORS
"Access-Control-Allow-Headers"
response header. |
HttpMethod[] |
allowedRequestMethods
The allowed HTTP request methods that should be returned in the
CORS
"Access-Control-Allow-Methods" response header. |
boolean |
credentialsAllowed
Determines if cookies are allowed to be added to CORS requests.
|
String[] |
exposedHeaders
The headers to be exposed to calling clients.
|
long |
maxAge
The value of the CORS
"Access-Control-Max-Age" response header which enables the
caching of the preflight response for the specified time. |
boolean |
nullOriginAllowed
Determines if a
"null" origin is allowed. |
String[] |
pathPatterns
The path patterns that this policy is supposed to be applied to.
|
boolean |
preflightRequestDisabled
Determines if no preflight response headers should be added to a CORS preflight response.
|
AdditionalHeader[] |
preflightRequestHeaders
The HTTP response headers that should be added to a CORS preflight response.
|
public abstract String[] origins
"*" to allow any origin.public abstract String[] pathPatterns
public abstract HttpMethod[] allowedRequestMethods
"Access-Control-Allow-Methods" response header.public abstract long maxAge
"Access-Control-Max-Age" response header which enables the
caching of the preflight response for the specified time. During this time no preflight
request will be made.CorsPolicyBuilder.maxAge(long)public abstract String[] exposedHeaders
public abstract String[] allowedRequestHeaders
"Access-Control-Allow-Headers"
response header.public abstract boolean credentialsAllowed
true will set the CORS "Access-Control-Allow-Credentials"
response header to "true".
If unset, will be false.
CorsPolicyBuilder.allowCredentials()public abstract boolean nullOriginAllowed
"null" origin is allowed.
If unset, will be false.
CorsPolicyBuilder.allowNullOrigin()public abstract AdditionalHeader[] preflightRequestHeaders
Copyright © 2020 LeanCloud. All rights reserved.