jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.com>
Subject RE: Set the client IP address in a Cactus WebRequest
Date Wed, 22 May 2002 19:51:10 GMT
Marc,

I've had a more serious look at the spec. Actually the IP address and
host name do not come from the HTTP request but they're probably
retrieved from the socket connection itself with the remote host.

Thus Cactus 1.3 does not have the ability to simulate them. However,
thanks to your prompt I have now implemented 2 methods
setRemoteIPAddress() and setRemoteHostName() that you use in the
following manner :

    public void testRemoteClientCheck()
    {
        request.setRemoteIPAddress("192.168.0.1");
        request.setRemoteHostName("atlantis");

        assertEquals("192.168.0.1", request.getRemoteAddr());
        assertEquals("atlantis", request.getRemoteHost());
    }

I have committed this in Cactus CVS head (i.e. Cactus 1.4dev). You can
get a distribution of Cactus 1.4 through the nightly build area. You
should wait until tomorrow to get it built by GUMP.

However, it seems the Cactus nightly build has been failing for the past
week for Cactus for J2EE 1.3 because Tomcat 4.x fails to build and
that's because there is a problem in XDoclet which it uses ... :-).

Thus, tell me if you have problems getting it and I'll manually post a
build tomorrow for you.

Thanks
-Vincent

> -----Original Message-----
> From: Brette, Marc [mailto:Marc.Brette@mkms.xerox.com]
> Sent: 06 May 2002 08:22
> To: 'Cactus Users List'
> Subject: RE: Set the client IP address in a Cactus WebRequest
> 
> Is it a HTTP information ? good question, it could also be taken
directly
> from the socket layer.
> Anyway, on the server side, I use :
> String userIP =	pageContext.getRequest().getRemoteAddr() ;
> so it is ServletRequest that gives this information.
> 
> -----Original Message-----
> From: Vincent Massol [mailto:vmassol@octo.com]
> Sent: 03 May 2002 21:48
> To: 'Cactus Users List'
> Subject: RE: Set the client IP address in a Cactus WebRequest
> 
> 
> Hi Marc,
> 
> Hum ... The answer is probably yes. This information is passed in an
> HTTP header right ? Then you should be able to use the
> WebRequest.addHeader() (However that would only add a new header, not
> replace an existing one).
> 
> How do you get the IP value on the server side (what API do you use
?).
> 
> Thanks
> -Vincent
> 
> > -----Original Message-----
> > From: Brette, Marc [mailto:Marc.Brette@mkms.xerox.com]
> > Sent: 03 May 2002 14:03
> > To: 'cactus-user@jakarta.apache.org'
> > Subject: Set the client IP address in a Cactus WebRequest
> >
> > Hi,
> > Is it possible to fake the IP address of a client in a Cactus
> WebRequest ?
> > I have a servlet that check that the user IP address matches an
> expected
> > value and I would like to test it using Cactus.
> >
> > Thanks,
> > Marc
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:cactus-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:cactus-user-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>



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


Mime
View raw message