Package org.apache.tapestry5.http.internal.services

## Class DefaultCorsHandler

- java.lang.Object
- - org.apache.tapestry5.http.internal.services.DefaultCorsHandler

- All Implemented Interfaces:
    `CorsHandler`

      public class DefaultCorsHandler
      extends java.lang.Object
      implements CorsHandler

  Default `CorsHandler` implementation. It will process all requests with an Origin HTTP header, regardless of path. It will also perform preflight requests if `CorsHandlerHelper.isPreflight(HttpServletRequest)` returns `true`. Most logic is delegated is `CorsHandlerHelper`.

  This implementation is inspired by the cors NPM module.

  Since:
    5.8.2
  See Also:
    `CorsHandlerHelper`

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultCorsHandler​(CorsHandlerHelper helper)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `CorsHandlerResult` | `handle​(HttpServletRequest request, HttpServletResponse response)` | Handles the CORS processing of a request, possibly doing nothing.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultCorsHandler

          public DefaultCorsHandler​(CorsHandlerHelper helper)

  - ### Method Detail

    - #### handle

          public CorsHandlerResult handle​(HttpServletRequest request,
                                          HttpServletResponse response)
                                   throws java.io.IOException

      Description copied from interface: `CorsHandler`
      Handles the CORS processing of a request, possibly doing nothing. This method cannot return `null`.
      Specified by:
        `handle` in interface `CorsHandler`
      Returns:
        a CorsHandlerResult object.
      Throws:
        `java.io.IOException`