[
https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13492730#comment-13492730
]
Daniel Kulp commented on CXF-4616:
----------------------------------
Are you sure this will do what you need?
In my testing with the CXF test suite and a few other tests, the call to:
{code}
DataContentHandler dch = super.createDataContentHandler(mimeType);
{code}
in your patch never once returned null. Especially for text/xml, text/plain,
etc.... Thus, the default map would never have been consulted. If I do:
{code}
for (String mt : COMMAND_MAP.getMimeTypes()) {
System.out.println(mt);
for (CommandInfo ci : COMMAND_MAP.getAllCommands(mt)) {
System.out.println(" " + ci.getCommandName() + " " +
ci.getCommandClass());
}
}
{code}
I get:
{code}
image/*
content-handler org.apache.cxf.attachment.ImageDataContentHandler
message/rfc822
content-handler com.sun.mail.handlers.message_rfc822
multipart/*
content-handler com.sun.mail.handlers.multipart_mixed
text/plain
content-handler com.sun.mail.handlers.text_plain
view com.sun.activation.viewers.TextViewer
edit com.sun.activation.viewers.TextEditor
text/xml
content-handler com.sun.mail.handlers.text_xml
view com.sun.activation.viewers.TextViewer
edit com.sun.activation.viewers.TextEditor
text/html
content-handler com.sun.mail.handlers.text_html
view com.sun.activation.viewers.TextViewer
edit com.sun.activation.viewers.TextEditor
image/jpeg
content-handler org.apache.cxf.attachment.ImageDataContentHandler
view com.sun.activation.viewers.ImageViewer
image/gif
content-handler org.apache.cxf.attachment.ImageDataContentHandler
view com.sun.activation.viewers.ImageViewer
text/*
view com.sun.activation.viewers.TextViewer
edit com.sun.activation.viewers.TextEditor
{code}
which shows a content-handler for text/xml. This is with the sun mail.jar on
the classpath. With the geronimo mail.jar, you get a similar map, but with
geronimo class names.
In addition, if you are adding things into default map in a static initializer,
you could just call AttachmentUtil.getCommandMap() and add things in there as
well.
> 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, 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