Search in sources :

Example 1 with BasicAuthenticationFilter

use of org.jowidgets.security.impl.http.server.BasicAuthenticationFilter in project jo-client-platform by jo-source.

the class CapServerStarter method startServer.

public static void startServer(final String brokerId, final int port) throws Exception {
    Assert.paramNotNull(brokerId, "brokerId");
    final Server server = new Server(port);
    final ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS);
    root.addServlet(new ServletHolder(new SecurityRemotingServlet(brokerId)), "/");
    root.addFilter(new FilterHolder(new BasicAuthenticationFilter()), "/", FilterMapping.DEFAULT);
    server.setHandler(root);
    server.start();
    server.join();
}
Also used : FilterHolder(org.eclipse.jetty.servlet.FilterHolder) Server(org.eclipse.jetty.server.Server) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) BasicAuthenticationFilter(org.jowidgets.security.impl.http.server.BasicAuthenticationFilter) SecurityRemotingServlet(org.jowidgets.security.impl.http.server.SecurityRemotingServlet) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler)

Example 2 with BasicAuthenticationFilter

use of org.jowidgets.security.impl.http.server.BasicAuthenticationFilter in project jo-client-platform by jo-source.

the class CapServerStarter method startServer.

public static void startServer(final String brokerId, final int port, final MessageServletConfig config) throws Exception {
    Assert.paramNotNull(brokerId, "brokerId");
    final Server server = new Server(port);
    final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(32, 256, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), DaemonThreadFactory.multi(CapServerStarter.class.getName() + ".ServletExecutor"));
    server.setThreadPool(new ExecutorThreadPool(threadPoolExecutor));
    final ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS);
    final ServletHolder servletHolder = new ServletHolder(new SecurityRemotingServlet(brokerId));
    setConfigParameters(servletHolder, config);
    root.addServlet(servletHolder, "/");
    root.addFilter(new FilterHolder(new BasicAuthenticationFilter()), "/", FilterMapping.DEFAULT);
    addServletFilters(root, config);
    server.setHandler(root);
    server.start();
    server.join();
}
Also used : FilterHolder(org.eclipse.jetty.servlet.FilterHolder) Server(org.eclipse.jetty.server.Server) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) BasicAuthenticationFilter(org.jowidgets.security.impl.http.server.BasicAuthenticationFilter) ExecutorThreadPool(org.eclipse.jetty.util.thread.ExecutorThreadPool) SecurityRemotingServlet(org.jowidgets.security.impl.http.server.SecurityRemotingServlet) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler)

Aggregations

Server (org.eclipse.jetty.server.Server)2 FilterHolder (org.eclipse.jetty.servlet.FilterHolder)2 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)2 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)2 BasicAuthenticationFilter (org.jowidgets.security.impl.http.server.BasicAuthenticationFilter)2 SecurityRemotingServlet (org.jowidgets.security.impl.http.server.SecurityRemotingServlet)2 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 ExecutorThreadPool (org.eclipse.jetty.util.thread.ExecutorThreadPool)1