Class Aggregator

java.lang.Object
io.helidon.cors.Aggregator

@Deprecated(forRemoval=true, since="4.4.0") public class Aggregator extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
this module will be removed, CORS configuration is centralized to module helidon-webserver-cors with io.helidon.webserver.cors.CorsFeature either from ServiceRegistry, 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
Collects CORS set-up information from various sources and looks up the relevant CORS information given a request's path and HTTP method.

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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    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 the CorsSetter methods.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    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.
    boolean
    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.
    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 an Optional of the matching CrossOrigin instance for the path, if any.
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • PATHLESS_KEY

      public static final String 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 the CorsSetter methods.
      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 of enabled with whether any CrossOriginConfig 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()
      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 an Optional of the matching CrossOrigin instance for the path, if any.
      Parameters:
      path - the unnormalized request path to check
      method - HTTP method
      secondaryLookup - Supplier for CrossOrigin used if none found in config
      Returns:
      Optional<CrossOriginConfig> for the matching config, or an empty Optional if none matched
    • toString

      public String toString()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      toString in class Object