Package io.vertx.mutiny.ext.web.handler
Class CorsHandler
java.lang.Object
io.vertx.mutiny.ext.web.handler.CorsHandler
- All Implemented Interfaces:
MutinyDelegate,io.vertx.core.Handler<RoutingContext>,SecurityPolicyHandler,Consumer<RoutingContext>
public class CorsHandler
extends Object
implements SecurityPolicyHandler, io.vertx.core.Handler<RoutingContext>, Consumer<RoutingContext>, MutinyDelegate
A handler which implements server side http://www.w3.org/TR/cors/[CORS] support for Vert.x-Web.
NOTE: This class has been automatically generated from the original non Mutiny-ified interface.
- Author:
- Tim Fox, Paulo Lopes
- See Also:
-
CorsHandler
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.vertx.mutiny.ext.web.handler.SecurityPolicyHandler
SecurityPolicyHandler.SecurityPolicyHandlerImpl -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCorsHandler(io.vertx.ext.web.handler.CorsHandler delegate) Create a new instance ofCorsHandlerdelegating to the given (non-null) instance ofCorsHandler.CorsHandler(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(RoutingContext item) Handle an item.Add an origin to the list of allowed Origins.addOrigins(List<String> origins) Set the list of allowed origins.addOriginsWithRegex(List<String> origins) Set the list of allowed regex origins.addOriginWithRegex(String origin) Add a regex origin to the list of allowed Origins.allowCredentials(boolean allow) Set whether credentials are allowed.allowedHeader(String headerName) Add an allowed headerallowedHeaders(Set<String> headerNames) Add a set of allowed headersallowedMethod(io.vertx.core.http.HttpMethod method) Add an allowed methodallowedMethods(Set<io.vertx.core.http.HttpMethod> methods) Add a set of allowed methodsallowPrivateNetwork(boolean allow) Set whether access from public to private networks are allowed.static CorsHandlercreate()Create a empty CORS handler that allows*origin.booleanexposedHeader(String headerName) Add an exposed headerexposedHeaders(Set<String> headerNames) Add a set of exposed headersio.vertx.ext.web.handler.CorsHandlerGet the delegate instance.voidhandle(RoutingContext item) Handle an item.inthashCode()maxAgeSeconds(int maxAgeSeconds) Set how long the browser should cache the informationstatic CorsHandlernewInstance(io.vertx.ext.web.handler.CorsHandler delegate) Creates a new instance of theCorsHandler.toString()
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
CorsHandler
public CorsHandler(io.vertx.ext.web.handler.CorsHandler delegate) Create a new instance ofCorsHandlerdelegating to the given (non-null) instance ofCorsHandler. -
CorsHandler
-
-
Method Details
-
accept
Handle an item. This method is generated from theoriginalmethod."- Specified by:
acceptin interfaceConsumer<RoutingContext>- Specified by:
acceptin interfaceSecurityPolicyHandler
-
handle
Handle an item. This method is generated from theoriginalmethod."- Specified by:
handlein interfaceio.vertx.core.Handler<RoutingContext>- Specified by:
handlein interfaceSecurityPolicyHandler
-
getDelegate
public io.vertx.ext.web.handler.CorsHandler getDelegate()Get the delegate instance.This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.
- Specified by:
getDelegatein interfaceMutinyDelegate- Specified by:
getDelegatein interfaceSecurityPolicyHandler- Returns:
- the delegate instance
-
create
Create a empty CORS handler that allows*origin.- Returns:
- the handler
-
addOrigin
Add an origin to the list of allowed Origins. An origin follows rfc6454#section-7 and is expected to have the format:<scheme> "://" <hostname> [ ":" <port> ]- Parameters:
origin- the well formatted static origin- Returns:
- self
-
addOriginsWithRegex
Set the list of allowed regex origins. A regex origin is a pattern that should match the format<scheme> "://" <hostname> [ ":" <port> ].- Parameters:
origins- the well formatted regex origin list- Returns:
- self
-
addOriginWithRegex
Add a regex origin to the list of allowed Origins. A regex origin is a pattern that should match the format<scheme> "://" <hostname> [ ":" <port> ].- Parameters:
origin- the well formatted static origin- Returns:
- self
-
addOrigins
Set the list of allowed origins. An origin follows rfc6454#section-7 and is expected to have the format:<scheme> "://" <hostname> [ ":" <port> ]- Parameters:
origins- the well formatted static origin list- Returns:
- self
-
allowedMethod
Add an allowed method- Parameters:
method- the method to add- Returns:
- a reference to this, so the API can be used fluently
-
allowedMethods
Add a set of allowed methods- Parameters:
methods- the methods to add- Returns:
- a reference to this, so the API can be used fluently
-
allowedHeader
Add an allowed header- Parameters:
headerName- the allowed header name- Returns:
- a reference to this, so the API can be used fluently
-
allowedHeaders
Add a set of allowed headers- Parameters:
headerNames- the allowed header names- Returns:
- a reference to this, so the API can be used fluently
-
exposedHeader
Add an exposed header- Parameters:
headerName- the exposed header name- Returns:
- a reference to this, so the API can be used fluently
-
exposedHeaders
Add a set of exposed headers- Parameters:
headerNames- the exposed header names- Returns:
- a reference to this, so the API can be used fluently
-
allowCredentials
Set whether credentials are allowed. Note that user agents will block requests that use a wildcard as origin and include credentials. From the MDN documentation you can read:Important note: when responding to a credentialed request, server must specify a domain, and cannot use wild carding.
- Parameters:
allow- true if allowed- Returns:
- a reference to this, so the API can be used fluently
-
maxAgeSeconds
Set how long the browser should cache the information- Parameters:
maxAgeSeconds- max age in seconds- Returns:
- a reference to this, so the API can be used fluently
-
allowPrivateNetwork
Set whether access from public to private networks are allowed. Defaults to false- Parameters:
allow- true if allowed- Returns:
- a reference to this, so the API can be used fluently
-
newInstance
Creates a new instance of theCorsHandler. -
hashCode
public int hashCode() -
equals
-
toString
-