Return-Path: Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: (qmail 64510 invoked from network); 8 Feb 2011 05:22:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Feb 2011 05:22:23 -0000 Received: (qmail 72355 invoked by uid 500); 8 Feb 2011 05:22:23 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 72287 invoked by uid 500); 8 Feb 2011 05:22:21 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 72279 invoked by uid 99); 8 Feb 2011 05:22:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Feb 2011 05:22:20 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Feb 2011 05:22:18 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 75BE9199027 for ; Tue, 8 Feb 2011 05:21:57 +0000 (UTC) Date: Tue, 8 Feb 2011 05:21:57 +0000 (UTC) From: "Jason Downey (JIRA)" To: issues@cxf.apache.org Message-ID: <290520934.1743.1297142517478.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <448728564.6697.1296710789562.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] Issue Comment Edited: (CXF-3304) WebClient POST to a resource that returns 401 returns a blank InputStream when there's supposed to be text MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CXF-3304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12991805#comment-12991805 ] Jason Downey edited comment on CXF-3304 at 2/8/11 5:20 AM: ----------------------------------------------------------- Thanks for your hint about looking at HTTPConduit. I set some break points there and found the suspect code. I'm not sure how to fix it though so I'll look to you for help on that :-) The cause for my grief is in HTTPConduit.prepare (lines 634 to 645 in 2.3.2's source). By default, csPolicy.isAllowChunking is true and this causes the HttpURLConnection.setChunkedStreamingMode to be set to -1. If it is set (as it currently is), havoc ensues. If setChunckedStreamingMode isn't set, getErrorStream works as it's supposed to. Now that we now what causes the issue, is there a way in WebClient to specify the HTTPClientPolicy for a request? I briefly looked at the methods and couldn't find any. By the way, WebClient behaves the same whether or not there is actual data in the post. was (Author: jadowney): Thanks for your hint about looking at HttpConduit. I set some break points there and found the suspect code. I'm not sure how to fix it though so I'll look to you for help on that :-) The cause for my grief is in HttpConduit.prepare (lines 634 to 645 in 2.3.2's source). By default, csPolicy.isAllowChunking is true and this causes the HttpURLConnection.setChunkedStreamingMode to be set to -1. If it is set (as it currently is), havoc ensues. If setChunckedStreamingMode isn't set, getErrorStream works as it's supposed to. Now that we now what causes the issue, is there a way in WebClient to specify the HTTPClientPolicy for a request? I briefly looked at the methods and couldn't find any. By the way, WebClient behaves the same whether or not there is actual data in the post. > 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, cxf_jax_rs_post_401_bug_httpurlconnection.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