use of org.eclipse.jetty.server.Handler in project pulsar by yahoo.
the class WebService method start.
public void start() throws PulsarServerException {
try {
RequestLogHandler requestLogHandler = new RequestLogHandler();
Slf4jRequestLog requestLog = new Slf4jRequestLog();
requestLog.setExtended(true);
requestLog.setLogTimeZone(WebService.HANDLER_REQUEST_LOG_TZ);
requestLog.setLogLatency(true);
requestLogHandler.setRequestLog(requestLog);
handlers.add(0, new ContextHandlerCollection());
handlers.add(requestLogHandler);
ContextHandlerCollection contexts = new ContextHandlerCollection();
contexts.setHandlers(handlers.toArray(new Handler[handlers.size()]));
HandlerCollection handlerCollection = new HandlerCollection();
handlerCollection.setHandlers(new Handler[] { contexts, new DefaultHandler(), requestLogHandler });
server.setHandler(handlerCollection);
server.start();
log.info("Web Service started at {}", pulsar.getWebServiceAddress());
} catch (Exception e) {
throw new PulsarServerException(e);
}
}
use of org.eclipse.jetty.server.Handler in project alluxio by Alluxio.
the class WebServer method addHandler.
/**
* Adds a handler.
*
* @param handler the handler to add
*/
public void addHandler(AbstractHandler handler) {
HandlerList handlers = new HandlerList();
handlers.addHandler(handler);
for (Handler h : mServer.getHandlers()) {
handlers.addHandler(h);
}
mServer.setHandler(handlers);
}
use of org.eclipse.jetty.server.Handler in project calcite-avatica by apache.
the class HandlerFactoryTest method testJson.
@Test
public void testJson() {
Handler handler = factory.getHandler(service, Serialization.JSON);
assertTrue("Expected an implementation of the AvaticaHandler, " + "but got " + handler.getClass(), handler instanceof AvaticaJsonHandler);
}
Aggregations