users@jersey.java.net

[Jersey] Re: _at_FormDataParam gives Bad Request.

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Wed, 07 Dec 2011 17:05:33 +0100

On 12/6/11 8:37 AM, kavita wrote:
> Hi,
> I have a REST web service to which I am sending multipart form data. Since
> Glassfish 3.1 uses jdk7, I had to change the @FormParam to @FormDataParam in
> the webservice method signature.

eh? Glassfish 3.1 can run on jdk 1.6, not sure about 1.7 but I guess it
should run.. anyway, that sentence doesn't make much sense. @FormParam
is present in JAX-RS 1.x API so you don't need to replace it with
anything, it is just there and it should work.

> Doing this causes all the requests to my
> web service ending up as Bad Request errors.
> I am using an ajax request to call the web service. This is the call:
>
>
> var formdata = new FormData();
> formdata.append("purpose","new");
> formdata.append("filename",workbook);
> formdata.append("username","abc");
> formdata.append("password","abc");
> formdata.append("company","Third");
>
> $.ajax({
> url:'http://comp1:8080/RestWSGS/jersey/GetJson',
> async: false,
> data:formdata,
> type: 'POST',
> cache: false,
> dataType: 'json',
> contentType: "multipart/form-data",
> processData: false,
> success: function(data)
> {
> myData=data;
> alert("myData" + myData);
> }
> });
> Please let me know how can I ask jersey to convert the FormData object to
> the F_at_FormDataParam.
can you please look into server log (and let us know what you found
there)? And is it possible for you to share service code as well?

Pavel
>
> Thanks for any help you can provide!!
> Kavita
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/FormDataParam-gives-Bad-Request-tp7065882p7065882.html
> Sent from the Jersey mailing list archive at Nabble.com.
>