Package com.linecorp.armeria.server.cors
Class CorsConfig
java.lang.Object
com.linecorp.armeria.server.cors.CorsConfig
public final class CorsConfig extends Object
Cross-Origin Resource Sharing
(CORS) configuration.
- See Also:
CorsServiceBuilder
,CorsService.config()
-
Method Summary
Modifier and Type Method Description CorsPolicy
getPolicy(String origin, RoutingContext routingContext)
Returns the policy for the specifiedorigin
.boolean
isAnyOriginSupported()
Determines whether a wildcard origin, '*', is supported.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()
-
Method Details
-
isAnyOriginSupported
public boolean isAnyOriginSupported()Determines whether a wildcard origin, '*', is supported.- Returns:
true
if any origin is allowed.
-
isShortCircuit
public boolean isShortCircuit()Determines whether a CORS request should be rejected if it's invalid before being further processing.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.
- Returns:
true
if a CORS request should short-circuit upon receiving an invalid Origin header.
-
policies
Returns the policies. -
getPolicy
Returns the policy for the specifiedorigin
.- Returns:
CorsPolicy
which allows theorigin
,null
if theorigin
isnull
or not allowed in any policy.
-
toString
-