hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 27109] - HTTP Client doesn't support multipart/related content-type
Date Fri, 20 Feb 2004 16:44:49 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27109>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27109

HTTP Client doesn't support multipart/related content-type





------- Additional Comments From peter.tolmachov@agfa.com  2004-02-20 16:44 -------
Yes of course I had a look to MultipartPostMethod.
I agree that in most cases it is enough to use just MultipartPostMethod class.
That's probably because multipart/related encoding in some way is an extention 
of multipart/form data.
But it is not possible to send data easely that uses features introduced in 
Multipart/Related data

Here are the main problems why it is not possible:

(problem1)- 'multipart related part' in comparison with 'multipart form data 
related part' has additional Content-ID header that 

can be used as the reference from other multipart related parts;
   send(OutputStream out) method of Part class doesn't send Content-ID header;

so HTTP Client will send something like 

--example-2
     Content-Type: Text/x-Okie; charset=iso-8859-1;

     {doc}
     This picture was taken by an automatic camera mounted ...
     {image file=cid:ID-2}
     {para}
     Now this is an enlargement of the area ...
     {image file=cid:ID-3}
     {/doc}

instead of

--example-2
     Content-Type: Text/x-Okie; charset=iso-8859-1;
     Content-ID: ID-1

     {doc}
     This picture was taken by an automatic camera mounted ...
     {image file=cid:ID-2}
     {para}
     Now this is an enlargement of the area ...
     {image file=cid:ID-3}
     {/doc}


(problem2)- addRequestHeaders(HttpState state, HttpConnection conn)  method of 
MultipartPostMethod class
 writes to a "Content-Type" something like : 
"multipart/form-data, boundary=AaB03x" 
and thit is correct for multipart form data(rfc 1867), but for multipart 
related data(according to rfc 2387) this 

method should generate something like:
"multipart/related; boundary=AaB03x; start="ID-1" type="Text/x-Okie"
where  'start' ant 'type' parameters are the content-ID and type of the 
compound object's root body part;

There are another small diferences as well(see rfc 2387).

It looks like the easiest way to make Http Client support multipart/related 
data is to add two classes : e.g. 

MultipartRelatedMethod that extends MultipartPostMethod and implements 
addRequestHeaders(HttpState state, 

HttpConnection conn) method according to rfc 2387 and MultipartRelatedPart 
class that extends Part class and 
implements send(OutputStream out) method according to rfc 2387. Of course 
classes(for all multipart related parts)
should have MultipartRelatedPart as super class.

Could you please comment on this. If you know another way how to overcome this 
problem please tell me.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Mime
View raw message