Question

I've got a Java Servlet filter I'm creating to be used in a number of different applications.

This Java Servlet filter makes use of the Apache Commons Fileupload class.

How can I bundle that class with my Java Servlet filter in a fashion where I know that my filter will always use my version of Apache Commons FileUpload, but the parent application will never use it?

I want to be sure that I'm not introducing a newer/older versions of Apache Commons Fileupload to an application that already makes use of it to potentially cause issues within the application. With that said, I want to be sure my application always has what it needs.

Ideally I'd also like to be able to swap out the version of Apache Commons FileUpload easily (If that is possible with the above requirements).

Thanks for your help!

Was it helpful?

Solution

I'm sure there is a better solution, so I'm going to leave this open.

However, my solution was to refactor all the package names to add one folder to the base.

e.g. org.apache.commons.fileupload.FileUpload

Becomes: include.org.apache.commons.fileupload.FileUpload

Since my name is unique, nothing else should use it and my code won't use anything else.

Since its just one folder deeper, I can swap out newer versions of the Apache Commons FileUpload simply by throwing the source within the "include" directory.

If no one else has a solution, hopefully this will help someone else out.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top