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 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

  Modifier and Type
  Method
  Description
  `CorsHandlerResult`
  `handle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.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 Details

  - ### DefaultCorsHandler

    public DefaultCorsHandler(CorsHandlerHelper helper)

- ## Method Details

  - ### handle

    public CorsHandlerResult handle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws 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:
      `IOException`