Looks like a bug to me. Can you please file a new issue?
https://java.net/jira/browse/JERSEY
Thanks,
Marek
On Jun 13, 2013, at 1:09 PM, Ezequiel Mario <ezequielballesi_at_gmail.com> wrote:
> Hi, how are you?
>
> I don't know if this is the correct channel to submit issues, if not please let me know.
>
> Regarding Jersey Client, I've came to find a problem when trying to retrieve the body of a HTTP response with status 302. According to the RFC doc http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.3 a body on these responses is valid, but the jersey client is not returning the input stream on the ClientResponse.
>
> Debugging the jersey client I found that this method
> com.sun.jersey.client.urlconnection.URLConnectionClientHandler.getInputStream(HttpURLConnection)
> is not returning the body, since it calls
> HttpURLConnection.getErrorStream()
> when the status code is greater or equal to 300. And given this implementation
> sun.net.www.protocol.https.HttpsURLConnectionImpl (http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7-b147/sun/net/www/protocol/http/HttpURLConnection.java#HttpURLConnection.getErrorStream%28%29)
> that return null for status codes less than 400, the error input stream for [300,400) statuses is not being correctly captured.
>
> This was tested on client version 1.13.
> Looking at the code for the version 2, I think the issue is still there since I found the class https://github.com/jersey/jersey/blob/master/core-client/src/main/java/org/glassfish/jersey/client/HttpUrlConnector.java method getInputStream, and it seems to behave the same way.
>
> Anyway I'm not sure if this behavior is the expected one.
>
> Please let me know if I can assist further.
> Thanks!