In the MailcapCommandMap class, it loads the mailcap file only once. This may cause troubles when different applications use different custom mailcap.
Also, if no mailcap is found in the current class loader, only ONE mailcap file from the module will be loaded, and not all of them, which is an issue if we get the mail-dsn jar added in the javax.mail.api module.
If there is only one application deployed, adding in the jboss-deployement-structure.xml the following dependency:
and, from the application, calling at startup:
cause the loading of all mailcap files found from the current class loader (those of the application + those of javax.mail.api module).
But, if there are more than one application deployed, only the first to do so will have its mailcap loaded.
The design of javax.activation should be changed to take in account this side-effect of isolation: what happen if 2 applications define different classes for the same type/mime ??