static { try { tmpDir = Files.createTempDirectory("armeria-test.").toFile(); } catch (Exception e) { throw new Error(e); } final ServerBuilder sb = new ServerBuilder(); try { sb.port(0, SessionProtocol.HTTP); final VirtualHostBuilder defaultVirtualHost = new VirtualHostBuilder(); defaultVirtualHost.serviceUnder( "/fs/", HttpFileService.forFileSystem(tmpDir.toPath()).decorate(LoggingService::new)); defaultVirtualHost.serviceUnder( "/", HttpFileService.forClassPath("/http_file_service").decorate(LoggingService::new)); sb.defaultVirtualHost(defaultVirtualHost.build()); } catch (Exception e) { throw new Error(e); } server = sb.build(); }
@Override protected void configureServer(ServerBuilder sb) throws Exception { sb.serviceUnder( "/jsp/", new JettyServiceBuilder() .handler(newWebAppContext()) .configurator(s -> jettyBeans.addAll(s.getBeans())) .build() .decorate(LoggingService::new)); sb.serviceUnder("/default/", new JettyServiceBuilder().handler(new DefaultHandler()).build()); }