commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "otisg" <>
Subject [httpclient]: Q about HttpMultiClient and redirects
Date Mon, 06 May 2002 22:54:21 GMT

Is there a way to 'catch' redirected URLs when using HttpMultiClient?
It seems like this block of code, which is a part of executeMethod
method, always gets executed if the status code matches.
Wouldn't it be useful to have a setFollowRedirects(boolean) method in
HttpMultiClient, as well as a matching getFollowRedirects() method? If I
were to use HttpMultiClient, and I'd like to, I would need this, since I
need to differentiate between URLs that return a 200 OK, and one of the
resource moved codes.

if (status == 301 || status == 302 || 
status == 303 || status == 307)
Header header = method.getResponseHeader("Location");
String url = header.getValue();
if (url == null)
log.error("HttpMultiClient.executeMethod: Received redirect without
Location header.");
throw new HttpException("Received redirect without Location header.");

return executeMethod(method);

I can provide patch....just let me know, since I can't commit to

Sign up for FREE iVillage newsletters <> .
>From health and pregnancy to shopping and relationships, iVillage
has the scoop on what matters most to you. 

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message