Refactored MimetypesFileTypeMap so that it is extensible#188
Refactored MimetypesFileTypeMap so that it is extensible#188adamretter wants to merge 1 commit intojakartaee:mainfrom
Conversation
|
@adamretter thanks for the PR. I'll hold off on review until I understand want you need.
FileInputStream + SequenceInputStream + MimetypesFileTypeMap(InputStream) constructor should do what you want. How does that work for you? |
|
@jmehrens Thanks for the quick reply :-)
I am not sure that would help as the |
In our application we need almost exactly what
MimetypesFileTypeMapbut we need to add some additional application specific paths that are searched. These come between searching the user's home folder, and searching in the Java runtime.To achieve this, we currently extend
MimetypesFileTypeMapand use reflection to get access toDB,confDir, andloadFile,loadResource, andloadAllResources.This PR makes
MimetypesFileTypeMapextensible so that it is no longer necessary to use reflection to access its members and methods.I am not sure how this will be received, but I am sending it over to get some feedback.
Another possible alternative approach would be to adapt
MimetypesFileTypeMapso that its constructor accepts an optional list of paths to search. Those paths would also need priorities supplied with them, so overallMimetypesFileTypeMapknows which path to check first, i.e. should a path come before checking the user's home, or perhaps after checking the Java runtime.