Class CorsPathConfig.BuilderBase<BUILDER extends CorsPathConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends CorsPathConfig>
- Type Parameters:
BUILDER- type of the builder extending this abstract builderPROTOTYPE- type of the prototype interface that would be built byPrototype.Builder.buildPrototype()
- All Implemented Interfaces:
Prototype.Builder<BUILDER,,PROTOTYPE> ConfigBuilderSupport.ConfiguredBuilder<BUILDER,,PROTOTYPE> ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
- Direct Known Subclasses:
CorsPathConfig.Builder
- Enclosing interface:
CorsPathConfig
CorsPathConfig.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classGenerated implementation of the prototype, can be extended by descendant prototype implementations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAllowHeader(HeaderName headerName) Add an allowed header name.addAllowHeader(String allowHeader) Set of allowed headers, defaults to all.addAllowHeaders(Set<String> allowHeaders) Set of allowed headers, defaults to all.addAllowMethod(Method method) Add an allowed method.addAllowMethod(String allowMethod) Set of allowed methods, defaults to all.addAllowMethods(Set<String> allowMethods) Set of allowed methods, defaults to all.addAllowOrigin(String allowOrigin) Set of allowed origins, defaults to all.addAllowOrigins(Set<String> allowOrigins) Set of allowed origins, defaults to all.addExposeHeader(HeaderName headerName) Add an exposed header name.addExposeHeader(String exposeHeader) Set of exposed headers, defaults to none.addExposeHeaders(Set<String> exposeHeaders) Set of exposed headers, defaults to none.booleanWhether to allow credentials.allowCredentials(boolean allowCredentials) Whether to allow credentials.Set of allowed headers, defaults to all.allowHeaders(Set<String> allowHeaders) Set of allowed headers, defaults to all.Set of allowed methods, defaults to all.allowMethods(Set<String> allowMethods) Set of allowed methods, defaults to all.Set of allowed origins, defaults to all.allowOrigins(Set<String> allowOrigins) Set of allowed origins, defaults to all.Clear all allowHeaders.Clear all allowMethods.Clear all allowOrigins.Clear all exposeHeaders.config()Configuration used to configure this instance.Deprecated.Update builder from configuration (node of this type).booleanenabled()Whether this CORS configuration should be enabled or not.enabled(boolean enabled) Whether this CORS configuration should be enabled or not.booleanWhether this acts as an exclusive configuration for the configuredpathPattern.exclusive(boolean exclusive) Whether this acts as an exclusive configuration for the configuredpathPattern.Set of exposed headers, defaults to none.exposeHeaders(Set<String> exposeHeaders) Set of exposed headers, defaults to none.from(CorsPathConfig prototype) Update this builder from an existing prototype instance.from(CorsPathConfig.BuilderBase<?, ?> builder) Update this builder from an existing prototype builder instance.maxAge()Max age as a duration.Max age as a duration.Path pattern to apply this configuration for.pathPattern(String pathPattern) Path pattern to apply this configuration for.protected voidHandles providers and decorators.toString()protected voidValidates required properties.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.helidon.builder.api.Prototype.Builder
buildPrototype, self
-
Constructor Details
-
BuilderBase
protected BuilderBase()Protected to support extensibility.
-
-
Method Details
-
from
Update this builder from an existing prototype instance. This method disables automatic service discovery.- Parameters:
prototype- existing prototype to update this builder from- Returns:
- updated builder instance
-
from
Update this builder from an existing prototype builder instance.- Parameters:
builder- existing builder prototype to update this builder from- Returns:
- updated builder instance
-
addAllowHeader
Add an allowed header name.- Parameters:
headerName- header name to add to the set of allowed headers- Returns:
- updated builder instance
-
addExposeHeader
Add an exposed header name.- Parameters:
headerName- header name to add to the set of exposed headers- Returns:
- updated builder instance
-
addAllowMethod
Add an allowed method.- Parameters:
method- method to add to the set of allowed methods- Returns:
- updated builder instance
-
config
Deprecated.Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.- Specified by:
configin interfaceConfigBuilderSupport.ConfiguredBuilder<BUILDER extends CorsPathConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends CorsPathConfig> - Parameters:
config- configuration instance used to obtain values to update this builder- Returns:
- updated builder instance
-
config
Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.- Specified by:
configin interfaceConfigBuilderSupport.ConfiguredBuilder<BUILDER extends CorsPathConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends CorsPathConfig> - Parameters:
config- configuration instance used to obtain values to update this builder- Returns:
- updated builder instance
-
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.
- Parameters:
pathPattern- path pattern as understood by WebServer routing- Returns:
- updated builder instance
- See Also:
-
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.- Parameters:
exclusive- whether this is an exclusive configuration for the provided path, defaults to true- Returns:
- updated builder instance
- See Also:
-
enabled
Whether this CORS configuration should be enabled or not. If disabled, this configuration will be ignored, and the next path will be checked.- Parameters:
enabled- whether this configuration is enabled- Returns:
- updated builder instance
- See Also:
-
clearAllowOrigins
Clear all allowOrigins.- Returns:
- updated builder instance
- See Also:
-
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.
- Parameters:
allowOrigins- allowed origins- Returns:
- updated builder instance
- See Also:
-
addAllowOrigins
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.
- Parameters:
allowOrigins- allowed origins- Returns:
- updated builder instance
- See Also:
-
addAllowOrigin
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.
- Parameters:
allowOrigin- add single allowed origins- Returns:
- updated builder instance
- See Also:
-
clearAllowHeaders
Clear all allowHeaders.- Returns:
- updated builder instance
- See Also:
-
allowHeaders
Set of allowed headers, defaults to all.If not empty, this will be used in "Access-Control-Allow-Headers" header.
- Parameters:
allowHeaders- allowed headers- Returns:
- updated builder instance
- See Also:
-
addAllowHeaders
Set of allowed headers, defaults to all.If not empty, this will be used in "Access-Control-Allow-Headers" header.
- Parameters:
allowHeaders- allowed headers- Returns:
- updated builder instance
- See Also:
-
addAllowHeader
Set of allowed headers, defaults to all.If not empty, this will be used in "Access-Control-Allow-Headers" header.
- Parameters:
allowHeader- add single allowed headers- Returns:
- updated builder instance
- See Also:
-
clearAllowMethods
Clear all allowMethods.- Returns:
- updated builder instance
- See Also:
-
allowMethods
Set of allowed methods, defaults to all.- Parameters:
allowMethods- allowed methods- Returns:
- updated builder instance
- See Also:
-
addAllowMethods
Set of allowed methods, defaults to all.- Parameters:
allowMethods- allowed methods- Returns:
- updated builder instance
- See Also:
-
addAllowMethod
Set of allowed methods, defaults to all.- Parameters:
allowMethod- add single allowed methods- Returns:
- updated builder instance
- See Also:
-
clearExposeHeaders
Clear all exposeHeaders.- Returns:
- updated builder instance
- See Also:
-
exposeHeaders
Set of exposed headers, defaults to none.If not empty, this will be used in "Access-Control-Expose-Headers" header.
- Parameters:
exposeHeaders- exposed headers- Returns:
- updated builder instance
- See Also:
-
addExposeHeaders
Set of exposed headers, defaults to none.If not empty, this will be used in "Access-Control-Expose-Headers" header.
- Parameters:
exposeHeaders- exposed headers- Returns:
- updated builder instance
- See Also:
-
addExposeHeader
Set of exposed headers, defaults to none.If not empty, this will be used in "Access-Control-Expose-Headers" header.
- Parameters:
exposeHeader- add single exposed headers- Returns:
- updated builder instance
- See Also:
-
allowCredentials
Whether to allow credentials.If enabled, this will be used in "Access-Control-Allow-Credentials" header.
- Parameters:
allowCredentials- whether to allow credentials, defaults tofalse- Returns:
- updated builder instance
- See Also:
-
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
- Parameters:
maxAge- max age- Returns:
- updated builder instance
- See Also:
- integer (such as
-
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
public 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
public 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
public 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
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
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties. -
config
Configuration used to configure this instance.- Returns:
- config instance
-
config(io.helidon.config.Config)