users@jersey.java.net

Re: [Jersey] Problems with Jersey and Multipart

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

My version of Jersey is 1.1.4.1 and Glassfish b73.

Right now I cannot create a test case, maybe in a few hours (although my
HTML and java code couldn't be simpler, I'm using a plain form with one
'file' field and a class with a @Path and the @POST method I added earlier).

Using FormDataMultiPart doesn't show any change. Using another browser also
doesn't help. However, using @FormParam instead of @FormDataParam in all
parameters, throws this on Glassfish log:

SEVERE: The RuntimeException could not be mapped to a response, re-throwing
to the HTTP container
com.sun.jersey.api.container.ContainerException:
javax.mail.MessagingException: Missing start boundary
        at
com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider.processForm(MultipartFormDispatchProvider.java:91).
...

Tell me if that helps.


Paul Sandoz wrote:
>
>
> On Dec 3, 2009, at 2:47 PM, Á. Eduardo García wrote:
>
>> Thanks for your fast response, Paul!
>>
>> However, changing all parameters to FormDataParam does the same. No
>> log whatsoever on Glassfish, and only that reply. I don't know where
>> to look at, I've tried a few things and nothing. Is any
>> configuration parameter needed or anything like that?
>>
>
> What version of Jersey or GF are you using?
>
> Can you send me a reproducible test case?
>
>
> What happens if you change the method parameters to be:
>
> onPost(FormDataMultiPart fdmp) { .... }
>
> It could be data sent by the client is incorrect or there is an error
> extracting the parameters.
>
> Paul.
>
>> Thanks again!
>>
>> On 3 Dec 2009, at 14:44, Paul Sandoz [via Jersey] wrote:
>>
>>>
>>> On Dec 3, 2009, at 2:37 PM, Á. Eduardo García wrote:
>>>
>>> >
>>> > 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,
>>> The above should be @FormDataParam("auth"). Can you change that and
>>> see if it works for you.
>>>
>>> Paul.
>>>
>>> > @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.
>>> >
>>> >
>>> ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: [hidden email]
>>> > For additional commands, e-mail: [hidden email]
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>
>> Ángel Eduardo García Hernández
>> [hidden email]
>>
>>
>>
>>
>>
>> View this message in context: Re: [Jersey] Problems with Jersey and
>> Multipart
>> Sent from the Jersey mailing list archive at Nabble.com.
>
>
>

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