users@jersey.java.net

Re: [Jersey] Accessing the Request's InputStream

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Sat, 18 Apr 2009 10:09:04 -0400

On Apr 17, 2009, at 6:02 PM, J Irving wrote:
>
> Section 4.2.4 indicates that the implementation MUST include an entity
> provider for InputStream, so in theory you should be able to do this:
>
> @POST
> public void post(InputStream is) {
> // etc
> }
>
That should work.

Another thing you might want to look at is packaging the existing code
that consumes the input stream as an implementation of
MessageBodyReader:

https://jsr311.dev.java.net/nonav/releases/1.0/javax/ws/rs/ext/MessageBodyReader.html

Marc.

>
> On Fri, Apr 17, 2009 at 17:39, Christian Schneider
> <christian.schneider_at_itanius.com> wrote:
>> Hello,
>>
>> I'm in the process of migrating a legacy REST-like web application
>> towards a
>> full REST-style app. Thereby I'd like to introduce Jersey as the
>> RESTful
>> framework. Unfortunately the legacy app handled a few form POSTs
>> not using
>> named form parameters, instead it simply received the posted data
>> (a few
>> KBytes long String) as the InputStream fetched via
>> request.getInputStream().
>>
>> I can't address the POSTed data using the @FormParam annotation
>> since I
>> can't name that parameter. Is there any way to fetch the raw
>> InputStream for
>> legacy purposes? Using "@Context with a Request type" doesn't seem
>> to do the
>> job. Personally I believe that no JSR-311 compatible framework can
>> provide
>> access to the underlying stream since when these frameworks invoke
>> the
>> user's code the request parsing has already happened and the stream
>> was
>> emptied by parsing it into params and all that stuff.
>>
>> Am I right with this assumption or is there still some way to
>> access the
>> request's InputStream in Jersey?
>>
>> thx + Kind Regards,
>> Chris
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>