On 08/09/2009, Rutuja Joshi <[email protected]> wrote: > Hello, > > I am working on the application which fetches HTTP contents given the URL. > If there is any redirection from the original URL, I need to find out what's > the destination URL from which the contents are going to be fetched > eventually. Then depending on the predefined criterion I would like to > determine if the contents should be fetched from the final destination or > not. > > For example, when I use HttpClient to fetch contents from URL: > http://www.opensolaris.org/jive/login!withRedirect.jspa > > The request gets automatically redirected to > https://auth.opensolaris.org/login.action?targetUrl=http://www.opensolaris.org/jive/message.jspa?messageID=219909 > and HttpClient returns the html contents from https://auth.opensolaris.... > > Based on the return code value from method.execute() call I have no way to > know that this happened. The return code is 200 (HttpStatus.SC_OK). > > I have two questions as follows: > 1> Is there any way to know that this redirect happened ? > 2> Can I control redirects completely? Meaning, is there any way to tell > HttpClient to not to fetch content from the new URL but just let the calling > method know what this new URL is? > > Please note setting method.followRedirects() to true or false did not alter > the behavior. Irrespective of setting this flag to false, the HTML contents > were fetched from https://auth.opensolaris....
Which version of HttpClient are you using? > Thanks in advance! > Rutuja > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [email protected] > For additional commands, e-mail: > [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
