dwhytock
|
Posted: July 05, 2011 16:35 by dwhytock
|
|
Hi all... Trying to handle messages coming in with a content-type of "multipart/alternative". What I get from Message.getContent() is a javax.mail.util.SharedByteArrayInputStream, where according to the javadoc I should be getting a javax.mail.Multipart. Is "multipart/alternative" handled by the current API? Thanks... Don |
multipart/alternative
Replies: 5 - Last Post: July 06, 2011 04:48
by: shannon
by: shannon
showing 1 - 6 of 6
shannon
|
Posted: July 05, 2011 17:34 by shannon
|
|
Yes, it's handled. There's probably something wrong in your setup that is causing this to fail. Do regular multipart/mixed messages work as expected? What environment is your code running in? A standalone Java application? An application server? What version of JavaMail are you using, and what version of the JDK are you using? |
dwhytock
|
Posted: July 05, 2011 20:36 by dwhytock
|
|
Okay, I tried a plain application structured as an OSGi bundle. Running it standalone I see MimeMultipart. Running it in Felix I see SharedByteArrayInputStream. The mailapi bundle doesn't complain on startup, so I assume it's able to find javax.activation. Is there maybe a configuration file, something in javaee.jar or mailapi.jar, that DataHandler can't get to in an OSGi environment? |
shannon
|
Posted: July 06, 2011 04:48 by shannon
|
|
Sigh. It's more complicated than that, and I haven't had time to implement the solution. It's all about ClassLoaders and the assumptions that OSGi breaks... JavaMail (and JAF, which is the culprit in this case) uses the ClassLoader.getResource method to load configuration files that are contained in the JavaMail jar file. With OSGi, that doesn't work. So all the configuration JAF needs to find the correct class to handle certain MIME types is missing. You can try using Thread.setContextClassLoader to set it to the ClassLoader of your application bundle. If that doesn't work, a more complicated workaround may be required. |
showing 1 - 6 of 6
Replies: 5 - Last Post: July 06, 2011 04:48
by: shannon
by: shannon







