Entry( final String url, final String method, final AmazonHttpHandler handler ) { this.asString = method + " " + url; this.handler = handler; this.matcher = URLMatcher.compile( url, true ); }
public Entry( final String url, final HttpHandler handler ) { this.handler = handler; this.matcher = URLMatcher.compile( url, true ); this.url = url; }
public static URLMatcher compile( final String string ) { return compile( string, false ); }
public static HttpHandler create( HttpHandler next, String url, Map<String, Object> headers ) { final Map<String, URLMatcher> convertedHeaders = new HashMap<>(); for ( Entry<String, Object> header : headers.entrySet() ){ final URLMatcher matcher = URLMatcher.compile( String.valueOf( header.getValue() ) ); convertedHeaders.put( header.getKey(), matcher ); } final URLMatcher urlMatcher = URLMatcher.compile( url ); return new StaticHeadersHttpHandler( next, urlMatcher, convertedHeaders ); } }
public static RequestMatcher from(final String path ) { return new VirtualHostMatcher( URLMatcher.compile( path ) ); } }
public static RequestMatcher from(final String path ) { return new PathMatcher( URLMatcher.compile( path ) ); } }
private List<URLMatcher> convertToURLMatcher( final List<String> urls ) { final List<URLMatcher> matchers = new TinyList<>(); for ( final String url : urls ) matchers.add( URLMatcher.compile( url ) ); return matchers; } }
public AuthenticationRule( @NonNull final String pattern, @NonNull final List<IdentityManager> identityManagers, @NonNull final List<AuthenticationMechanism> mechanisms, @NonNull final List<String> expectedRoles, @NonNull final List<String> exceptionPatterns, final boolean authenticationRequired) // CHECKED { this.pattern = pattern; this.matcher = URLMatcher.compile( pattern ); this.identityManagers = identityManagers; this.mechanisms = mechanisms; this.expectedRoles = expectedRoles; this.exceptionPatterns = convertToURLMatcher( exceptionPatterns ); this.authenticationRequired = authenticationRequired; if ( isInvalid() ) throw new UnsupportedOperationException( MSG_INVALID_RULE + toString() ); }
public static Filter from(final SmartRouteRule rule ) { return new RedirectionFilter( DefaultMatcher.from( rule ), URLMatcher.compile( rule.target() ) ); } }
public static HttpHandler from(final SmartRouteRule rule, final HttpHandler next ) { return new RewriteRequestHttpHandler( DefaultMatcher.from( rule ), URLMatcher.compile( rule.target() ), next ); } }
HttpHandler wrappedWebsocketHandlerFrom( final WebSocketHandler handler, final WebResource webResource ) { final String url = URL.removeTrailingCharacter( webResource.path() ); final URLMatcher urlMatcher = URLMatcher.compile( "{protocol}://{host}" + url ); final WebSocketConnectionCallback callbackHandler = new WebSocketConnectionCallbackHandler( handler, urlMatcher ,serializer, unserializer, executorService ); return Handlers.websocket( callbackHandler ); }
private void deployReverseProxyRoutes(final DeploymentContext context) throws URISyntaxException, NoSuchAlgorithmException, NoSuchProviderException, KeyManagementException { var lastHandler = context.rootHandler(); val ssl = new UndertowXnioSsl( Xnio.getInstance(), OptionMap.EMPTY ); val options = isHttp2EnabledForProxy ? OptionMap.create(UndertowOptions.ENABLE_HTTP2, true) : OptionMap.EMPTY ; if ( !reverseRoutes.isEmpty() ) log.info( "Reverse Proxy rules:" ); for ( val rule : reverseRoutes ) { log.info( " > " + rule ); val target = URLMatcher.compile( rule.target() ); val proxyClient = createClientFor( rule, target, ssl, options ); lastHandler = new ProxyHandler( proxyClient, lastHandler ); } context.rootHandler( lastHandler ); }
private void deployWebJarStaticRouting(Config staticConfig, DeploymentContext context) { if ( staticConfig.getBoolean("webjar-enabled" ) ) { final String urlPrefix = staticConfig.getString("webjar-url-prefix").replaceFirst( "/$", "" ); log.info( "Enabling static routing for webjars at '" + urlPrefix + "'" ); final String webJarInternalLocation = staticConfig.getString("webjar-location", DEFAULT_WEBJAR_LOCATION); final ResourceManager resourceManager = SystemResource.loadResourceManagerFor( webJarInternalLocation ); final HttpHandler webjarHandler = new WebJarHttpHandler( new ResourceHandler(resourceManager, new WebJarNotFound( context.fallbackHandler() ) ), URLMatcher.compile( urlPrefix + "/{path}" ), context.fallbackHandler()); context.fallbackHandler( webjarHandler ); } }