protected HttpHandler getHttpHandler() { return new StaticHttpHandler("."); }
/** * Create <tt>HttpHandler</tt>, which, by default, will handle requests * to the static resources located in the current directory. */ public StaticHttpHandler() { addDocRoot("."); }
StaticHttpHandler localHandler = new StaticHttpHandler( params.clientDirectory.getAbsolutePath()); localHandler.setFileCacheEnabled(false); httpServer.getServerConfiguration().addHttpHandler(localHandler, "/local");
pickupContentType(response, resource.getPath()); addToFileCache(request, response, resource); sendFile(response, resource);
handler.setFileCacheEnabled(false); // see http://stackoverflow.com/questions/13307489/grizzly-locks-static-served-resources
pickupContentType(response, resource.getPath()); addToFileCache(request, response, resource); sendFile(response, resource);
/** * Starts the HTTP server. * */ private void startHttpServer() throws Exception { String httpRoot = URLDecoder.decode(new File(getClass().getResource("/").getFile()).getAbsolutePath(), "utf-8"); httpServer = HttpServer.createSimpleServer(httpRoot, "localhost", 9997); NetworkListener listener = httpServer.getListeners().iterator().next(); // listener.setFilterChain(new DefaultFilterChain()); // Disable file cache to fix https://java.net/jira/browse/GRIZZLY-1350 ((StaticHttpHandler) httpServer.getServerConfiguration().getHttpHandlers().keySet().iterator().next()).setFileCacheEnabled(false); // Add a handler for temporary files addTempFileHandler(); httpServer.start(); }
protected HttpHandler getHttpHandler() { return new StaticHttpHandler("."); }
pickupContentType(response, resource.getPath()); addToFileCache(request, response, resource); sendFile(response, resource);
/** * Create <tt>HttpHandler</tt>, which, by default, will handle requests * to the static resources located in the current directory. */ public StaticHttpHandler() { addDocRoot("."); }
/** * 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"); }
httpServer.getServerConfiguration().addHttpHandler(new StaticHttpHandler("<basepath>/lib"),"/lib"); httpServer.getServerConfiguration().addHttpHandler(new StaticHttpHandler("<basepath>/css"),"/css"); ...
pickupContentType(response, resource.getPath()); addToFileCache(request, response, resource); sendFile(response, resource);
/** * Create <tt>HttpHandler</tt>, which, by default, will handle requests * to the static resources located in the current directory. */ public StaticHttpHandler() { addDocRoot("."); }
StaticHttpHandler staticHttpHandler = new StaticHttpHandler("/www/static/"); server.getServerConfiguration().addHttpHandler(staticHttpHandler, "/");
pickupContentType(response, resource.getPath()); addToFileCache(request, response, resource); sendFile(response, resource);
/** * Create <tt>HttpHandler</tt>, which, by default, will handle requests * to the static resources located in the current directory. */ public StaticHttpHandler() { addDocRoot("."); }
server.getServerConfiguration().addHttpHandler(new StaticHttpHandler("src/main/webapp"), "/static", "/index.html");
pickupContentType(response, resource.getPath()); addToFileCache(request, response, resource); sendFile(response, resource);
/** * Create <tt>HttpHandler</tt>, which, by default, will handle requests * to the static resources located in the current directory. */ public StaticHttpHandler() { addDocRoot("."); }