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

DefaultServlet should not overwrite programmatically configured precompressed formats with defaults #7880

Closed
markslater opened this issue Apr 14, 2022 · 0 comments · Fixed by #7881
Assignees
Labels
Bug For general bugs on Jetty side

Comments

@markslater
Copy link
Contributor

Jetty version(s)
11.0.9
Java version/vendor (use: java -version)
N/A
OS type/version
N/A
Description
When DefaultServlet is instantiated, most of the properties of its ResourceService retain their values unless they have been configured by an InitParameter. This means the behaviour can be configured programmatically on the ResourceService. However, this does not hold for the PrecompressedFormats, which are always reset to defaults if no InitParameter is set.

How to reproduce?
Given the following code, the PrecompressedFormats will be ignored:

ResourceService resourceService = new ResourceService();
resourceService.setPrecompressedFormats(new CompressedContentFormat[]{
        new CompressedContentFormat("bzip2", ".bz2"),
        new CompressedContentFormat("gzip", ".gz"),
        new CompressedContentFormat("br", ".br")
});
ServletHolder defholder = new ServletHolder(new DefaultServlet(resourceService));
context.addServlet(defholder, "/");
@markslater markslater added the Bug For general bugs on Jetty side label Apr 14, 2022
markslater added a commit to markslater/jetty.project that referenced this issue Apr 14, 2022
…faultServlet unless overridden by an InitParameter.
markslater added a commit to markslater/jetty.project that referenced this issue Apr 14, 2022
markslater added a commit to markslater/jetty.project that referenced this issue Apr 14, 2022
…faultServlet unless overridden by an InitParameter.
markslater added a commit to markslater/jetty.project that referenced this issue Apr 14, 2022
@joakime joakime linked a pull request Apr 14, 2022 that will close this issue
@joakime joakime added this to To do in Jetty 10.0.10/11.0.10 - 🧊 FROZEN 🥶 via automation Apr 14, 2022
@joakime joakime self-assigned this Apr 14, 2022
@joakime joakime moved this from To do to Review in progress in Jetty 10.0.10/11.0.10 - 🧊 FROZEN 🥶 Apr 14, 2022
@joakime joakime moved this from Review in progress to In progress in Jetty 10.0.10/11.0.10 - 🧊 FROZEN 🥶 Apr 14, 2022
markslater added a commit to markslater/jetty.project that referenced this issue Apr 15, 2022
Jetty 10.0.10/11.0.10 - 🧊 FROZEN 🥶 automation moved this from In progress to Done May 11, 2022
joakime pushed a commit that referenced this issue May 11, 2022
* #7880 PrecompressedFormats set on ResourceService are used in DefaultServlet unless overridden by an InitParameter.
* #7880 Fix checkstyle violations.
* #7880 Fix NPEs.
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
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants