/** * Creates a new path handler * * @return A new path handler */ public static PathHandler path() { return new PathHandler(); }
/** * Creates a new path handler, with the default handler specified * * @param defaultHandler The default handler * @return A new path handler */ public static PathHandler path(final HttpHandler defaultHandler) { return new PathHandler(defaultHandler); }
public PathResourceHandler() { PathResourceConfig config = (PathResourceConfig)Config.getInstance().getJsonObjectConfig(PathResourceConfig.CONFIG_NAME, PathResourceConfig.class); if(config.isPrefix()) { pathHandler = new PathHandler() .addPrefixPath(config.getPath(), new ResourceHandler(new PathResourceManager(Paths.get(config.getBase()), config.getTransferMinSize())) .setDirectoryListingEnabled(config.isDirectoryListingEnabled())); } else { pathHandler = new PathHandler() .addExactPath(config.getPath(), new ResourceHandler(new PathResourceManager(Paths.get(config.getBase()), config.getTransferMinSize())) .setDirectoryListingEnabled(config.isDirectoryListingEnabled())); } }
public VirtualHostHandler() { VirtualHostConfig config = (VirtualHostConfig)Config.getInstance().getJsonObjectConfig(VirtualHostConfig.CONFIG_NAME, VirtualHostConfig.class); virtualHostHandler = new NameVirtualHostHandler(); for(VirtualHost host: config.hosts) { virtualHostHandler.addHost(host.domain, new PathHandler().addPrefixPath(host.getPath(), new ResourceHandler((new PathResourceManager(Paths.get(host.getBase()), host.getTransferMinSize()))).setDirectoryListingEnabled(host.isDirectoryListingEnabled()))); } }
public HttpHandler createHttpHandler() { PathHandler pathHandler = new PathHandler(); pathHandler.addPrefixPath("/v1/invoke", new AllowedMethodsHandler(new HttpInvocationHandler(association, executorService, localTransactionContext, cancellationFlags), Methods.POST)) .addPrefixPath("/v1/open", new AllowedMethodsHandler(new HttpSessionOpenHandler(association, executorService, localTransactionContext), Methods.POST)) .addPrefixPath("/v1/cancel", new AllowedMethodsHandler(new HttpCancelHandler(association, executorService, localTransactionContext, cancellationFlags), Methods.DELETE)); EncodingHandler encodingHandler = new EncodingHandler(pathHandler, new ContentEncodingRepository().addEncodingHandler(Headers.GZIP.toString(), new GzipEncodingProvider(), 1)); RequestEncodingHandler requestEncodingHandler = new RequestEncodingHandler(encodingHandler); requestEncodingHandler.addEncoding(Headers.GZIP.toString(), GzipStreamSourceConduit.WRAPPER); return requestEncodingHandler; }
/** * Creates a new path handler, with the default handler specified * * @param defaultHandler The default handler * @return A new path handler */ public static PathHandler path(final HttpHandler defaultHandler) { return new PathHandler(defaultHandler); }
/** * Creates a new path handler * * @return A new path handler */ public static PathHandler path() { return new PathHandler(); }
/** * Creates a new path handler * * @return A new path handler */ public static PathHandler path() { return new PathHandler(); }
/** * Creates a new path handler, with the default handler specified * * @param defaultHandler The default handler * @return A new path handler */ public static PathHandler path(final HttpHandler defaultHandler) { return new PathHandler(defaultHandler); }
public UndertowServer(int port, String host) { builder = Undertow.builder().addHttpListener(port, host); pathHandler = new PathHandler(); }
public Pathology() { vhostHandler = new NameVirtualHostHandler(); pathHandler = new PathHandler(); vhostHandler.setDefaultHandler(pathHandler); }
@Override public HttpContext getHttpContext() { if (context == null) { context = new UndertowHttpContext(new PathHandler(), PathUtils.getContextPathFromRequest(undertowExchange.getRequestPath()), PathUtils.getPathFromRequest(undertowExchange.getRequestPath())); } return context; }
@Override protected void before() throws Throwable { LOG.info("Creating http server {}:{}", getHostname(), getPort()); this.pathHandler = new PathHandler(); for (Map.Entry<String, Object> entry : this.resources.entrySet()) { final String path = entry.getKey(); final Object resource = entry.getValue(); addResource(path, resource); } this.server = Undertow.builder().addHttpListener(this.port, this.hostname).setHandler(pathHandler).build(); LOG.info("Starting HTTP server"); this.server.start(); LOG.info("HTTP Server running"); }
public synchronized boolean add(String path, List<String> vhosts, HttpHandler handler) { boolean result = false; if (vhosts == null) { result = null != activeHandlers.put(path, handler); pathHandler.addPrefixPath(path, handler); } else { for(String host: vhosts) { result = (null != activeHandlers.put(host + path, handler)) || result; PathHandler ph = (PathHandler) vhostHandler.getHosts().get(host); if (ph == null) { ph = new PathHandler(); vhostHandler.addHost(host, ph); } ph.addPrefixPath(path, handler); } } purge(); return result; }
public synchronized Pair<PathHandler, Undertow> getServer(int port, String hostName, SSLContext context) { Pair<PathHandler, Undertow> pair = serverMap.get(port); if (pair == null) { PathHandler pathHandler = new PathHandler(); Undertow.Builder builder = Undertow.builder() .setIoThreads(UNDERTOW_IO_THREADS) .setWorkerThreads(UNDERTOW_WORKER_THREADS); Undertow server = customize(builder,pathHandler,port,hostName,context).build(); server.start(); pair = new Pair<>(pathHandler,server); serverMap.put(port,pair); } return pair; }
private static Undertow startServer() { HttpHandler staticRoutes = new PathHandler(getBasicRoutes()) .addPrefixPath("/assets", timed("getAssets", CustomHandlers.resource("", (int)TimeUnit.DAYS.toSeconds(30)))); SimpleServer server = SimpleServer.simpleServer(wrapWithMiddleware(staticRoutes)); return server.start(); }
//Create a style. We want a blue dashed line. final Style drawStyle = new Style(); //create a Style to use drawStyle.setFillColor("white"); drawStyle.setGraphicName("x"); drawStyle.setPointRadius(4); drawStyle.setStrokeWidth(3); drawStyle.setStrokeColor("#66FFFF"); drawStyle.setStrokeDashstyle("dash"); //create a StyleMap using the Style StyleMap drawStyleMap = new StyleMap(drawStyle); //Create PathHanlderOptions using this StyleMap PathHandlerOptions phOpt = new PathHandlerOptions(); phOpt.setStyleMap(drawStyleMap); //Create DrawFeatureOptions and set the PathHandlerOptions (that have the StyleMap, that have the Style we wish) DrawFeatureOptions drawFeatureOptions = new DrawFeatureOptions(); drawFeatureOptions.setHandlerOptions(phOpt); PathHandler pathHanlder = new PathHandler(); // Create the DrawFeature control to draw on the map, and pass the DrawFeatureOptions to control the style of the sketch final DrawFeature drawLine = new DrawFeature(vectorLayer, pathHanlder, drawFeatureOptions); map.addControl(drawLine); drawLine.activate();
private void initPathHandler() { this.pathHandler = new PathHandler(initRoutingHandler()); for (Route route : Router.getRoutes()) { if (RouteType.WEBSOCKET.equals(route.getRouteType())) { this.pathHandler.addExactPath(route.getUrl(), Handlers.websocket(new WebSocketHandler(route.getControllerClass()))); } else if (RouteType.RESOURCE_PATH.equals(route.getRouteType())) { this.pathHandler.addPrefixPath(route.getUrl(), getResourceHandler(route.getUrl())); } } }
public HttpHandler createHttpHandler() { PathHandler pathHandler = new PathHandler(); pathHandler.addPrefixPath("/v1/invoke", new AllowedMethodsHandler(new HttpInvocationHandler(association, executorService, localTransactionContext, cancellationFlags), Methods.POST)) .addPrefixPath("/v1/open", new AllowedMethodsHandler(new HttpSessionOpenHandler(association, executorService, localTransactionContext), Methods.POST)) .addPrefixPath("/v1/cancel", new AllowedMethodsHandler(new HttpCancelHandler(association, executorService, localTransactionContext, cancellationFlags), Methods.DELETE)); EncodingHandler encodingHandler = new EncodingHandler(pathHandler, new ContentEncodingRepository().addEncodingHandler(Headers.GZIP.toString(), new GzipEncodingProvider(), 1)); RequestEncodingHandler requestEncodingHandler = new RequestEncodingHandler(encodingHandler); requestEncodingHandler.addEncoding(Headers.GZIP.toString(), GzipStreamSourceConduit.WRAPPER); return requestEncodingHandler; }
public HttpHandler createHttpHandler() { PathHandler pathHandler = new PathHandler(); pathHandler.addPrefixPath("/v1/invoke", new AllowedMethodsHandler(new HttpInvocationHandler(association, executorService, localTransactionContext, cancellationFlags), Methods.POST)) .addPrefixPath("/v1/open", new AllowedMethodsHandler(new HttpSessionOpenHandler(association, executorService, localTransactionContext), Methods.POST)) .addPrefixPath("/v1/cancel", new AllowedMethodsHandler(new HttpCancelHandler(association, executorService, localTransactionContext, cancellationFlags), Methods.DELETE)); EncodingHandler encodingHandler = new EncodingHandler(pathHandler, new ContentEncodingRepository().addEncodingHandler(Headers.GZIP.toString(), new GzipEncodingProvider(), 1)); RequestEncodingHandler requestEncodingHandler = new RequestEncodingHandler(encodingHandler); requestEncodingHandler.addEncoding(Headers.GZIP.toString(), GzipStreamSourceConduit.WRAPPER); return requestEncodingHandler; }