users@jersey.java.net

[Jersey] Re: Handling Content-transfer-encoding

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Wed, 17 Aug 2011 18:27:45 +0200

Hello Daniel,

if I recall correctly, Jersey does not support automatic base64
decoding, you'll need to do it by yourself. It shouldn't be hard, you
could be able to implement it as a container request filter [1], [2].

We do have Base64 util class (jersey-core:com.sun.jersey.util.Base64),
but it works only with arrays/Strings - we use it for short strings
mainly for http basic auth, but you can take it as an inspiration for
your implementation.

Regards,
Pavel

[1]
http://jersey.java.net/nonav/apidocs/1.8/jersey/com/sun/jersey/spi/container/ContainerRequestFilter.html
[2]
http://jersey.java.net/nonav/apidocs/1.8/jersey/com/sun/jersey/api/container/filter/package-summary.html

On 8/17/11 6:04 PM, Daniel Josefsson wrote:
> I am currently trying to get my jersey REST endpoint to accept and
> decode base64-encoded content.
>
> At the moment, when the header "Content-transfer-encoding: base64" is
> set and the content is base64 encoded, the content I receive in my
> receiving method is still base64-encoded. The method takes an inputstream.
>
> How should this be handled?
>
> I am not sure whether this should be handled by Jersey or Tomcat (or
> something else). I can't find anything on the web when searching for it.
>
>
> Thanks in advance,
>
> Daniel
>