注释类型 CrossOrigin
-
@Target({METHOD,TYPE}) @Retention(SOURCE) public @interface CrossOriginCreated by Zhenjie Yan on 10/10/20.
-
-
可选元素概要
可选元素 修饰符和类型 可选元素 说明 java.lang.StringallowCredentialsWhether the browser should include any cookies associated with the domain of the request being annotated.java.lang.String[]allowedHeadersList of request headers that can be used during the actual request.java.lang.String[]exposedHeadersList of response headers that the user-agent will allow the client to access.longmaxAgeThe maximum age (in seconds) of the cache duration for pre-flight responses.RequestMethod[]methodsList of supported HTTP request methods, e.g.java.lang.String[]originsList of allowed origins, e.g.java.lang.String[]valueAlias fororigins().
-
-
-
元素详细资料
-
value
java.lang.String[] value
Alias fororigins().- 默认值:
- {}
-
-
-
origins
java.lang.String[] origins
List of allowed origins, e.g."http://domain1.com".These values are placed in the
Access-Control-Allow-Originheader of both the pre-flight response and the actual response."*"means that all origins are allowed.If undefined, all origins are allowed.
- 另请参阅:
value()
- 默认值:
- {}
-
-
-
allowedHeaders
java.lang.String[] allowedHeaders
List of request headers that can be used during the actual request.This property controls the value of the pre-flight response's
Access-Control-Allow-Headersheader."*"means that all headers requested by the client are allowed.If undefined, all requested headers are allowed.
- 默认值:
- {}
-
-
-
methods
RequestMethod[] methods
List of supported HTTP request methods, e.g."{RequestMethod.GET, RequestMethod.POST}".Methods specified here override those specified via
RequestMapping.If undefined, methods defined by
RequestMappingannotation are used.- 默认值:
- {}
-
-
-
allowCredentials
java.lang.String allowCredentials
Whether the browser should include any cookies associated with the domain of the request being annotated.Set to
"false"if such cookies should not included. An empty string ("") means undefined."true"means that the pre-flight response will include the headerAccess-Control-Allow-Credentials=true.If undefined, credentials are allowed.
- 默认值:
- ""
-
-
-
maxAge
long maxAge
The maximum age (in seconds) of the cache duration for pre-flight responses.This property controls the value of the
Access-Control-Max-Ageheader in the pre-flight response.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
1800seconds (i.e., 30 minutes).- 默认值:
- -1L
-
-