Package io.micronaut.http.server.cors
Class CorsOriginConfiguration
java.lang.Object
io.micronaut.http.server.cors.CorsOriginConfiguration
Stores configuration for CORS.
- Since:
- 1.0
- Author:
- James Kleeh, Graeme Rocher
-
Field Summary
Modifier and TypeFieldDescriptionConstant to represent any value.static final List<HttpMethod>
Constant to represent any method. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
void
setAllowCredentials
(boolean allowCredentials) Sets whether to allow credentials.void
setAllowedHeaders
(@Nullable List<String> allowedHeaders) Sets the allowed headers.void
setAllowedMethods
(@Nullable List<HttpMethod> allowedMethods) Sets the allowed methods.void
setAllowedOrigins
(@Nullable List<String> allowedOrigins) Sets the allowed origins.void
setAllowedOriginsRegex
(String allowedOriginsRegex) Sets a regular expression for matching Allowed Origins.void
setExposedHeaders
(@Nullable List<String> exposedHeaders) Sets the exposed headers.void
Sets the max age.
-
Field Details
-
ANY
Constant to represent any value. -
ANY_METHOD
Constant to represent any method.
-
-
Constructor Details
-
CorsOriginConfiguration
public CorsOriginConfiguration()
-
-
Method Details
-
getAllowedOrigins
- Returns:
- The allowed origins
-
setAllowedOrigins
Sets the allowed origins.- Parameters:
allowedOrigins
- The allow origins
-
getAllowedOriginsRegex
- Returns:
- a regular expression for matching Allowed Origins.
-
setAllowedOriginsRegex
Sets a regular expression for matching Allowed Origins.- Parameters:
allowedOriginsRegex
- a regular expression for matching Allowed Origins.
-
getAllowedMethods
- Returns:
- The allowed methods
-
setAllowedMethods
Sets the allowed methods.- Parameters:
allowedMethods
- The allowed methods
-
getAllowedHeaders
- Returns:
- The allowed headers
-
setAllowedHeaders
Sets the allowed headers.- Parameters:
allowedHeaders
- The allowed headers
-
getExposedHeaders
- Returns:
- The exposed headers
-
setExposedHeaders
Sets the exposed headers.- Parameters:
exposedHeaders
- The exposed headers
-
isAllowCredentials
public boolean isAllowCredentials()- Returns:
- Whether to allow credentials
-
setAllowCredentials
public void setAllowCredentials(boolean allowCredentials) Sets whether to allow credentials.- Parameters:
allowCredentials
- The credentials
-
getMaxAge
- Returns:
- The max age. A value of -1 indicates no max age
-
setMaxAge
Sets the max age.- Parameters:
maxAge
- The max age
-