Search in sources :

Example 1 with AdminServlet

use of voldemort.server.http.gui.AdminServlet in project voldemort by voldemort.

the class HttpService method startInner.

@Override
public void startInner() {
    try {
        SelectChannelConnector connector = new SelectChannelConnector();
        connector.setLowResourceMaxIdleTime(3000);
        connector.setPort(this.port);
        connector.setReuseAddress(true);
        QueuedThreadPool threadPool = new QueuedThreadPool();
        threadPool.setName("VoldemortHttp");
        threadPool.setMaxThreads(this.numberOfThreads);
        Server httpServer = new Server();
        httpServer.setConnectors(new Connector[] { connector });
        httpServer.setThreadPool(threadPool);
        httpServer.setSendServerVersion(false);
        httpServer.setSendDateHeader(false);
        Context context = new Context(httpServer, "/", Context.NO_SESSIONS);
        context.setAttribute(VoldemortServletContextListener.SERVER_KEY, server);
        context.setAttribute(VoldemortServletContextListener.VELOCITY_ENGINE_KEY, velocityEngine);
        context.addServlet(new ServletHolder(new AdminServlet(server, velocityEngine)), "/admin");
        context.addServlet(new ServletHolder(new StoreServlet(requestHandler)), "/stores");
        context.addServlet(new ServletHolder(new ReadOnlyStoreManagementServlet(server, velocityEngine)), "/read-only/mgmt");
        context.addServlet(new ServletHolder(new StatusServlet(server, velocityEngine)), "/server-status");
        this.context = context;
        this.httpServer = httpServer;
        this.httpServer.start();
        logger.info("HTTP service started on port " + this.port);
    } catch (Exception e) {
        String errorMessage = " Error starting service on port " + this.port;
        throw new VoldemortException(errorMessage, e);
    }
}
Also used : Context(org.mortbay.jetty.servlet.Context) StatusServlet(voldemort.server.http.gui.StatusServlet) SelectChannelConnector(org.mortbay.jetty.nio.SelectChannelConnector) AdminServlet(voldemort.server.http.gui.AdminServlet) Server(org.mortbay.jetty.Server) VoldemortServer(voldemort.server.VoldemortServer) QueuedThreadPool(org.mortbay.thread.QueuedThreadPool) ServletHolder(org.mortbay.jetty.servlet.ServletHolder) ReadOnlyStoreManagementServlet(voldemort.server.http.gui.ReadOnlyStoreManagementServlet) VoldemortException(voldemort.VoldemortException) VoldemortException(voldemort.VoldemortException)

Aggregations

Server (org.mortbay.jetty.Server)1 SelectChannelConnector (org.mortbay.jetty.nio.SelectChannelConnector)1 Context (org.mortbay.jetty.servlet.Context)1 ServletHolder (org.mortbay.jetty.servlet.ServletHolder)1 QueuedThreadPool (org.mortbay.thread.QueuedThreadPool)1 VoldemortException (voldemort.VoldemortException)1 VoldemortServer (voldemort.server.VoldemortServer)1 AdminServlet (voldemort.server.http.gui.AdminServlet)1 ReadOnlyStoreManagementServlet (voldemort.server.http.gui.ReadOnlyStoreManagementServlet)1 StatusServlet (voldemort.server.http.gui.StatusServlet)1