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 MutinyDelegate, SecurityPolicyHandler, io.vertx.core.Handler<RoutingContext>, Consumer<RoutingContext>
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 using Vert.x codegen.

  • Field Details

  • Constructor Details

    • CorsHandler

      public CorsHandler(io.vertx.ext.web.handler.CorsHandler delegate)
    • CorsHandler

      public CorsHandler(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.ext.web.handler.CorsHandler getDelegate()
      Specified by:
      getDelegate in interface MutinyDelegate
      Specified by:
      getDelegate in interface SecurityPolicyHandler
      Returns:
      the delegate used by this Mutiny object of generated type
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • handle

      public void handle(RoutingContext arg0)
      Specified by:
      handle in interface io.vertx.core.Handler<RoutingContext>
      Specified by:
      handle in interface SecurityPolicyHandler
    • create

      @Deprecated public static CorsHandler create(String allowedOriginPattern)
      Deprecated.
      patterns should use the relative origin method. Create a CORS handler using a regular expression to match origins. An origin follows rfc6454#section-7 and is expected to have the format: <scheme> "://" <hostname> [ ":" <port> ]
      Parameters:
      allowedOriginPattern - the allowed origin pattern
      Returns:
      the handler
    • create

      public static CorsHandler create()
      Returns:
      the handler
    • addOrigin

      public CorsHandler addOrigin(String origin)
      Parameters:
      origin - the well formatted static origin
      Returns:
      self
    • addRelativeOrigins

      public CorsHandler addRelativeOrigins(List<String> origins)
      Parameters:
      origins - the well formatted relative origin list
      Returns:
      self
    • addRelativeOrigin

      public CorsHandler addRelativeOrigin(String origin)
      Parameters:
      origin - the well formatted static origin
      Returns:
      self
    • addOrigins

      public CorsHandler addOrigins(List<String> origins)
      Parameters:
      origins - the well formatted static origin list
      Returns:
      self
    • allowedMethod

      public CorsHandler allowedMethod(io.vertx.core.http.HttpMethod method)
      Parameters:
      method - the method to add
      Returns:
      a reference to this, so the API can be used fluently
    • allowedMethods

      public CorsHandler allowedMethods(Set<io.vertx.core.http.HttpMethod> methods)
      Parameters:
      methods - the methods to add
      Returns:
      a reference to this, so the API can be used fluently
    • allowedHeader

      public CorsHandler allowedHeader(String headerName)
      Parameters:
      headerName - the allowed header name
      Returns:
      a reference to this, so the API can be used fluently
    • allowedHeaders

      public CorsHandler allowedHeaders(Set<String> headerNames)
      Parameters:
      headerNames - the allowed header names
      Returns:
      a reference to this, so the API can be used fluently
    • exposedHeader

      public CorsHandler exposedHeader(String headerName)
      Parameters:
      headerName - the exposed header name
      Returns:
      a reference to this, so the API can be used fluently
    • exposedHeaders

      public CorsHandler exposedHeaders(Set<String> headerNames)
      Parameters:
      headerNames - the exposed header names
      Returns:
      a reference to this, so the API can be used fluently
    • allowCredentials

      public CorsHandler allowCredentials(boolean allow)
      Parameters:
      allow - true if allowed
      Returns:
      a reference to this, so the API can be used fluently
    • maxAgeSeconds

      public CorsHandler maxAgeSeconds(int maxAgeSeconds)
      Parameters:
      maxAgeSeconds - max age in seconds
      Returns:
      a reference to this, so the API can be used fluently
    • allowPrivateNetwork

      public CorsHandler allowPrivateNetwork(boolean allow)
      Parameters:
      allow - true if allowed
      Returns:
      a reference to this, so the API can be used fluently
    • accept

      public void accept(RoutingContext item)
      Specified by:
      accept in interface Consumer<RoutingContext>
      Specified by:
      accept in interface SecurityPolicyHandler
    • newInstance

      public static CorsHandler newInstance(io.vertx.ext.web.handler.CorsHandler arg)