users@jersey.java.net

Re: [Jersey] Sending binary files over multipart/mixed

From: Tatu Saloranta <cowtowncoder_at_yahoo.com>
Date: Mon, 24 Nov 2008 13:02:53 -0800 (PST)

--- On Mon, 11/24/08, Gili <cowwoc_at_bbs.darktech.org> wrote:

> From: Gili <cowwoc_at_bbs.darktech.org>
> Subject: [Jersey] Sending binary files over multipart/mixed
> To: users_at_jersey.dev.java.net
> Date: Monday, November 24, 2008, 1:44 PM
> Hi,
>
> I was under the impression that multipart/mixed used MIME and MIME allowed
> transparent transfer of binary data (versus say XML). Then
> today I ran across http://www.pcnineoneone.com/howto/ftp1.html which
> says "your file is encoded as text in the data stream, and converted back to
> binary on your end. The encoding adds considerable overhead to the
> transmission."
>
> Huh? It sounds to me like he's implying that MIME requires base64 encoding.
> So who is right? Does MIME transfer binary data with or without encoding?

As far as I understand, it is possible to do either: traditionally base64 encoded content is used (for assumed need to be 7-bit compatible), but it is also possible to include inlined non-encoded binary content. See http://en.wikipedia.org/wiki/MIME for more info, esp. comments about soap/MTOM use cases being different from email usage of MIME.
There are some complications wrt. doing latter, but it should be doable, and lots of effort seems to be spent on that within XML/Soap/MTOM community.

As to whether MIME multi-part approach is required for efficient binary support (compared to inlined base64-encoded content for xml or json), I think jury is still out. I believe latter can be made efficient enough too (and if anyone is interested in details feel free to follow up wrt. my work with Woodstox 4.0 -- but that's getting bit OT)

-+ Tatu +-