Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Handler List problem with Jetty-9.1.0

Hi, 
Recently I have updated Jetty from 9.0.3 to 9.1.0, and after that, I got a problem.
I’m using Jetty in embedded mode, here’s my code:

ServletContextHandler context = new ServletContextHandler(
                ServletContextHandler.SESSIONS);
        context.setContextPath("/");

        ServletHolder holder = new ServletHolder(new jettyHttpRequestHandler());
        holder.getRegistration().setMultipartConfig(
                new MultipartConfigElement(getTmpDir()));

        context.addServlet(holder, "/api/*");

        HandlerList internalHandlers = new HandlerList();
        internalHandlers.addHandler(context);
        internalHandlers.addHandler(resourceHandler);
        internalHandlers.addHandler(defaultHandler);

Server server = new Server();
        server.setHandler(internalHandlers);
server.start();
server.join();

Then I open the start page in browser, the url is http://localhost:8080/views/admin/dashboard.html

In the old version of Jetty(9.0.3), all work well, but with the latest Jetty, I encountered a 404 error. It seems that the Jetty Server didn’t pass the request to resourceHandler. 

I don’t know why, does anyone know?
Thanks.

Best regards,
Cynric Shu


Back to the top