use of org.eclipse.jetty.server.handler.HandlerCollection in project helios by spotify.
the class MasterService method setUpRequestLogging.
private void setUpRequestLogging(final Path stateDirectory) {
// Set up request logging
final Handler originalHandler = server.getHandler();
final HandlerCollection handlerCollection;
if (originalHandler instanceof HandlerCollection) {
handlerCollection = (HandlerCollection) originalHandler;
} else {
handlerCollection = new HandlerCollection();
handlerCollection.addHandler(originalHandler);
}
final RequestLogHandler requestLogHandler = new RequestLogHandler();
final RequestLogImpl requestLog = new RequestLogImpl();
requestLog.setQuiet(true);
if (stateDirectory.resolve(LOGBACK_ACCESS_CONFIG).toFile().exists()) {
requestLog.setFileName(stateDirectory.resolve(LOGBACK_ACCESS_CONFIG).toString());
} else if (this.getClass().getResource(LOGBACK_ACCESS_RESOURCE) != null) {
requestLog.setResource(LOGBACK_ACCESS_RESOURCE);
}
requestLogHandler.setRequestLog(requestLog);
handlerCollection.addHandler(requestLogHandler);
server.setHandler(handlerCollection);
}
use of org.eclipse.jetty.server.handler.HandlerCollection in project cxf by apache.
the class AbstractSpringServer method run.
protected void run() {
server = new org.eclipse.jetty.server.Server(port);
WebAppContext webappcontext = new WebAppContext();
webappcontext.setContextPath(contextPath);
webappcontext.setBaseResource(Resource.newClassPathResource(resourcePath));
server.setHandler(new HandlerCollection(webappcontext, new DefaultHandler()));
try {
configureServer(server);
server.start();
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.eclipse.jetty.server.handler.HandlerCollection in project cxf by apache.
the class DigestServer method run.
protected void run() {
server = new org.eclipse.jetty.server.Server(Integer.parseInt(PORT));
WebAppContext webappcontext = new WebAppContext();
webappcontext.setContextPath("/digestauth");
webappcontext.setBaseResource(Resource.newClassPathResource("/digestauth"));
HandlerCollection handlers = new HandlerCollection();
handlers.setHandlers(new Handler[] { webappcontext, new DefaultHandler() });
server.setHandler(handlers);
try {
configureServer();
server.start();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.eclipse.jetty.server.handler.HandlerCollection in project cxf by apache.
the class ResolverTest method startServer.
@Test
public void startServer() throws Throwable {
Server server = new org.eclipse.jetty.server.Server(Integer.parseInt(PORT));
WebAppContext webappcontext = new WebAppContext();
webappcontext.setContextPath("/resolver");
webappcontext.setBaseResource(Resource.newClassPathResource("/resolver"));
HandlerCollection handlers = new HandlerCollection();
handlers.setHandlers(new Handler[] { webappcontext, new DefaultHandler() });
server.setHandler(handlers);
server.start();
Throwable e = webappcontext.getUnavailableException();
if (e != null) {
throw e;
}
server.stop();
}
use of org.eclipse.jetty.server.handler.HandlerCollection in project cxf by apache.
the class AbstractSpringServer method run.
protected void run() {
server = new org.eclipse.jetty.server.Server(port);
WebAppContext webappcontext = new WebAppContext();
webappcontext.setContextPath(contextPath);
webappcontext.setBaseResource(Resource.newClassPathResource(resourcePath));
server.setHandler(new HandlerCollection(webappcontext, new DefaultHandler()));
try {
configureServer(server);
server.start();
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations