- All Superinterfaces:
Prototype.Api
- All Known Implementing Classes:
CorsPathConfig.BuilderBase.CorsPathConfigImpl
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classFluent API builder forCorsPathConfig.static classCorsPathConfig.BuilderBase<BUILDER extends CorsPathConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends CorsPathConfig> Fluent API builder base forCorsPathConfig. -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether to allow credentials.Set of allowed headers, defaults to all.Set of allowed methods, defaults to all.Set of allowed origins, defaults to all.static CorsPathConfig.Builderbuilder()Create a new fluent API builder to customize configuration.static CorsPathConfig.Builderbuilder(CorsPathConfig instance) Create a new fluent API builder from an existing instance.static CorsPathConfigDeprecated.static CorsPathConfigCreate a new instance from configuration.booleanenabled()Whether this CORS configuration should be enabled or not.booleanWhether this acts as an exclusive configuration for the configuredpathPattern.Set of exposed headers, defaults to none.maxAge()Max age as a duration.Path pattern to apply this configuration for.
-
Method Details
-
builder
Create a new fluent API builder to customize configuration.- Returns:
- a new builder
-
builder
Create a new fluent API builder from an existing instance.- Parameters:
instance- an existing instance used as a base for the builder- Returns:
- a builder based on an instance
-
create
Create a new instance from configuration.- Parameters:
config- used to configure the new instance- Returns:
- a new instance configured from configuration
-
create
Deprecated.Create a new instance from configuration.- Parameters:
config- used to configure the new instance- Returns:
- a new instance configured from configuration
-
pathPattern
String pathPattern()Path pattern to apply this configuration for. Note that paths are checked in sequence, and the first path that matches the request will be used to configure CORS.Always configure the most restrictive rules first.
- Returns:
- path pattern as understood by WebServer routing
-
exclusive
boolean exclusive()Whether this acts as an exclusive configuration for the configuredpathPattern. If exclusive, any CORS request matching the pattern will be exclusively handled with this configuration. If not exclusive, only CORS request matching the pattern AND a method will be handled by this configuration.- Returns:
- whether this is an exclusive configuration for the provided path, defaults to true
-
enabled
boolean enabled()Whether this CORS configuration should be enabled or not. If disabled, this configuration will be ignored, and the next path will be checked.- Returns:
- whether this configuration is enabled
-
allowOrigins
Set of allowed origins, defaults to all.If not empty, this will be used with "Access-Control-Allow-Origin" header. Note that allowed origins may be either a full origin, such as
http://www.example.com, or a regular expression. Any origin that contains (\), or*, or curly braces is considered a regular expression (i.e.http://.*\.example\.com).If you configure a regular expression, it would never be returned if all allowed origins are returned in a pre-flight request.
- Returns:
- allowed origins
-
allowHeaders
Set of allowed headers, defaults to all.If not empty, this will be used in "Access-Control-Allow-Headers" header.
- Returns:
- allowed headers
-
allowMethods
Set of allowed methods, defaults to all.- Returns:
- allowed methods
-
exposeHeaders
Set of exposed headers, defaults to none.If not empty, this will be used in "Access-Control-Expose-Headers" header.
- Returns:
- exposed headers
-
allowCredentials
boolean allowCredentials()Whether to allow credentials.If enabled, this will be used in "Access-Control-Allow-Credentials" header.
- Returns:
- whether to allow credentials, defaults to
false
-
maxAge
Duration maxAge()Max age as a duration.This value will be used in "Access-Control-Max-Age" header (in seconds).
For backward compatibility, you can specify the following when used from configuration:
- integer (such as
3600) - number of seconds as a number - integer ms (such as
10000 ms) - number of milliseconds - duration format (such as
PT1H) - format ofDuration
- Returns:
- max age
- integer (such as
-
create(io.helidon.config.Config)