Skip to content
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

ee10 DefaultServlet suffix mappings do not work #11794

Closed
janbartel opened this issue May 16, 2024 · 1 comment
Closed

ee10 DefaultServlet suffix mappings do not work #11794

janbartel opened this issue May 16, 2024 · 1 comment
Assignees
Labels
Bug For general bugs on Jetty side

Comments

@janbartel
Copy link
Contributor

jetty-12.0.x

Jetty Environment
ee10

A setup like:

        ServletContextHandler context = new ServletContextHandler();
        context.setContextPath("/blah");
        ServletHolder holderAlt = new ServletHolder("static-alt", DefaultServlet.class);
        holderAlt.setInitParameter("resourceBase", "/tmp/static-alt/");
        context.addServlet(holderAlt, "*.js");

For a request such as:

GET http://localhost/blah/foo.js

Results in a call to DefaultServlet:

protected String getEncodedPathInContext(HttpServletRequest req, String includedServletPath)
  {
      if (includedServletPath != null)
          return encodePath(getIncludedPathInContext(req, includedServletPath, !isDefaultMapping(req)));
      else if (!isDefaultMapping(req))
          return encodePath(req.getPathInfo());

The Request.getPathInfo() on a suffix match returns null. The path that is encoded in this case should be eg /foo.js

@janbartel
Copy link
Contributor Author

This should be fixed by the introduction of the ResourceServlet in #11933

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
None yet
Development

No branches or pull requests

1 participant