Some more possible approaches to making it work consistently:
- try adding a Content-Encoding header to an attachment
- make all browsers upload the binary file to the server and check how each individual browser sets the headers such as Content-Type and Content-Disposition of individual parts...

Let us know how it goes please
Sergey

On 02/11/11 18:11, Sergey Beryozkin wrote:
Hi,

On 02/11/11 15:04, Piotr Skawinski wrote:
Hi,

I'm facing different behaviours with MultipartBody on REST services. When
using MultipartBody as a return value on a service method annotated with
jax-rs annotation like:

@GET
@Path("/downloadFile/{ticket}/{fileId}")
@Produces("multipart/mixed")
MultipartBody downloadFile(@PathParam("ticket") String
ticket, @PathParam("fileId") String fileId) throws IOException;

Internet Explorer cannot download the file being included in
MultipartBody
correctly, but shows only the binary content of MultipartBody (the file
being included in it). Chrome and Safari is downloading the content of
the
file nicely, but is not showing the file name that is specified as:

MultipartBody multipartBody = new MultipartBody(new
Attachment("eclosure",
new FileInputStream(file),
new ContentDisposition("attachment;filename=" +
fileInfo.getFileNameWithCpr())));

Only the Fifefox is downloading the file as expected.

Any help will be appriciated.

thanks for this info, if it were possible to somehow compare the
payloads returned from CXF against some similar payloads from some other
services then it would probably help, I guess I can try that too but a
bit later.
But then Firefox did manage to get it right, so...
Actually, could it be that other browsers don;t like "multipart/mixed"
and expect "multipart/form-data" ? Can you try it please ?

Cheers, Sergey

Piotr



Reply via email to