You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Jinhua Wang (JIRA)" <ji...@apache.org> on 2012/11/06 08:58:12 UTC

[jira] [Created] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Jinhua Wang created CXF-4616:
--------------------------------

             Summary: 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


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

[jira] [Updated] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang updated CXF-4616:
-----------------------------

    Attachment: CommandMapImpactTest.java
    
> 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

[jira] [Updated] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang updated CXF-4616:
-----------------------------

    Attachment: AttachmentUtilWithoutAttachmentPartTest.java
                AttachmentUtilTest.java
                EnhancedMailcapCommandMap.java
    
> 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

[jira] [Commented] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ 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

[jira] [Updated] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang updated CXF-4616:
-----------------------------

    Attachment: EnhancedMailcapCommandMap.java
    
> 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

[jira] [Updated] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang updated CXF-4616:
-----------------------------

    Attachment: AttachmentUtilWithoutAttachmentPartTest.java
                AttachmentUtilTest.java
                EnhancedMailcapCommandMap.java
    
> 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

[jira] [Updated] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang updated CXF-4616:
-----------------------------

    Attachment: EnhancedMailcapCommandMap.java
                AttachmentUtil.java.patch
    
> 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

[jira] [Updated] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang updated CXF-4616:
-----------------------------

    Attachment:     (was: EnhancedMailcapCommandMap.java)
    
> 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
>
>
> 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

[jira] [Updated] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang updated CXF-4616:
-----------------------------

    Attachment: AttachmentUtilWithoutAttachmentPartTest.java
                AttachmentUtilTest.java
    
> 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

[jira] [Commented] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13494085#comment-13494085 ] 

Daniel Kulp commented on CXF-4616:
----------------------------------


Can I ask one more question for you to investigate:

CXF attachment support requires that the class javax.mail.internet.InternetHeaders is found on the classpath.  Without a mail jar (geronimo or the oracle version), any idea where that class is coming from in your case?

In our WHICH-JARS file, we specifically state that geronimo-javamail (or sun equivalent) is a REQUIRED jar.   I'm mostly curious where the InternetHeaders class is coming from if there isn't a mail jar there.  


                
> 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

[jira] [Updated] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang updated CXF-4616:
-----------------------------

    Attachment:     (was: EnhancedMailcapCommandMap.java)
    
> 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

[jira] [Updated] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang updated CXF-4616:
-----------------------------

    Attachment:     (was: AttachmentUtilWithoutAttachmentPartTest.java)
    
> 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

[jira] [Commented] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13495467#comment-13495467 ] 

Daniel Kulp commented on CXF-4616:
----------------------------------


Ah.  OSGi....  that certainly explains a lot.  :-)   Sometimes I really find OSGi (and the differences between it an non-osgi runtimes) annoying.

Anyway, that analysis makes sense within OSGi when using some mail providers.  I'd likely want to check the servicemix specs version of the mail bundle to see if it handles the mailcaps better.   But that's just an aside.  

Thanks for the extra information.  Definitely helps understand the environment that is causing the issues.  



                
> 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

[jira] [Updated] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang updated CXF-4616:
-----------------------------

    Attachment:     (was: EnhancedMailcapCommandMap.java)
    
> 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

[jira] [Updated] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang updated CXF-4616:
-----------------------------

    Attachment:     (was: AttachmentUtilTest.java)
    
> 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

[jira] [Updated] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang updated CXF-4616:
-----------------------------

    Attachment:     (was: AttachmentUtilTest.java)
    
> 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

[jira] [Commented] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
    [ 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

[jira] [Resolved] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-4616.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.7.1
                   2.6.4
         Assignee: Daniel Kulp
    
> 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
>            Assignee: Daniel Kulp
>             Fix For: 2.6.4, 2.7.1
>
>         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

[jira] [Updated] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jinhua Wang updated CXF-4616:
-----------------------------

    Attachment:     (was: AttachmentUtilWithoutAttachmentPartTest.java)
    
> 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

[jira] [Commented] (CXF-4616) When creating DataContentHandler, defaultCommandMap should be considered.

Posted by "Jinhua Wang (JIRA)" <ji...@apache.org>.
    [ 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