Annotation Type CORS


@Retention(RUNTIME) @Target(TYPE) public @interface CORS
Marks endpoints that should have CORS headers associated with it. Inject a CORSResponseDecorator to customize the response.
Author:
Tim Boudreau
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The added access control allowed headers.
    int
    The maximum age in seconds for cors responses.
    Set the methods cors responses are valid for.
    The set of origins cors responses apply to.
    boolean
    By default, returns true.
  • Element Details

    • value

      boolean value
      By default, returns true. Set to false to turn OFF CORS handling in the case that you have it enabled globally.
      Returns:
      Default:
      true
    • methods

      Method[] methods
      Set the methods cors responses are valid for. If unset or empty, the value will be derived from the registered paths in the application.
      Returns:
      A set of methods
      Default:
      {}
    • headers

      String[] headers
      The added access control allowed headers.
      Returns:
      A list of header names.
      Default:
      {}
    • origins

      String[] origins
      The set of origins cors responses apply to.
      Returns:
      Origins
      Default:
      {}
    • maxAgeSeconds

      int maxAgeSeconds
      The maximum age in seconds for cors responses.
      Returns:
      Default:
      0