users@jersey.java.net

Re: [Jersey] Multipart Form And Encoding

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 02 Nov 2009 14:36:40 +0100

On Nov 2, 2009, at 2:29 PM, Jordi Domingo wrote:

> Hi Paul,
>
> 1) No
>

That is a problem then because the consumer of the multipart/form-data
has to assume (unless there is some out-of-band information) that the
charset is UTF-8.


> POST /projects/1/vulnerabilities/29/evidences/9/attachments HTTP/1.1
> Host: localhost:8080
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:
> 1.9.0.14) Gecko/2009082707 Firefox/3.0.14 (.NET CLR 3.5.30729)
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/
> *;q=0.8
> Accept-Language: en-us,en;q=0.5
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Proxy-Connection: keep-alive
> Referer: http://localhost:8080/projects/1/vulnerabilities/29/evidences/9/attachments/new
> Cookie: JSESSIONID=4e0e10d1e122370548a6bf6126af
> Content-Type: multipart/form-data;
> boundary=---------------------------112241574819923
> Content-Length: 1594
>
> -----------------------------112241574819923
> Content-Disposition: form-data; name="name"
>
> Això és una evidència
> -----------------------------112241574819923
> Content-Disposition: form-data; name="description"
>
> Això és una evidència
> -----------------------------112241574819923
> Content-Disposition: form-data; name="filename";
> filename="favicon.ico"
> Content-Type: image/x-icon
>
> ......
>
> 2) It works in my pc, packed war and will try on preproduction server.
>
> Thanks :)

Hmm.. i dunno why that worked then unless the client encoded in UTF-8.


>
> BTW i found another issue, sending an attachment with firefox and
> asking for filename
> fdbp.getContentDisposition().getParameters().get("filename");
> i get the filename favicon.ico but with iexplore i get
> c:favicon.ico. Im not sure if this is something multipart must be
> aware.
>

Grrr.. why are browsers so bad at this! :-) I am assuming the content-
disposition is of the following:

   Content-Disposition: form-data; name="filename";
filename="c:favicon.ico"

in the log messages?

Paul.