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.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
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated, for removal: This API element is subject to removal in a future version.Key value for the map corresponding to the cross-origin config managed by theCorsSettermethods. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisActive()Deprecated, for removal: This API element is subject to removal in a future version.Reports whether the sources of CORS information have left CORS active or not.booleanDeprecated, for removal: This API element is subject to removal in a future version.Reports whether the aggregator (and, by implication, the config for CORS) is enabled or not.lookupCrossOrigin(String path, String method, Supplier<Optional<CrossOriginConfig>> secondaryLookup) Deprecated, for removal: This API element is subject to removal in a future version.Looks for a matching CORS config entry for the specified path among the provided CORS configuration information, returning anOptionalof the matchingCrossOrigininstance for the path, if any.toString()Deprecated, for removal: This API element is subject to removal in a future version.
-
Field Details
-
PATHLESS_KEY
Deprecated, for removal: This API element is subject to removal in a future version.Key value for the map corresponding to the cross-origin config managed by theCorsSettermethods.- See Also:
-
-
Method Details
-
isActive
public boolean isActive()Deprecated, for removal: This API element is subject to removal in a future version.Reports whether the sources of CORS information have left CORS active or not. This is a combination of any explicit setting ofenabledwith whether anyCrossOriginConfiginstances 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()Deprecated, for removal: This API element is subject to removal in a future version.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) Deprecated, for removal: This API element is subject to removal in a future version.Looks for a matching CORS config entry for the specified path among the provided CORS configuration information, returning anOptionalof the matchingCrossOrigininstance 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
Deprecated, for removal: This API element is subject to removal in a future version.
-
helidon-webserver-corswithio.helidon.webserver.cors.CorsFeatureeither fromServiceRegistry, or through one of the feature's static factory or builder methods; paths configured in config are registered first, before paths configured through service registry; this class will be removed in a future version of Helidon