Skip to content

DefaultServlet vs ResourceServlet #12476

Closed
@sbernard31

Description

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 :

2024-11-04 16:05:43,996 DefaultServlet       [WARN] DefaultServlet pathInfoOnly is set to true. Use ResourceServlet instead.  
2024-11-04 16:06:09,081 DefaultServlet       [WARN] Incorrect mapping for DefaultServlet at /*. Use ResourceServlet  

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.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions