avalle Active Member Licensed User Longtime User Mar 9, 2021 #1 Hi all my jServer application serves some static content. For HTML files it automatically appends "Content-Type: text/html" to responses. I also have different file types and I need to set the specific content-type for them. How can this be done? Thanks Andrea
Hi all my jServer application serves some static content. For HTML files it automatically appends "Content-Type: text/html" to responses. I also have different file types and I need to set the specific content-type for them. How can this be done? Thanks Andrea
Erel B4X founder Staff member Licensed User Longtime User Mar 9, 2021 #2 It handles many file extensions automatically. Are you using a non-standard extension? Upvote 0
avalle Active Member Licensed User Longtime User Mar 9, 2021 #3 I'm handling CRL files. The client expects to get content-type application/pkix-crl as per RFC 5280 Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Mar 9, 2021 #4 Untested code: Code: Copy Dim jo As JavaObject = srvr jo.GetFieldJO("context").RunMethodJO("getMimeTypes", Null).RunMethod("addMimeMapping", Array("crl", "application/pkix-crl")) Upvote 0
Untested code: Code: Copy Dim jo As JavaObject = srvr jo.GetFieldJO("context").RunMethodJO("getMimeTypes", Null).RunMethod("addMimeMapping", Array("crl", "application/pkix-crl"))
avalle Active Member Licensed User Longtime User Mar 9, 2021 #5 Thanks Erel. I'm going to check this. Is it right to apply it during the srvr initialization phase? Upvote 0
avalle Active Member Licensed User Longtime User Mar 9, 2021 #7 This was indeed the case. It works, thanks a lot! B4X: Copy < HTTP/1.1 200 OK < Date: Tue, 09 Mar 2021 14:40:00 GMT < Last-Modified: Mon, 15 Feb 2021 15:16:03 GMT < Content-Type: application/pkix-crl < Accept-Ranges: bytes < Content-Length: 1014 < Server: Jetty(9.4.z-SNAPSHOT) Upvote 0
This was indeed the case. It works, thanks a lot! B4X: Copy < HTTP/1.1 200 OK < Date: Tue, 09 Mar 2021 14:40:00 GMT < Last-Modified: Mon, 15 Feb 2021 15:16:03 GMT < Content-Type: application/pkix-crl < Accept-Ranges: bytes < Content-Length: 1014 < Server: Jetty(9.4.z-SNAPSHOT)