[jax-rs-spec users] [jsr339-experts] Response.readEntity contract does not allow streaming

From: Sergey Beryozkin <>
Date: Fri, 2 Aug 2013 21:34:41 +0100


The sentence in Response.readEntity method,

"Unless the supplied entity type is an input stream, this method
automatically closes the an unconsumed original response entity data
stream if open" breaks streaming completely, example:

Source source = Response.readEntity(Source.class);

Any Source implementation which does not buffer immediately becomes of
no use. Lazy loading DOM Documents get broken. And 'fixing' it by
buffering obviously defeats the purpose of streaming.

IMHO we need to remove an auto-closing requirement from 2.1. This falls
into an optional optimization area - meaning a JAX-RS property can fix
it and Configuration instances can carry along such properties

Cheers, Sergey