This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git

commit a8704fe1452629a6d03122925a469df426f2dcf2
Author: Carsten Ziegeler <cziege...@apache.org>
AuthorDate: Sun Apr 14 15:56:30 2024 +0200

    FELIX-6696 : Resources content-type are no longer defined when using a 
whiteboard pattern
---
 .../felix/http/base/internal/whiteboard/ResourceServlet.java       | 7 ++++++-
 http/jetty/pom.xml                                                 | 2 +-
 http/jetty12/pom.xml                                               | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git 
a/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/ResourceServlet.java
 
b/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/ResourceServlet.java
index 3d873feaa7..d2666061c7 100644
--- 
a/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/ResourceServlet.java
+++ 
b/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/ResourceServlet.java
@@ -24,6 +24,8 @@ import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLConnection;
 
+import org.apache.felix.http.base.internal.util.MimeTypes;
+
 import jakarta.servlet.ServletException;
 import jakarta.servlet.http.HttpServlet;
 import jakarta.servlet.http.HttpServletRequest;
@@ -64,7 +66,10 @@ public class ResourceServlet extends HttpServlet {
 
     private void handle(final HttpServletRequest req, final 
HttpServletResponse res, final URL url, final String resName)
     throws IOException {
-        final String contentType = getServletContext().getMimeType(resName);
+        String contentType = getServletContext().getMimeType(resName);
+        if (contentType == null) {
+            contentType = MimeTypes.get().getByFile(resName);
+        }
         if (contentType != null) {
             res.setContentType(contentType);
         }
diff --git a/http/jetty/pom.xml b/http/jetty/pom.xml
index d66c20cb79..bb16c026a0 100644
--- a/http/jetty/pom.xml
+++ b/http/jetty/pom.xml
@@ -431,7 +431,7 @@
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.http.base</artifactId>
-            <version>5.1.6</version>
+            <version>5.1.7-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.felix</groupId>
diff --git a/http/jetty12/pom.xml b/http/jetty12/pom.xml
index 6222fdbfc1..02eeb1d911 100644
--- a/http/jetty12/pom.xml
+++ b/http/jetty12/pom.xml
@@ -434,7 +434,7 @@
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.http.base</artifactId>
-            <version>5.1.6</version>
+            <version>5.1.7-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.felix</groupId>

Reply via email to