users@jersey.java.net

[Jersey] Re: How to post a file and other form fields by Jersey client

From: Jitesh <jisinha_at_cisco.com>
Date: Wed, 22 Jun 2011 12:11:03 -0700 (PDT)

ClientHandlerException was coming because I had deleted
service.type(MediaType.Multipart_Form_data) -
I restored that and exception was gone.

So now I am back to the main problem - I am not able to get values on server
side.

Server side method is
@Transactional
        @RequestMapping(method = RequestMethod.POST, value = "/request")
        @Consumes("multipart/form-data")
        //public ModelAndView requestTranslation(@RequestBody String body)
        public ModelAndView requestTranslation(@ModelAttribute("clientCommand")
ClientCommand clientCommand,
                        HttpServletRequest request, HttpServletResponse
response,FormDataMultiPart formData)

System.out.println("sourceLanguage is "+
formData.getField("sourceLanguage")) ;
                System.out.println("uploadFile is "+ formData.getField("uploadFile")) ;


Both of above print statements print null.Please someone help.

--
View this message in context: http://jersey.576304.n2.nabble.com/How-to-post-a-file-and-other-form-fields-by-Jersey-client-tp6502947p6505664.html
Sent from the Jersey mailing list archive at Nabble.com.