@Target([AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CLASS, AnnotationTarget.FILE]) class CrossOrigin
Marks the annotated method or type as permitting cross origin requests.
By default all origins and headers are permitted, credentials are not allowed, and the maximum age is set to 1800 seconds (30 minutes). The list of HTTP methods is set to the methods on the @RequestMapping
if not explicitly set on @CrossOrigin
.
NOTE: @CrossOrigin
is processed if an appropriate HandlerMapping
-HandlerAdapter
pair is configured such as the RequestMappingHandlerMapping
-RequestMappingHandlerAdapter
pair which are the default in the MVC Java config and the MVC namespace.
Author
Russell Allen
Author
Sebastien Deleuze
Author
Sam Brannen
Since
4.2
CrossOrigin(vararg value: String, origins: Array<String>, allowedHeaders: Array<String>, exposedHeaders: Array<String>, methods: Array<RequestMethod>, allowCredentials: String, maxAge: Long)
Marks the annotated method or type as permitting cross origin requests. By default all origins and headers are permitted, credentials are not allowed, and the maximum age is set to 1800 seconds (30 minutes). The list of HTTP methods is set to the methods on the NOTE: |
static val DEFAULT_ALLOWED_HEADERS: Array<String> |
|
static val DEFAULT_ALLOW_CREDENTIALS: Boolean |
|
static val DEFAULT_MAX_AGE: Long |
|
static val DEFAULT_ORIGINS: Array<String> |
|
val allowCredentials: String
Whether the browser should include any cookies associated with the domain of the request being annotated. Be aware that enabling this option could increase the surface attack of the web application (for example via exposing sensitive user-specific information like CSRF tokens). Set to If undefined or set to |
|
val allowedHeaders: Array<String>
List of request headers that can be used during the actual request. This property controls the value of the pre-flight response's If undefined, all requested headers are allowed. |
|
val exposedHeaders: Array<String>
List of response headers that the user-agent will allow the client to access. This property controls the value of actual response's If undefined, an empty exposed header list is used. |
|
val maxAge: Long
The maximum age (in seconds) of the cache duration for pre-flight responses. This property controls the value of the Setting this to a reasonable value can reduce the number of pre-flight request/response interactions required by the browser. A negative value means undefined. If undefined, max age is set to |
|
val methods: Array<RequestMethod>
List of supported HTTP request methods, e.g. Methods specified here override those specified via If undefined, methods defined by RequestMapping annotation are used. |
|
val origins: Array<String>
List of allowed origins, e.g. These values are placed in the If undefined, all origins are allowed. |
|
val value: Array<String>
Alias for |