public class CORSHandlerBuilder extends 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 and Description |
---|
CORSHandlerBuilder() |
Modifier and Type | Method and Description |
---|---|
CORSHandler |
build() |
static CORSConfigBuilder |
config()
A helper for creating a config object to pass to
withCORSConfig(CORSConfigBuilder) |
static CORSHandlerBuilder |
corsHandler()
A helper for creating a CORS handler
|
CORSHandlerBuilder |
withAllowedMethods(Method... methods)
Specifies the headers allowed for CORS requests.
|
CORSHandlerBuilder |
withCORSConfig(CORSConfig corsConfig)
Sets the CORS configuration for the handler
|
CORSHandlerBuilder |
withCORSConfig(CORSConfigBuilder corsConfig)
Sets the CORS configuration for the handler
|
public CORSHandlerBuilder withCORSConfig(CORSConfig corsConfig)
corsConfig
- The config to usepublic CORSHandlerBuilder withCORSConfig(CORSConfigBuilder corsConfig)
corsConfig
- The config to usepublic CORSHandlerBuilder withAllowedMethods(Method... methods)
methods
- The methods to allow, or null to allow all except Trace and Connect.public static CORSConfigBuilder config()
withCORSConfig(CORSConfigBuilder)
public static CORSHandlerBuilder corsHandler()
public CORSHandler build()
build
in interface MuHandlerBuilder<CORSHandler>
Copyright © 2017–2021. All rights reserved.