Class CorsSupportHelper<Q,R>

java.lang.Object
io.helidon.cors.CorsSupportHelper<Q,R>
Type Parameters:
Q - type of request wrapped by request adapter
R - type of response wrapped by response adapter

@Deprecated(forRemoval=true, since="4.4.0") public class CorsSupportHelper<Q,R> 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
Centralizes internal CORS support common logic for processing requests and preparing responses.

This class is reserved for internal Helidon use. Do not use it from your applications. It might change or vanish at any time.

To serve all masters, several methods here accept adapters for requests and responses. Both of these are minimal and very specific to the needs of CORS support.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Deprecated, for removal: This API element is subject to removal in a future version.
    Builder class for CorsSupportHelpers.
    static enum 
    Deprecated, for removal: This API element is subject to removal in a future version.
    Not for use by developers. CORS-related classification of HTTP requests.
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
    Aggregator that combines configuration and provides information based on request.
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Reports whether this helper, due to its set-up, will have a chance of affecting any requests or responses.
    static String
    Deprecated, for removal: This API element is subject to removal in a future version.
    Trim leading or trailing slashes of a path.
    static Set<String>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Parse list header value as a set.
    static Set<String>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Parse a list of list of headers as a set.
    void
    prepareResponse(CorsRequestAdapter<Q> requestAdapter, CorsResponseAdapter<R> responseAdapter)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Prepares a response with CORS headers, if the supplied request is in fact a CORS request and if upstream processing has not already determined the request should be refused.
    processRequest(CorsRequestAdapter<Q> requestAdapter, CorsResponseAdapter<R> responseAdapter)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Processes a request according to the CORS rules, returning an Optional of the response type if the caller should send the response immediately (such as for a preflight response or an error response to a non-preflight CORS request).
    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
  • Method Details

    • normalize

      public static String normalize(String path)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Trim leading or trailing slashes of a path.
      Parameters:
      path - The path.
      Returns:
      Normalized path.
    • parseHeader

      public static Set<String> parseHeader(String header)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parse list header value as a set.
      Parameters:
      header - Header value as a list.
      Returns:
      Set of header values.
    • parseHeader

      public static Set<String> parseHeader(List<String> headers)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parse a list of list of headers as a set.
      Parameters:
      headers - Header value as a list, each a potential list.
      Returns:
      Set of header values.
    • isActive

      public boolean isActive()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Reports whether this helper, due to its set-up, will have a chance of affecting any requests or responses.
      Returns:
      whether the helper might have any effect on requests or responses
    • processRequest

      public Optional<R> processRequest(CorsRequestAdapter<Q> requestAdapter, CorsResponseAdapter<R> responseAdapter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Processes a request according to the CORS rules, returning an Optional of the response type if the caller should send the response immediately (such as for a preflight response or an error response to a non-preflight CORS request).

      If the optional is empty, this processor has either:

      • recognized the request as a valid non-preflight CORS request and has set headers in the response adapter, or
      • recognized the request as a non-CORS request entirely.

      In either case of an empty optional return value, the caller should proceed with its own request processing and sends its response at will as long as that processing includes the header settings assigned using the response adapter.

      Parameters:
      requestAdapter - abstraction of a request
      responseAdapter - abstraction of a response
      Returns:
      Optional of an error response if the request was an invalid CORS request; Optional.empty() if it was a valid CORS request
    • toString

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

      public void prepareResponse(CorsRequestAdapter<Q> requestAdapter, CorsResponseAdapter<R> responseAdapter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Prepares a response with CORS headers, if the supplied request is in fact a CORS request and if upstream processing has not already determined the request should be refused.
      Parameters:
      requestAdapter - abstraction of a request
      responseAdapter - abstraction of a response
    • aggregator

      public Aggregator aggregator()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Aggregator that combines configuration and provides information based on request.
      Returns:
      aggregator