-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DefaultServlet vs ResourceServlet #12476
Comments
@sbernard31 have also a read of #10296. In previous versions of jetty, we had users configuring a |
Thx a lot for quick answer. A last question to define where are the resource on the server. staticHolder.setInitParameter("resourceBase",
LeshanServerDemo.class.getClassLoader().getResource("webapp").toExternalForm()); Now, this is deprecated and I need to use : staticHolder.setInitParameter("baseResource",
LeshanServerDemo.class.getClassLoader().getResource("webapp").toExternalForm()); But I also see there is a : ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setBaseResource(myResource)); What is the purpose of that API ? (What means to set a
but this is not clear to me. |
@sbernard31 we have always supported |
Ok so in my case where I have only 1 ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setBaseResource(myResourceAtGivenUri)); or
|
@sbernard31 if this issue is now resolved, can we close it? |
Yep, we can close it. Thx again for your time 🙏 ! |
Jetty Version
12.0.14
Jetty Environment
ee10
Java Version
17
Question
I try to migrate from jetty 9 to 12.
And It seems migration is pretty smooth 👍 but I get this warning :
Until now, I was using
DefaultServlet
as a way to serve static resource. (without really understand the concept)With jetty12/ee10, I understand that I should rather use a
ResourceServlet
for that.This lead me to the question what is the purpose of
DefaultServlet
?I read lot about this but still not clear to me:
I describe my use case in case it helps.
I use jetty programmatically without using xml configuration.
I serve static resource from
webapp
directory of the jar of my java application and I have some REST API under/api/*
You can have a look at the code jetty 9 code and or jetty 12 version one (almost the same) from eclipse-leshan/leshan#1667.
The text was updated successfully, but these errors were encountered: