Class CORSHandlerBuilder

  • All Implemented Interfaces:
    MuHandlerBuilder<CORSHandler>

    public class CORSHandlerBuilder
    extends java.lang.Object
    implements MuHandlerBuilder<CORSHandler>

    Used to create a handler that puts appropriate CORS headers on requests.

    Simply add this handler before any other handlers that you want CORS headers added to.

    • Constructor Detail

      • CORSHandlerBuilder

        public CORSHandlerBuilder()
    • Method Detail

      • withCORSConfig

        public CORSHandlerBuilder withCORSConfig​(CORSConfig corsConfig)
        Sets the CORS configuration for the handler
        Parameters:
        corsConfig - The config to use
        Returns:
        This builder
      • withCORSConfig

        public CORSHandlerBuilder withCORSConfig​(CORSConfigBuilder corsConfig)
        Sets the CORS configuration for the handler
        Parameters:
        corsConfig - The config to use
        Returns:
        This builder
      • withAllowedMethods

        public CORSHandlerBuilder withAllowedMethods​(Method... methods)
        Specifies the headers allowed for CORS requests. Defaults to all methods except Trace and Connect.
        Parameters:
        methods - The methods to allow, or null to allow all except Trace and Connect.
        Returns:
        This builder.
      • corsHandler

        public static CORSHandlerBuilder corsHandler()
        A helper for creating a CORS handler
        Returns:
        A new builder.