Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 3673 invoked from network); 4 Nov 2010 18:55:08 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 4 Nov 2010 18:55:08 -0000 Received: (qmail 62329 invoked by uid 500); 4 Nov 2010 18:55:36 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 62295 invoked by uid 500); 4 Nov 2010 18:55:36 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 62262 invoked by uid 99); 4 Nov 2010 18:55:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Nov 2010 18:55:36 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ryan.justin.smith@gmail.com designates 74.125.82.179 as permitted sender) Received: from [74.125.82.179] (HELO mail-wy0-f179.google.com) (74.125.82.179) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Nov 2010 18:55:28 +0000 Received: by wyb33 with SMTP id 33so291538wyb.10 for ; Thu, 04 Nov 2010 11:55:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=pW8nYLfIMaSUKhWQyEoXCSx/M03dDOe5SDxyk39CM5k=; b=p+HRyS64N2f+IwQlGfj9vP92Y/izPTXelJGG5hofJUpjS5I4cjtbEm2WeYbEx97sar NapyrvTNu70eOauntWKbNfvw8YkP/604i4ijad/n96bXv8GGWGl/aU7dZPQ8Fp+cteh5 FiAuW+t4Z6efKv4rwdutA2DWNJGsP5dkD5F6M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=rkD/ah+UBq8+VOQESiCM1n++GBiwIgAE6mABYYwCb0QzUAmKd2/uPxbYym4/j14ZYG eB1WeCe9Hqeh41iPFsxbMQUf/eNXolDU9WhbHtLPzmqEzAlwqo/hlCD/qtFc0gIR2dLP Md3HpLE5/FdXOotvdFyfecWk2EsWYYo6z/yFM= MIME-Version: 1.0 Received: by 10.227.133.132 with SMTP id f4mr1124513wbt.60.1288896908083; Thu, 04 Nov 2010 11:55:08 -0700 (PDT) Received: by 10.227.141.77 with HTTP; Thu, 4 Nov 2010 11:55:08 -0700 (PDT) In-Reply-To: <30134949.post@talk.nabble.com> References: <30134484.post@talk.nabble.com> <30134949.post@talk.nabble.com> Date: Thu, 4 Nov 2010 14:55:08 -0400 Message-ID: Subject: Re: POST response with status 302 doesn't redirect From: Ryan Smith To: HttpClient User Discussion Content-Type: multipart/alternative; boundary=001485f724c05bc24f04943eb2f5 X-Virus-Checked: Checked by ClamAV on apache.org --001485f724c05bc24f04943eb2f5 Content-Type: text/plain; charset=ISO-8859-1 I am using 4.1-alpha2, in this version, you extend DefaultRedirectStrategy and override the method isRedirected(). Inside that method, check for a post method and a 302 or 301 and return true if so. I use something like this: boolean isRedirect = super.isRedirected(request, response, context); if (!isRedirect) { // Then check for POST and 302 or 301. Maybe post your code? On Thu, Nov 4, 2010 at 2:37 PM, motital74 wrote: > > Thank you Ryan > I looked after RedirectStrategy as part of 4.0.3 with no luck. > I have implemented the RedirectHandler and got the foolowing Exception: > Exception in thread "main" java.lang.IllegalArgumentException: Host name > may > not be null > > In the getLocationURI I return the URI from the response header (Location). > > Appreciate your help > > > Ryan Smith-10 wrote: > > > > Redirecting POSTs breaks RFC standards. You need to extend and implement > > your own RedirectHandler/RedirectStrategy and tell HttpClient to use it > > instead of the default one. > > > > hth. > > > > On Thu, Nov 4, 2010 at 1:45 PM, motital74 wrote: > > > >> > >> Hello > >> > >> I am using httpclient 4.0.3 GA. > >> I am trying to connect to a website using the http client which required > >> POST request (https). > >> The response HTTP status of the POST request is 302 (the location header > >> as > >> the URI). > >> for some reason that I don't understand the http client doesn't redirect > >> it. > >> The expected result is GET METHOD with the redirect URI. > >> Any Idea? > >> -- > >> View this message in context: > >> > http://old.nabble.com/POST-response-with-status-302-doesn%27t-redirect-tp30134484p30134484.html > >> Sent from the HttpClient-User mailing list archive at Nabble.com. > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org > >> For additional commands, e-mail: httpclient-users-help@hc.apache.org > >> > >> > > > > > > -- > View this message in context: > http://old.nabble.com/POST-response-with-status-302-doesn%27t-redirect-tp30134484p30134949.html > Sent from the HttpClient-User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org > For additional commands, e-mail: httpclient-users-help@hc.apache.org > > --001485f724c05bc24f04943eb2f5--