NikitaBaksalyar
NikitaBaksalyar

Reputation: 2514

How do I accept base64-encoded data in JAX-RS (Jersey)?

Because there's no ubiquitous support for sending binaries through XHR (AJAX) in browsers yet, I need to send a PNG image in a base64 encoding (with a Content-Encoding: base64 HTTP header, presumably).

What's the correct way to decode the base64-encoded data on the Jersey's side?

Upvotes: 2

Views: 3048

Answers (1)

Perception
Perception

Reputation: 80633

Use one of the decode methods on com.sun.jersey.core.util.Base64. You can also pull in Apache Commons Codec and use their DigestUtils class, but thats totally unnecessary if you're already using Jersey libraries.

Upvotes: 4

Related Questions