Hi Andreas, IMO the solution should be to reuse what ever the available lib for this without getting any new dependencies or forking, I prefer to use Axiom capabilities for this.
I already started work on this. I found there are two class in Axiom involve with MIME writing named MultipartWriter and OMMultipartWriter. I think OMMultipartWriter is easy to use for this scenario. But I just modify AbstractMultipartWriterTest before I port any Axis2 stuff. It seems like Axiom does not write "Content-Disposition" header with MIME part instead it write "Content-ID" ( I think XOP/MTOM and SwA required this header). Current MultipartFormDataFormatter write this header and will use in the MultipartFormDataBuilder to process messages in server side. In fact Commons Fileupload process this "Content-Disposition" header within MultipartFormDataBuilder class. At the moment Axis2 support to invoke web service through the HTML forms based on same approach ( HTML forms set this header). Is there any configuration option available to instruct Axiom to write "Content-Disposition" header ? If not I believe we need to add this feature. This is modified test code i used in Axiom. private void test(String contentTransferEncoding) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); MultipartWriter mpw = factory.createMultipartWriter(baos, UIDGenerator.generateMimeBoundary()); OutputStream partOutputStream = mpw.writePart("text/plain; charset=US-ASCII", "8bit", UIDGenerator.generateContentId()); partOutputStream.write("Hello World".getBytes()); partOutputStream.close(); partOutputStream = mpw.writePart("text/plain; charset=US-ASCII", "8bit", UIDGenerator.generateContentId()); partOutputStream.write("This is my message".getBytes()); partOutputStream.close(); mpw.complete(); System.out.println(new String(baos.toByteArray())); } I have added both messages. Thanks ! On Thu, Oct 13, 2011 at 4:03 AM, Andreas Veithen (Commented) (JIRA) <j...@apache.org> wrote: > > [ > https://issues.apache.org/jira/browse/AXIS2-3933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13126213#comment-13126213 > ] > > Andreas Veithen commented on AXIS2-3933: > ---------------------------------------- > > It should be noted that Axis2 has dependencies on two other libraries that > provide MIME multipart writing capabilities, namely Axiom and JavaMail. I'm > not sure that the optimal solution is to fork the code from Commons > HttpClient to create yet another MIME multipart writer in Axis2 (which is > what AXIS2-3933_2.patch does). > > I think that Sagara correctly identified the key problem that prevented > progress on this issue, namely the lack of test coverage. If there are enough > unit tests, then it is simple to rewrite the code to reuse Axiom or JavaMail. > >> Axis2 kernel currently has a direct dependency on Commons HttpClient 3.1 >> ------------------------------------------------------------------------ >> >> Key: AXIS2-3933 >> URL: https://issues.apache.org/jira/browse/AXIS2-3933 >> Project: Axis2 >> Issue Type: Wish >> Components: kernel >> Affects Versions: nightly >> Reporter: Oleg Kalnichevski >> Assignee: Sagara Gunathunga >> Attachments: AXIS2-3933.patch, AXIS2-3933_2.patch, axis2-kernel.patch >> >> >> (1) This seems conceptually wrong to me. The kernel ought not have any >> dependencies on a transport specific libraries >> (2) A more practical reason: it is just a matter of time HttpClient 3.1 will >> be superceded by HttpClient 4.0 and support for commons HttpClient will be >> discontinued. >> If there is an agreement this is indeed an issue, which should be resolved, >> I will happily invest time looking into what it takes to decouple HttpClient >> from Axis2 kernel. >> Oleg > > -- > This message is automatically generated by JIRA. > If you think it was sent incorrectly, please contact your JIRA > administrators: > https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa > For more information on JIRA, see: http://www.atlassian.com/software/jira > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org > For additional commands, e-mail: java-dev-h...@axis.apache.org > > -- Sagara Gunathunga Blog - http://ssagara.blogspot.com Web - http://people.apache.org/~sagara/ LinkedIn - http://www.linkedin.com/in/ssagara
Meeasge from current MultipartFormDataFormatter ========================================================================================= --MIMEBoundary_582164c66cf90d8e99aefa775ff15e3f83d941deba7093ab Content-Disposition: form-data; name="name" Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Saman --MIMEBoundary_582164c66cf90d8e99aefa775ff15e3f83d941deba7093ab Content-Disposition: form-data; name="age" Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit 20 --MIMEBoundary_582164c66cf90d8e99aefa775ff15e3f83d941deba7093ab-- ========================================================================================= Meeasge from Axiom test ========================================================================================= --MIMEBoundary_9814da69c992458e2a83edc482b4640a9574624c00d2d952 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Content-ID: <8814da69c992458e2a83edc482b4640a9574624c00d2d...@apache.org> Hello World --MIMEBoundary_9814da69c992458e2a83edc482b4640a9574624c00d2d952 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Content-ID: <b814da69c992458e2a83edc482b4640a9574624c00d2d...@apache.org> This is my message --MIMEBoundary_9814da69c992458e2a83edc482b4640a9574624c00d2d952--
--------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org For additional commands, e-mail: java-dev-h...@axis.apache.org