users@jersey.java.net

Re: [Jersey] Problems with Jersey and Multipart

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 03 Dec 2009 16:35:31 +0100

On Dec 3, 2009, at 4:28 PM, Á. Eduardo García wrote:

> Ok, I've found the issue, and completely my fault.
>
> My fields didn't have any name, but only ids. So nothing was being
> sent, and the multipart header was half empty (Only First boundary
> was sent, as I posted a while ago, but no "Encapsulated multipart
> part:")
>
> Maybe Jersey should support sending this kind of forms, or at least,
> degrade gracefully or throw an exception.

It threw a 400 :-) which was correct, however what we need to do is
provide some better logging. It looks like browser is producing
malformed content and the error is happing in the MIME pull API
(perhaps it is something we can fix in that).

I changed Jersey to stop logging exceptions. But i think i need to re-
introduce this. If you have time could you log an issue so i do not
forget about this?

Paul.


>
> Anyway, lot of thanks for your time, Paul!!
>
> On 3 Dec 2009, at 16:17, Paul Sandoz [via Jersey] wrote:
>
>>
>> On Dec 3, 2009, at 4:10 PM, Á. Eduardo García wrote:
>>
>> >
>> > 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).
>> >
>> OK. If you can send me (privately if you like) your HTML that would
>> help me and i can easily create the server side.
>>
>>
>> > 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.
>> >
>> So when you do that you are using the deprecated multipart/form-data
>> support. It seems to indicate an error in the information the client
>> sends to the server.
>>
>> And what if you change your method signature to:
>>
>> onPost(FormDataMultiPart fdmp) { .... }
>>
>> ?
>>
>> Paul.
>>
>> ---------------------------------------------------------------------
>> 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.