commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@multitask.com.au
Subject Re: [HttpClient][Request] Ability to debranch some logic
Date Wed, 31 Jul 2002 08:11:53 GMT
Vincent,

have you seen the jelly http tags I have in latka?
--
dIon Gillard, Multitask Consulting
Work:      http://www.multitask.com.au
Developers: http://adslgateway.multitask.com.au/developers


"Vincent Massol" <vmassol@octo.com> wrote on 07/27/2002 01:38:58 AM:

> Hi,
> 
> 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
>         response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
>     }
> 
>     public void endStatusCode(WebResponse theResponse)
>         throws IOException
>     {
>          // theResponse.getConnection() is of type HttpURLConnection
>         assertEquals(HttpServletResponse.SC_UNAUTHORIZED,
>             theResponse.getConnection().getResponseCode());
>     }
> 
> 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
> code like SC_UNAUTHORIZED ?
> 
> 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
> -Vincent
> [attachment "cactuslog.txt" removed by dIon Gillard/Multitask 
> Consulting/AU] --
> To unsubscribe, e-mail: 
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
<mailto:commons-dev-help@jakarta.apache.org>
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message