[
https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13493041#comment-13493041
]
Jinhua Wang commented on CXF-4616:
----------------------------------
Thank you Daniel.
# When constructing MailcapCommandMap or its subclass, constructor would load
resources from "META-INF/mailcap" which can be found from mail.jar. Therefore
when mail.jar on the classpath, specific content-handlers are found and
printed.If without mail.jar on the classpath, those content-handlers printed
out cannot be found.
# There are different dataContentHandler implementations, such as
|RI|no config/static initializer from AttachmentPartImpl|
|javamail|load config from meta/mailcap|
|geronimo-mail|load config from meta/mailcap|
If without javamail or geronimo on classpath, there is only
ImageDataContentHandler provided by cxf.
Content-handler provided by RI is preferred when mail.jar is not on the
classpath.
Therefore, a new subclass of MailcapCommandMap is created to get
defaultCommadMap configurations which have been filled by a static initializer
in RI.
# There is a sequence issue between static initializer and adding things to
AttachmentUtil.getCommandMap().
#* As it is a static initializer in RI(AttachmentPartImpl), static initializer
is invoked by JVM and out of our control.
#* That is before static initializer execution, there is nothing in
defaultCommandMap. And there is nothing to be added to
AttachmentUtil.getCommandMap().
# Update EnhancedMailcapCommandMap and add two CommandMap test in attachments.
EnhancedMailcapCommandMap overrides getAllCommands(), getCommand(),
getMimeTypes methods.
Please help to review my thoughts and 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, 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