users@jersey.java.net

[Jersey] Problems with Jersey and Multipart

From: Á. Eduardo García <egarcia_at_swissms.ch>
Date: Thu, 3 Dec 2009 05:37:10 -0800 (PST)

Hi!

I'm having some issues with multipart forms. I'm using jersey-multipart, and
Glassfish says this when starting:

INFO: Adding the following classes declared in
META-INF/services/jersey-client-components to the client configuration:
  class com.sun.jersey.multipart.impl.MultiPartConfigProvider
  class com.sun.jersey.multipart.impl.MultiPartReader
  class com.sun.jersey.multipart.impl.MultiPartWriter

My method looks like:

@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
public String onPost(
        @FormParam("auth") String paramAuth,
        @FormDataParam("data") InputStream paramData)
{
    ...

However, Glassfish throws an error when I call the method:

<h1>HTTP Status 400 - </h1>
<p>type Status report</p><p>message</p>
<p>descriptionThe request sent by the client was syntactically incorrect
().</p>

...with this browser call:

POST /broker/resources/media HTTP/1.0
HOST: localhost
X-Real-IP: 127.0.0.1
X-Forwarded-For: 127.0.0.1
Connection: close
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;
rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
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
Cookie: lang=en; PHPSESSID=164536ab1c4325740e43f65e1a0dcc40
Content-Type: multipart/form-data;
boundary=---------------------------1972830227210115509948244095
Content-Length: 61

I don't know what the problem is, and Glassfish log is empty, so maybe
someone can shed some light.

Thanks in advance!
-- 
View this message in context: http://n2.nabble.com/Problems-with-Jersey-and-Multipart-tp4106038p4106038.html
Sent from the Jersey mailing list archive at Nabble.com.