commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.com>
Subject RE: [HttpClient][Request] Ability to debranch some logic
Date Thu, 01 Aug 2002 14:36:55 GMT
Hi dIon,

No I haven't. Where should I look at exactly ? Are you saying that you
are able to write Latka test for 401 HTTP responses ?

Thanks
-Vincent

> -----Original Message-----
> From: dion@multitask.com.au [mailto:dion@multitask.com.au]
> Sent: 31 July 2002 09:12
> To: Jakarta Commons Developers List
> Subject: Re: [HttpClient][Request] Ability to debranch some logic
> 
> 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>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message