Search in sources :

Example 1 with FilterMapping

use of org.mortbay.jetty.servlet.FilterMapping in project incubator-myriad by apache.

the class MyriadWebServer method start.

public void start() throws Exception {
    this.jetty.addConnector(connector);
    ServletHandler servletHandler = new ServletHandler();
    String filterName = "MyriadGuiceFilter";
    FilterHolder holder = new FilterHolder(filter);
    holder.setName(filterName);
    FilterMapping filterMapping = new FilterMapping();
    filterMapping.setPathSpec("/*");
    filterMapping.setDispatches(Handler.ALL);
    filterMapping.setFilterName(filterName);
    servletHandler.addFilter(holder, filterMapping);
    Context context = new Context();
    context.setServletHandler(servletHandler);
    context.addServlet(DefaultServlet.class, "/");
    String staticDir = this.getClass().getClassLoader().getResource("webapp/public").toExternalForm();
    context.setResourceBase(staticDir);
    this.jetty.addHandler(context);
    this.jetty.start();
}
Also used : Context(org.mortbay.jetty.servlet.Context) ServletHandler(org.mortbay.jetty.servlet.ServletHandler) FilterHolder(org.mortbay.jetty.servlet.FilterHolder) FilterMapping(org.mortbay.jetty.servlet.FilterMapping)

Aggregations

Context (org.mortbay.jetty.servlet.Context)1 FilterHolder (org.mortbay.jetty.servlet.FilterHolder)1 FilterMapping (org.mortbay.jetty.servlet.FilterMapping)1 ServletHandler (org.mortbay.jetty.servlet.ServletHandler)1