Search in sources :

Example 1 with DenialServlet

use of jmri.web.servlet.DenialServlet in project JMRI by JMRI.

the class WebServer method registerDenial.

/**
     * Register a URL pattern to be denied access.
     *
     * @param urlPattern the pattern to deny access to
     */
public void registerDenial(String urlPattern) {
    this.registeredUrls.put(urlPattern, Registration.DENIAL);
    ServletContextHandler servletContext = new ServletContextHandler(ServletContextHandler.NO_SECURITY);
    servletContext.setContextPath(urlPattern);
    DenialServlet servlet = new DenialServlet();
    // NOI18N
    servletContext.addServlet(new ServletHolder(servlet), "/*");
    ((ContextHandlerCollection) this.server.getHandler()).addHandler(servletContext);
}
Also used : ServletHolder(org.eclipse.jetty.servlet.ServletHolder) ContextHandlerCollection(org.eclipse.jetty.server.handler.ContextHandlerCollection) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler) DenialServlet(jmri.web.servlet.DenialServlet)

Aggregations

DenialServlet (jmri.web.servlet.DenialServlet)1 ContextHandlerCollection (org.eclipse.jetty.server.handler.ContextHandlerCollection)1 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)1 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)1