Class CORSFilter
- java.lang.Object
-
- io.quarkus.vertx.http.runtime.cors.CORSFilter
-
- All Implemented Interfaces:
io.vertx.core.Handler<io.vertx.ext.web.RoutingContext>
public class CORSFilter extends Object implements io.vertx.core.Handler<io.vertx.ext.web.RoutingContext>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) List<Pattern>allowedOriginsRegex(package private) CORSConfigcorsConfig
-
Constructor Summary
Constructors Constructor Description CORSFilter(CORSConfig corsConfig)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidhandle(io.vertx.ext.web.RoutingContext event)static booleanisConfiguredWithWildcard(Optional<List<String>> optionalList)static booleanisOriginAllowedByRegex(List<Pattern> allowOriginsRegex, String origin)If any regular expression origins are configured, try to match on them.static List<Pattern>parseAllowedOriginsRegex(Optional<List<String>> allowedOrigins)Parse the provided allowed origins for any regexes
-
-
-
Field Detail
-
corsConfig
final CORSConfig corsConfig
-
-
Constructor Detail
-
CORSFilter
public CORSFilter(CORSConfig corsConfig)
-
-
Method Detail
-
isConfiguredWithWildcard
public static boolean isConfiguredWithWildcard(Optional<List<String>> optionalList)
-
parseAllowedOriginsRegex
public static List<Pattern> parseAllowedOriginsRegex(Optional<List<String>> allowedOrigins)
Parse the provided allowed origins for any regexes- Parameters:
allowedOrigins-- Returns:
- a list of compiled regular expressions. If none configured, and empty list is returned
-
isOriginAllowedByRegex
public static boolean isOriginAllowedByRegex(List<Pattern> allowOriginsRegex, String origin)
If any regular expression origins are configured, try to match on them. Regular expressions must begin and end with '/'- Parameters:
allowedOrigins- the configured regex origins.origin- the specified origin- Returns:
- true if any configured regular expressions match the specified origin, false otherwise
-
handle
public void handle(io.vertx.ext.web.RoutingContext event)
- Specified by:
handlein interfaceio.vertx.core.Handler<io.vertx.ext.web.RoutingContext>
-
-