commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <>
Subject [HttpClient][Request] Ability to debranch some logic
Date Fri, 26 Jul 2002 15:38:58 GMT

I am using HttpClient in Cactus to perform the HTTP connection to the
Cactus redirector servlet. I was using HttpURLConnection and decided to
use HttpClient because I thought it would be giving me more freedom in
choosing how I want it to behave ...

For example I'd like to be able to send back an error code in the
servlet and to be able to assert that status code on the client side, as
in :

    public void testStatusCode()
        // response is of type HttpServletResponse

    public void endStatusCode(WebResponse theResponse)
        throws IOException
         // theResponse.getConnection() is of type HttpURLConnection

However, it seems HttpClient has some built in logic WRT SC_UNAUTHORIZED
that cannot be switched off ? 

What I would have liked is the same kind of behaviour as is implemented
for redirects. There is a HttpMethod.setFollowRedirects(false) that
prevent HttpClient from following redirects. 

Would it be possible to have the same kind of flag for other reponse

Otherwise, it is not possible to test that a call to a given page
returns an unauthorized response code.

BTW, HttpClient loops indefinitely with the above code as is shown in
the attached text file.

Thanks a lot

View raw message