StaticHttpHandler localHandler = new StaticHttpHandler( params.clientDirectory.getAbsolutePath()); localHandler.setFileCacheEnabled(false);
protected HttpHandler getHttpHandler() { return new StaticHttpHandler("."); }
protected HttpHandler getHttpHandler() { return new StaticHttpHandler("."); }
httpServer.getServerConfiguration().addHttpHandler(new StaticHttpHandler("<basepath>/lib"),"/lib"); httpServer.getServerConfiguration().addHttpHandler(new StaticHttpHandler("<basepath>/css"),"/css"); ...
StaticHttpHandler staticHttpHandler = new StaticHttpHandler("/www/static/"); server.getServerConfiguration().addHttpHandler(staticHttpHandler, "/");
server.getServerConfiguration().addHttpHandler(new StaticHttpHandler("src/main/webapp"), "/static", "/index.html");
server.getServerConfiguration().addHttpHandler(new StaticHttpHandler("src/main/webapp"), "/");
/** * Add a handler for temporaty files. * * Server Java temporary files on /temp */ private void addTempFileHandler() { StaticHttpHandler staticHttpHandler = new StaticHttpHandler(System.getProperty("java.io.tmpdir")); staticHttpHandler.setFileCacheEnabled(false); httpServer.getServerConfiguration().addHttpHandler(staticHttpHandler, "/temp"); }
/** * @param docRoot the document root, * can be <code>null</code> when no static pages are needed * @param host the network port to which this listener will bind * @param range port range to attempt to bind to * * @return a <code>HttpServer</code> configured to listen to requests * on <code>host</code>:<code>[port-range]</code>, * using the specified <code>docRoot</code> as the server's document root */ public static HttpServer createSimpleServer(final String docRoot, final String host, final PortRange range) { final HttpServer server = new HttpServer(); final ServerConfiguration config = server.getServerConfiguration(); if (docRoot != null) { config.addHttpHandler(new StaticHttpHandler(docRoot), "/"); } final NetworkListener listener = new NetworkListener("grizzly", host, range); server.addListener(listener); return server; }
/** * @param docRoot the document root, * can be <code>null</code> when no static pages are needed * @param host the network port to which this listener will bind * @param range port range to attempt to bind to * * @return a <code>HttpServer</code> configured to listen to requests * on <code>host</code>:<code>[port-range]</code>, * using the specified <code>docRoot</code> as the server's document root */ public static HttpServer createSimpleServer(final String docRoot, final String host, final PortRange range) { final HttpServer server = new HttpServer(); final ServerConfiguration config = server.getServerConfiguration(); if (docRoot != null) { config.addHttpHandler(new StaticHttpHandler(docRoot), "/"); } final NetworkListener listener = new NetworkListener("grizzly", host, range); server.addListener(listener); return server; }
/** * @param docRoot the document root, * can be <code>null</code> when no static pages are needed * @param host the network port to which this listener will bind * @param range port range to attempt to bind to * * @return a <code>HttpServer</code> configured to listen to requests * on <code>host</code>:<code>[port-range]</code>, * using the specified <code>docRoot</code> as the server's document root */ public static HttpServer createSimpleServer(final String docRoot, final String host, final PortRange range) { final HttpServer server = new HttpServer(); final ServerConfiguration config = server.getServerConfiguration(); if (docRoot != null) { config.addHttpHandler(new StaticHttpHandler(docRoot), "/"); } final NetworkListener listener = new NetworkListener("grizzly", host, range); server.addListener(listener); return server; }
/** * @param docRoot the document root, * can be <code>null</code> when no static pages are needed * @param host the network port to which this listener will bind * @param range port range to attempt to bind to * * @return a <code>HttpServer</code> configured to listen to requests * on <code>host</code>:<code>[port-range]</code>, * using the specified <code>docRoot</code> as the server's document root */ public static HttpServer createSimpleServer(final String docRoot, final String host, final PortRange range) { final HttpServer server = new HttpServer(); final ServerConfiguration config = server.getServerConfiguration(); if (docRoot != null) { config.addHttpHandler(new StaticHttpHandler(docRoot), "/"); } final NetworkListener listener = new NetworkListener("grizzly", host, range); server.addListener(listener); return server; }
/** * @param docRoot the document root, * can be <code>null</code> when no static pages are needed * @param host the network port to which this listener will bind * @param range port range to attempt to bind to * * @return a <code>HttpServer</code> configured to listen to requests * on <code>host</code>:<code>[port-range]</code>, * using the specified <code>docRoot</code> as the server's document root */ public static HttpServer createSimpleServer(final String docRoot, final String host, final PortRange range) { final HttpServer server = new HttpServer(); final ServerConfiguration config = server.getServerConfiguration(); if (docRoot != null) { config.addHttpHandler(new StaticHttpHandler(docRoot), "/"); } final NetworkListener listener = new NetworkListener("grizzly", host, range); server.addListener(listener); return server; }
/** * @param docRoot the document root, * can be <code>null</code> when no static pages are needed * @param host the network port to which this listener will bind * @param range port range to attempt to bind to * * @return a <code>HttpServer</code> configured to listen to requests * on <code>host</code>:<code>[port-range]</code>, * using the specified <code>docRoot</code> as the server's document root */ public static HttpServer createSimpleServer(final String docRoot, final String host, final PortRange range) { final HttpServer server = new HttpServer(); final ServerConfiguration config = server.getServerConfiguration(); if (docRoot != null) { config.addHttpHandler(new StaticHttpHandler(docRoot), "/"); } final NetworkListener listener = new NetworkListener("grizzly", host, range); server.addListener(listener); return server; }
/** * @param docRoot the document root, * can be <code>null</code> when no static pages are needed * @param host the network port to which this listener will bind * @param range port range to attempt to bind to * * @return a <code>HttpServer</code> configured to listen to requests * on <code>host</code>:<code>[port-range]</code>, * using the specified <code>docRoot</code> as the server's document root */ public static HttpServer createSimpleServer(final String docRoot, final String host, final PortRange range) { final HttpServer server = new HttpServer(); final ServerConfiguration config = server.getServerConfiguration(); if (docRoot != null) { config.addHttpHandler(new StaticHttpHandler(docRoot), "/"); } final NetworkListener listener = new NetworkListener("grizzly", host, range); server.addListener(listener); return server; }
/** * @param docRoot the document root, * can be <code>null</code> when no static pages are needed * @param host the network port to which this listener will bind * @param range port range to attempt to bind to * * @return a <code>HttpServer</code> configured to listen to requests * on <code>host</code>:<code>[port-range]</code>, * using the specified <code>docRoot</code> as the server's document root */ public static HttpServer createSimpleServer(final String docRoot, final String host, final PortRange range) { final HttpServer server = new HttpServer(); final ServerConfiguration config = server.getServerConfiguration(); if (docRoot != null) { config.addHttpHandler(new StaticHttpHandler(docRoot), "/"); } final NetworkListener listener = new NetworkListener("grizzly", host, range); server.addListener(listener); return server; }
/** * @param docRoot the document root, * can be <code>null</code> when no static pages are needed * @param host the network port to which this listener will bind * @param range port range to attempt to bind to * * @return a <code>HttpServer</code> configured to listen to requests * on <code>host</code>:<code>[port-range]</code>, * using the specified <code>docRoot</code> as the server's document root */ public static HttpServer createSimpleServer(final String docRoot, final String host, final PortRange range) { final HttpServer server = new HttpServer(); final ServerConfiguration config = server.getServerConfiguration(); if (docRoot != null) { config.addHttpHandler(new StaticHttpHandler(docRoot), "/"); } final NetworkListener listener = new NetworkListener("grizzly", host, range); server.addListener(listener); return server; }
/** * @param docRoot the document root, * can be <code>null</code> when no static pages are needed * @param host the network port to which this listener will bind * @param range port range to attempt to bind to * * @return a <code>HttpServer</code> configured to listen to requests * on <code>host</code>:<code>[port-range]</code>, * using the specified <code>docRoot</code> as the server's document root */ public static HttpServer createSimpleServer(final String docRoot, final String host, final PortRange range) { final HttpServer server = new HttpServer(); final ServerConfiguration config = server.getServerConfiguration(); if (docRoot != null) { config.addHttpHandler(new StaticHttpHandler(docRoot), "/"); } final NetworkListener listener = new NetworkListener("grizzly", host, range); server.addListener(listener); return server; }
/** * @param docRoot the document root, * can be <code>null</code> when no static pages are needed * @param host the network port to which this listener will bind * @param range port range to attempt to bind to * * @return a <code>HttpServer</code> configured to listen to requests * on <code>host</code>:<code>[port-range]</code>, * using the specified <code>docRoot</code> as the server's document root */ public static HttpServer createSimpleServer(final String docRoot, final String host, final PortRange range) { final HttpServer server = new HttpServer(); final ServerConfiguration config = server.getServerConfiguration(); if (docRoot != null) { config.addHttpHandler(new StaticHttpHandler(docRoot), "/"); } final NetworkListener listener = new NetworkListener("grizzly", host, range); server.addListener(listener); return server; }
private void startServer(HttpHandler httpHandler) throws IOException { httpServer = new HttpServer(); NetworkListener networkListener = new NetworkListener("jaxws-listener", "0.0.0.0", PORT); httpServer.getServerConfiguration().addHttpHandler(new StaticHttpHandler(), "/add"); // make sure JAX-WS Handler is not default httpServer.getServerConfiguration().addHttpHandler(httpHandler, HttpHandlerRegistration.bulder() .contextPath("/add/a/b") .urlPattern("/") .build()); httpServer.addListener(networkListener); httpServer.start(); }