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 self-assigned this Apr 14, 2022
markslater added a commit to markslater/jetty.project that referenced this issue Apr 15, 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
None yet
Development

Successfully merging a pull request may close this issue.

2 participants