Skip to content

Conversation

@adamretter
Copy link

In our application we need almost exactly what MimetypesFileTypeMap but 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 MimetypesFileTypeMap and use reflection to get access to DB, confDir, and loadFile, loadResource, and loadAllResources.

This PR makes MimetypesFileTypeMap extensible 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 MimetypesFileTypeMap so that its constructor accepts an optional list of paths to search. Those paths would also need priorities supplied with them, so overall MimetypesFileTypeMap knows which path to check first, i.e. should a path come before checking the user's home, or perhaps after checking the Java runtime.

@jmehrens
Copy link
Contributor

@adamretter thanks for the PR. I'll hold off on review until I understand want you need.

Another possible alternative approach would be to adapt MimetypesFileTypeMap so that its constructor accepts an optional list of paths to search. Those paths would also need priorities supplied with them

FileInputStream + SequenceInputStream + MimetypesFileTypeMap(InputStream) constructor should do what you want. How does that work for you?

@adamretter
Copy link
Author

@jmehrens Thanks for the quick reply :-)

FileInputStream + SequenceInputStream + MimetypesFileTypeMap(InputStream) constructor should do what you want. How does that work for you?

I am not sure that would help as the InputStream given to MimetypesFileTypeMap(InputStream) would have the highest priority, but I would like mine to come between searching the user's home folder, and searching in the Java runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants