Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jaf-dev] Activation not seeing PNG MIME type

Since you're using JDK 1.8, you're getting the version of JAF bundled with JDK 1.8.  That older version has an older mimetypes.default file that is missing the entry for PNG.

If you want to use Jakarta Activation 1.2.1, you'll need to add it to the bootstrap class path so it's loaded before the builtin version.


Thad Humphries wrote on 1/9/20 8:42 AM:
Although PNG is listed in activation/src/main/resources/META-INF/mimetypes.default, I am not getting "image/png" from MimetypesFileTypeMap. Instead I'm getting "application/octet-stream".

The following code

System.out.printf("Java version %s\n", System.getProperties().getProperty("java.version"));
System.out.printf("Java vendor %s\n", System.getProperties().getProperty("java.vm.vendor"));
System.out.printf("Java name %s\n", System.getProperties().getProperty("java.vm.name"));
MimetypesFileTypeMap mimeMap = new MimetypesFileTypeMap();
System.out.printf("tiff %s\n", mimeMap.getContentType("foo.tiff"));
System.out.printf("jpg %s\n", mimeMap.getContentType("foo.jpg"));
System.out.printf("html %s\n", mimeMap.getContentType("foo.html"));
System.out.printf("png %s\n", mimeMap.getContentType("foo.png"));
System.out.printf("rtf %s\n", mimeMap.getContentType("foo.rtf"));
System.out.printf("unknown %s\n", mimeMap.getContentType("foo.unk"));

yields:

Java version 1.8.0_222
Java vendor Amazon.com Inc.
Java name OpenJDK 64-Bit Server VM
tiff image/tiff
jpg image/jpeg
html text/html
png application/octet-stream
rtf application/rtf
unknown application/octet-stream

I'm using jakarta.activation-api-1.2.1.jar from Maven Central and OpenJDK 1.8.0_222 from Amazon Corretto.

--
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be" --Christopher Marlowe, Doctor Faustus (v. 111-13)

_______________________________________________
jaf-dev mailing list
jaf-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jaf-dev


Back to the top