users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: restrict Request.getEntityInputStream()?

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Tue, 13 Dec 2011 15:48:54 +0100

On 12/13/2011 03:21 PM, Bill Burke wrote:
>
>
> On 12/13/11 6:14 AM, Marek Potociar wrote:
>>
>>
>> On 12/13/2011 01:47 AM, Bill Burke wrote:
>>> I don't not think Request.getEntityInputStream() should be allowed on the client side. An IllegalStateException should
>>> be thrown.
>>
>> Why?
>>
>
> Because a request on the client only has an output stream. Only the response on the client has an input stream.

Even when considering filters that may store the request entity?

>
>
>>>
>>> Also on the client, RequestBuilder.entityInputStream should be equivalent to:
>>>
>>> RequestBuilder.entity(inputStream);
>>>
>>> or also throw an IllegalStateException
>>
>> Makes me also wonder if we need the getEntityInputStream() method at all... Would Request.getEntity(InputStream.class)
>> be a viable replacement for both, server and client side?
>>
>
> You need it for the server side as you are using the same interface for client and server.
>

Not sure we are on the same page. My question is, whether you think that (on the server side) the following 2 methods
are interchangeable:

request.getEntity(InputStream.class);
request.getEntityInputStream();

Marek