Suppport setting own ServletContextHandler on embedded Server
See original GitHub issueI have some existing servlets that I want to use in combination with Javalin. When I set the server’s handler to use the servletContextHandler it seems to complete overwrite any Javalin endpoints. Is it possible to do this?
embeddedServer(new EmbeddedJettyFactory(() -> {
Server server = new Server();
ServletContextHandler servletContextHandler =
new ServletContextHandler(ServletContextHandler.SESSIONS);
servletContextHandler.setContextPath("/someServletContextPath");
servletContextHandler.addServlet(someServlet.class, "path");
server.setHandler(servletContextHandler);
return server;
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
java - Embedded jetty and guice Handler servlet upon request ...
AContext.getHandler(server) returns the ServletContextHandler defined in the first. isn't it enough? The HOST is a String formatted like a.test.
Read more >Setup Swagger with an embedded Jetty Server - gists · GitHub
Update your ServletContextHandler's resource base path to point to the static resources. Finally, add a DefaultServlet to serve these static resources. This ...
Read more >73. Embedded servlet containers - Spring
There are two ways to add Servlet , Filter , ServletContextListener and the other listeners supported by the Servlet spec to your application....
Read more >Jetty11 Programming Guide | The Eclipse Foundation
The Eclipse Jetty libraries provide the client-side and server-side APIs to work with various web protocols such as HTTP/1.1, HTTP/2, HTTP/3, ...
Read more >Application servers and environments supported by Weld
No further configuration is needed when starting Jetty as an embedded webapp server from within another Java program. However, if you're using a ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have not started on it yet. On the back burner probably for another week or so. I do plan on working on it.
Let’s see. The handlers are added like this:
I wrote a tutorial a while back for custom handlers: https://javalin.io/tutorials/prometheus-example
But that looks a lot like what you’re doing. I’m guessing your
ServletContextHandler
takes it upon itself to handle 404s? Ideally the request should just move to the next handler in the list, but I’m not all that familiar with howServletContextHandler
behaves in aHandlerList
.