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

I'm not against it, but we would need to make sure that the current behavior 
for all the attachment types that we currently support remains the default.  
Thus, it MAY require then creating additional content handlers to keep the 
streaming for the XML and Text and other types and make sure they are also 
added prior to the additional handles copied from the default map.


Dan



On Nov 1, 2012, at 8:24 AM, Jinhua Wang <[email protected]> wrote:

> 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

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to