jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: [jax-rs-spec users] Unexpected Response.fromResponse result

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Tue, 7 Aug 2012 09:57:02 -0400

Hi Sergey,

> In 2.0 I'm seeing 'Response.fromResponse(r)' losing the original 'String', and after checking the java docs I'm seeing:
>
> "Note that if the entity is backed by an un-consumed input stream, the reference to the stream is copied. In such case make sure to buffer the entity stream of the original response instance before passing it to this method."

 It also states: "The original response entity instance reference is set in the new response builder." The statement above is for the special case of an InputStream, that's all. The implementation code seems to be doing the right thing too.

> I think it's an API bug. The assumption is made there that the Response entity is kept as InputStream - which is an implementation detail of Response.

 That's not how I read it. See above.

-- Santiago