users@jersey.java.net

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

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Wed, 2 Feb 2011 10:20:07 +0100

Hi,

I am not precisely sure what "file path" you are referring to, is it
the value of the file name obtained from the content disposition?

Could you send an example e.g. from logging or from snooping on the
HTTP port?

Paul.

On Feb 2, 2011, at 10:03 AM, ManiKanta G wrote:

>
> 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