[
https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13495149#comment-13495149
]
Jinhua Wang commented on CXF-4616:
----------------------------------
Hi, Danidel, the whole application is running in OSGi environment, and those
mail classes are imported. Due to well known issue for exposing META-INF
directories in OSGi, those mailcap files are not discovered, then we add the
hook to expose those files. The bad thing is that, the javamail version we used
has some issues for handling the text/xml messages.
After some investigation, I found that the RI SAAJ impl also tries to register
the correct handlers in the default map explicitly (Not via expose mailcap
files). In the current CXF codes, it will create a new map for the DataHandler
(by default, the Default Map will be used), I am thinking that CXF may need to
consider this situation. Let's say, some third-party (e.g. SAAI RI) will
register their own handlers programmically, and CXF changed the handler map
explicitly, it somewhat will ignore those handlers in the default map. That is
why I would suggest to create an enhanced map for this, and it will be more
compatibile in those application environments.
CommandMapImpactTest as attached is created under
"/cxf-api/src/test/java/org/apache/cxf/attachment/" and CommandMap impact has
been tested.
{code}
java mail on classpath
jar:file:/D:/appdata/m2repo/org/apache/geronimo/specs/geronimo-javamail_1.4_spec/1.7.1/geronimo-javamail_1.4_spec-1.7.1.jar!/META-INF/mailcap
NewCommandMap: content type is class java.lang.String
NewCommandMap: dataContentHanlder type is class
org.apache.geronimo.mail.handlers.XMLHandler
java mail on classpath
jar:file:/D:/appdata/m2repo/org/apache/geronimo/specs/geronimo-javamail_1.4_spec/1.7.1/geronimo-javamail_1.4_spec-1.7.1.jar!/META-INF/mailcap
Default CommandMap: content type is class
javax.xml.transform.stream.StreamSource
Default CommandMap: dataContentHanlder type is class
com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler
java mail on classpath
jar:file:/D:/appdata/m2repo/org/apache/geronimo/specs/geronimo-javamail_1.4_spec/1.7.1/geronimo-javamail_1.4_spec-1.7.1.jar!/META-INF/mailcap
No explicit CommandMap: content type is class
javax.xml.transform.stream.StreamSource
No explicit CommandMap dataContentHanlder type is class
com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler
{code}
> When creating DataContentHandler, defaultCommandMap should be considered.
> -------------------------------------------------------------------------
>
> Key: CXF-4616
> URL: https://issues.apache.org/jira/browse/CXF-4616
> Project: CXF
> Issue Type: Bug
> Affects Versions: 2.6.3
> Reporter: Jinhua Wang
> Attachments: AttachmentUtil.java.patch, AttachmentUtilTest.java,
> AttachmentUtilWithoutAttachmentPartTest.java, CommandMapImpactTest.java,
> EnhancedMailcapCommandMap.java
>
>
> When creating DataContentHandler, null may be returned from CXF's static
> CommandMap. DefaultCommandMap from *CommandMap.getDefaultCommandMap()* could
> also be used to create DataContentHandler.
> Because in RI implementation,xxx.*saaj.soap.AttachmentPartImpl*,
> Some static statement would add specific content handler to default
> CommandMap.
> {code}
> CommandMap localCommandMap = CommandMap.getDefaultCommandMap();
> localMailcapCommandMap.addMailcap("text/xml" + str +
> "xxx.saaj.soap.XmlDataContentHandler");
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira