cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jinhua Wang <ivywj...@gmail.com>
Subject COMMAND_MAP in AttachmentUtil
Date Thu, 01 Nov 2012 12:24:10 GMT
Hello

I have a question about content-handler.

1. In AttachmentImpl constructor, dataHandler is set the CommandMap
from AttachmentUtil.
*org.apache.cxf.attachment.AttachmentImpl.AttachmentImpl(String,
DataHandler)*

this.dataHandler.setCommandMap(AttachmentUtil.getCommandMap());


2. In AttachmentUtil, a static MailcapCommandMap was constructed with image
content handler.
*org.apache.cxf.attachment.AttachmentUtil*
private static final MailcapCommandMap COMMAND_MAP = *new
MailcapCommandMap()*;
static {
*COMMAND_MAP.addMailcap("image/*;;x-java-content-handler=" *
*   + ImageDataContentHandler.class.getName());*
}
public static CommandMap getCommandMap() {
return COMMAND_MAP;
}

3. In CommandMap, there is also a static default CommandMap.
javax.activation.CommandMap
*private static CommandMap defaultCommandMap = null;*
public static CommandMap getDefaultCommandMap()
{
if (defaultCommandMap == null) {
  defaultCommandMap = new MailcapCommandMap();
}
return defaultCommandMap;
}


4. In RI implementation, xxx.saaj.soap.AttachmentPartImpl,
Some static statement would add specific content handler to default
CommandMap.

CommandMap localCommandMap = CommandMap.getDefaultCommandMap();
*localMailcapCommandMap.addMailcap("text/xml" + str +
"xxx.saaj.soap.XmlDataContentHandler");*


In this scenario, AttachmentUtil.getCommandMap() in CXF would get
CommandMap constructed by itsself, because CXF does not use the default
CommandMap.
If other party add some specific content handler(such as #4),  the
CommandMap together with dataHandler in CXF does not contain these specific
content handlers.

I wonder whether we could copy content handler from default CommandMap to
CommandMap in *AttachmentUtil* after adding ImageDataContentHandler ?



Best Regards

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message