Skip to content

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

Description

@markslater

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, "/");

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugFor general bugs on Jetty side

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions