You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2013/01/02 17:32:13 UTC

[jira] [Commented] (CXF-4726) AttachmentDataSource stream bug and filename contains non-US-ASCII characters receive incorrect

    [ https://issues.apache.org/jira/browse/CXF-4726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13542220#comment-13542220 ] 

Daniel Kulp commented on CXF-4726:
----------------------------------


(1) is likely acceptable and possibly correct.  available() returns the number of bytes that can be read without blocking.   With the streaming attachment capabilities of CXF, that may actually be 0.

Not sure on the second one yet.  Can you wireshark the wire transfer and see if the Content-Disposition header has the proper name (I think it should be UTF-8 encoded, but not really sure).   Thus, we could tell if it's on the writing side (server) or on the reading side (client).
                
> AttachmentDataSource stream bug and filename contains non-US-ASCII characters receive incorrect
> -----------------------------------------------------------------------------------------------
>
>                 Key: CXF-4726
>                 URL: https://issues.apache.org/jira/browse/CXF-4726
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.6.4
>            Reporter: chengy
>
> When test with the mtom example by SAAJ Dispath API,I find 2 bug:
> 1,the AttachmentPart.getDataHandler().getInputStream() contains no data,available method get 0;
> 2,the filename contains non-US-ASCII characters received incorrect.
> the client test code like below:
> {code:java}
>  	URL wsdlURL=new URL("http://localhost:9000/mime-test?wsdl");
>         TestMtomService tms = new TestMtomService(wsdlURL, SERVICE_NAME);
>         TestMtomPortType port = (TestMtomPortType) tms.getPort(PORT_NAME, TestMtomPortType.class);
>         Binding binding = ((BindingProvider)port).getBinding();
>         ((SOAPBinding)binding).setMTOMEnabled(true);
>         DocumentBuilderFactory dbf= DocumentBuilderFactory.newInstance();
>         dbf.setNamespaceAware(true);
>         String s="<testDataHandler xmlns=\"http://cxf.apache.org/mime/types\"><name>Bob</name></testDataHandler>";
>         Document  doc= dbf.newDocumentBuilder().parse(new InputSource(new StringBufferInputStream(s)));
>         SOAPMessage msg=MessageFactory.newInstance().createMessage();
>         msg.getSOAPBody().addDocument(doc);
>         Dispatch<SOAPMessage> dispatch =tms.createDispatch(PORT_NAME, SOAPMessage.class, Mode.MESSAGE);
>         SOAPMessage res= dispatch.invoke(msg);
>         AttachmentPart attachmentPart=  (AttachmentPart)res.getAttachments().next();
>         System.out.println(attachmentPart.getDataHandler().getName()+";"+attachmentPart.getDataHandler().getInputStream().available());
> {code}
> the server test code like below:
> {code:java}
>    public void testDataHandler(Holder<String> name, Holder<DataHandler> attachinfo) {
>         try {
>             name.value = "Hello " + name.value;
>             attachinfo.value = new DataHandler(new FileDataSource(new File("c:/奋斗1cc.jpg")));
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>     }
> {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