users@jersey.java.net

Re: [Jersey] Jersey handler signature for binary payload ingestion

From: Gregory Gerard <ggerard_at_mac.com>
Date: Tue, 05 May 2009 12:24:37 -0700

What's would be the right curl invocation to test this?

Doesn't POST normally do the form encoding? Would the InputStream see
the raw stream or a processed stream?

thanks,
greg

On May 5, 2009, at 12:15 PM, Marc Hadley wrote:

> On May 5, 2009, at 2:45 PM, Mark Petrovic wrote:
>
>> 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) {
>
> You can use InputStream as the type of the method argument instead:
>
> public void post(InputStream stream) {
>
>> Is this good Jersey form for consuming binary payloads?
>>
> Yes.
>
> Marc.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>