Module io.jooby

Class CorsHandler

java.lang.Object
io.jooby.handler.CorsHandler
All Implemented Interfaces:
Route.Aware, Route.Filter

public class CorsHandler extends Object implements Route.Filter
Handle preflight and simple CORS requests. CORS options are set via: Cors.
Since:
2.0.4
Author:
edgar
See Also:
  • Constructor Details

    • CorsHandler

      public CorsHandler(@NonNull Cors options)
      Creates a new CorsHandler.
      Parameters:
      options - Cors options, or empty for using default options.
    • CorsHandler

      public CorsHandler()
      Creates a new CorsHandler with default options.
  • Method Details

    • apply

      @NonNull public Route.Handler apply(@NonNull Route.Handler next)
      Description copied from interface: Route.Filter
      Chain the filter within next handler.
      Specified by:
      apply in interface Route.Filter
      Parameters:
      next - Next handler.
      Returns:
      A new handler.
    • setRoute

      @NonNull public void setRoute(@NonNull Route route)
      Description copied from interface: Route.Aware
      Allows a handler to listen for route metadata.
      Specified by:
      setRoute in interface Route.Aware
      Parameters:
      route - Route metadata.