users@jersey.java.net

Jersey handler signature for binary payload ingestion

From: Mark Petrovic <mark_at_petrovic.org>
Date: Tue, 5 May 2009 11:45:58 -0700

I'm curious as to whether anyone has used the Jersey server API to
consume a binary payload via HTTP POST. I'm not sure how to express
this, or whether Jersey will even allow it, but it seems the handler
signature would look something like:

@Path("somepath")
@POST
@Consumes("octet/stream")
public void post(byte[] buffer) {
     ByteArrayInputStream bis = new ByteArrayInputStream(buffer);
     ...
}

Is this good Jersey form for consuming binary payloads? If not, what
is?

Thanks.

--
Mark Petrovic
mark_at_petrovic.org
http://www.petrovic.org