cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "George Gao" <geor...@platform.com>
Subject CXF JAX-RS "Content-Disposition" is lost for second multipart
Date Wed, 10 Mar 2010 18:16:03 GMT
 

I create a RestFul service for dealing with multiparts:

 

Part 1: application/xml(form data) à Bean in server side

Part2: application/octet-stream  à upload file,

 

But the "Content-disposition" of the part2 is translated into: key="ontent-disposition", so
the information about

        Content-disposition can not be retrieve in server side.

 

      I want to find out the filename in the part2, but exception happen for:

 

 

 

Server side code:

      Attachment att = atts.get(1);

      String filename = att.getContentDisposition().getParameter("filename");

 

Client side code:

-----------------------------------------------------------------------

import httplib2

 

http = httplib2.Http()

url='http://ib11b02.lsf.platform.com:9000/webservice/upload'

 

body = """

--bqJky99mlBWa-ZuqjC53mG6EzbmlxB

Content-Disposition: form-data; name='data'

Content-Type: application/xml; charset=US-ASCII

Content-Transfer-Encoding: 8bit

 

<?xml version='1.0' encoding='UTF-8' standalone='yes'?> <Customer>  <name>Sharon
Gao3</name> </Customer>

--bqJky99mlBWa-ZuqjC53mG6EzbmlxB

Content-Disposition: form-data; name='file1'; filename='genome.jpeg';

Content-Type: application/octet-stream

Content-Transfer-Encoding: UTF-8

Content-ID: <file1>

 

PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg

Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg==

 

--bqJky99mlBWa-ZuqjC53mG6EzbmlxB--

"""

 

headers = {'Content-Type': 'multipart/mixed; boundary=bqJky99mlBWa-ZuqjC53mG6EzbmlxB',

            'Content-Length': str(len(body))}

response, content = http.request(url, 'POST', body=body, headers=headers)

 

 

Regards

 

 

--George


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