On Nov 21, 2010, at 5:59 AM, ManiKanta G wrote:
>
> Hi,
>
> Does any one knows how to do it? Any help is appreciated.
>
http://jersey.java.net/nonav/apidocs/latest/contribs/jersey-multipart/com/sun/jersey/multipart/FormDataParam.html
   @FormDataParam("uploadFile") FormDataBodyPart p
If you want to reduce the number of parameters for the part you can  
just do the above and obtain the content disposition and entity from  
"p".
Paul.
> ManiKanta G
> twitter.com/ManiKantaG
>
>
> On Wed, Nov 17, 2010 at 1:07 PM, ManiKanta G <go4mani_at_gmail.com>  
> wrote:
>
> Hi,
>
> For uploading file, I've the following code (Jersey 1.4, Mimepull  
> 1.4, jersey-multipart1.4)
>
> 	@POST
> 	@Path("upload")
> 	@Consumes(MediaType.MULTIPART_FORM_DATA)
> 	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
> 	public Response uploadFile(@FormDataParam("uploadFile")  
> FormDataContentDisposition disposition ,
> 						@FormDataParam("uploadFile") UploadObject stream) {
> 		.....
> 	}
>
> If the file has the xml content, the JAXB is doing unmarshaling the  
> upload file content into UploadObject without any error.
>
> But, if I upload a file that contains some JSON formatted data, I m  
> getting 'org.xml.sax.SAXParseException: Content is not allowed in  
> prolog' error, as the content type of the file is set to text/plain  
> by the browser.
>
> 	------WebKitFormBoundarywsLgmqEHXTyMGEo2
> 	Content-Disposition: form-data; name="uploadFile";  
> filename="TestFile.txt"
> 	Content-Type: text/plain
> 	
>
> 	------WebKitFormBoundarywsLgmqEHXTyMGEo2--
>
> So, is there any way to set the Content-Type of the multipart upload  
> file to application/json from the client side or some code that  
> identifies the type of the content based on the content (as bad as,  
> may be like trail and hit method) at server side.
>
> Thanks,
>
> ManiKanta G
> twitter.com/ManiKantaG
>