users@jersey.java.net

[Jersey] Jersey truncating the slashes from the uploaded file name

From: ManiKanta G <go4mani_at_gmail.com>
Date: Wed, 2 Feb 2011 14:33:11 +0530

Hi,

While uploading files from IE, Jersey resource is getting the file path
without any slashes (as IE' behavior for file uploads is different from the
other browsers in that it sends the complete file path of the user' system
as the file name). Is there any way to stop this default behavior of
Jersey of truncating the slashes from path.

The code I m using is no different from the one the documentation suggest:

@Path("upload")
@POST
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response uploadFile(
        @FormDataParam("file") FormDataContentDisposition disposition ,
        @FormDataParam("file") FormDataBodyPart part) {
     String fileName = disposition.getFileName();

    // some code to save the file with the user uploaded file name
}



Or in general, is there any place I can hook some code in place or before
the actual parameters were set in the resource class. I m
actually interested to know where all the resource class annotation
processing will be done.

Thanks,
ManiKanta G
twitter.com/ManiKantaG