Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

Mime types were not set by default, so enable the mime factory #150

Merged
merged 1 commit into from
Aug 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.org.jenkins.custom.jenkins.distribution.service;

import org.springframework.boot.web.server.MimeMappings;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MimeMapping implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor question should this be
public class ServletCustomizer implements WebServerFactoryCustomizer<TomcatServletWebServerFactory> since we are using a TomCat server as our default

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretend I know nothing. Cause I know nothing.

This solution seems to work but I make no promises. As the expert I defer to you.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TomcatServletWebServerFactory is a subclass of ConfigurableServletWebServerFactory and would probably serve for more specific use cases, but this looks good enough.
CC @martinda @kwhetstone

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a net improvement, I added a issue to track testing later.

@Override
public void customize(final ConfigurableServletWebServerFactory factory) {
final MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
factory.setMimeMappings(mappings);
}
}