You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2011/02/06 19:08:30 UTC

[jira] Commented: (CXF-3304) WebClient POST to a resource that returns 401 returns a blank InputStream when there's supposed to be text

    [ https://issues.apache.org/jira/browse/CXF-3304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12991190#comment-12991190 ] 

Sergey Beryozkin commented on CXF-3304:
---------------------------------------

I've debugged and I can see that HttpURLConnection is returning an empty stream, both for conn.getInputStream and conn.getErrorStream(), despite the fact the text is contained in the error response.

Can you please verify it on your own, first check that the server actually returns the text, using the tcptrace, and then check the streams explicitly, perhaps using Apache HttpClient or just useing HTTPURLConnection directly ?

I suspect it is just a strange error in the Java HTTPUrlConnection. I believe 401 is usually supposed to have no response body so it could be HTTPUrlConnection enforces it by ignoring the response text if any

cheers, Sergey  

> WebClient POST to a resource that returns 401 returns a blank InputStream when there's supposed to be text
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-3304
>                 URL: https://issues.apache.org/jira/browse/CXF-3304
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.2
>         Environment: JDK 1.6
>            Reporter: Jason Downey
>            Priority: Minor
>             Fix For: 2.3.3
>
>         Attachments: cxf_jax_rs_post_401_bug.zip
>
>
> I have two methods that return the same error message upon POST. The only difference is that one returns a 404 response status, the other returns a 401 response status.
> POSTing to the resource that returns 404 returns an InputStream containing the error message when you call Response.getEntity(). However, POSTing to the resource that returns 401 returns a blank InputStream when you call Response.getEntity().
> This problem was not reproducible with GET.
> Test case code attached. Launch the server using JettyServer. Then run the WebClient test in WebClientTest.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira