The caller builds the cross-config information over multiple invocations of the builder methods. The behavior is that
of a List
: when matching against a request's path and method, the aggregator checks the path matchers
in the order they were added to the aggregator, whether by Aggregator.Builder.mappedConfig(io.helidon.common.config.Config)
or
Aggregator.Builder.addCrossOrigin(java.lang.String, io.helidon.cors.CrossOriginConfig)
or the CorsSetter
methods.
The CorsSetter
methods affect a distinct "pathless" entry. Those methods have no explicit path, so we record
their settings in an entry with path expression "{+}" which matches everything. The first time the
caller invokes a CorsSetter
method, the aggregator creates this distinct entry and adds it to the list, thus (as
with any other entry) determining the order, relative to other entries, with which it will be checked.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Key value for the map corresponding to the cross-origin config managed by theCorsSetter
methods. -
Method Summary
Modifier and TypeMethodDescriptionboolean
isActive()
Reports whether the sources of CORS information have left CORS active or not.boolean
Reports whether the aggregator (and, by implication, the config for CORS) is enabled or not.lookupCrossOrigin
(String path, String method, Supplier<Optional<CrossOriginConfig>> secondaryLookup) Looks for a matching CORS config entry for the specified path among the provided CORS configuration information, returning anOptional
of the matchingCrossOrigin
instance for the path, if any.toString()
-
Field Details
-
PATHLESS_KEY
Key value for the map corresponding to the cross-origin config managed by theCorsSetter
methods.- See Also:
-
-
Method Details
-
isActive
public boolean isActive()Reports whether the sources of CORS information have left CORS active or not. This is a combination of any explicit setting ofenabled
with whether anyCrossOriginConfig
instances were added -- either explicitly or using config. If not, then the aggregator will never find a match among the matchables so it is as good as inactive.- Returns:
- if this aggregator will contribute to CORS processing
-
isEnabled
public boolean isEnabled()Reports whether the aggregator (and, by implication, the config for CORS) is enabled or not.- Returns:
- if CORS is enabled
-
lookupCrossOrigin
public Optional<CrossOriginConfig> lookupCrossOrigin(String path, String method, Supplier<Optional<CrossOriginConfig>> secondaryLookup) Looks for a matching CORS config entry for the specified path among the provided CORS configuration information, returning anOptional
of the matchingCrossOrigin
instance for the path, if any.- Parameters:
path
- the unnormalized request path to checkmethod
- HTTP methodsecondaryLookup
- Supplier for CrossOrigin used if none found in config- Returns:
- Optional<CrossOriginConfig> for the matching config, or an empty Optional if none matched
-
toString
-