You can also include tapestry-autowire.jar into your application and
have Tap automatically inject it by doing (no annotations necessary):
public abstract HttpServletRequest getServletRequest();
Also, the port is available on the request. Try getServerPort().
On 1/17/07, Lukas Ruetz <[EMAIL PROTECTED]> wrote:
Hi!
in case you are working with java5+ you can inject the service
into your page by adding:
@InjectObject("service:tapestry.globals.HttpServletRequest")
public abstract HttpServletRequest getServletRequest();
you can retrieve the IP-address by:
String IP = getServletRequest().getRemoteAddr();
I don't know how to get the port. (And also this IP-address
may only be the one of a proxy/firewall.)
hth,
lukas
Am Mittwoch, 17. Januar 2007 16:48 schrieb Chris Davies:
> Hi,
>
> How is it possible to get the IP address and port of a visitor to a
> Page? I've been trying to figure this out for quite a while now (so I
> can insert useful information into log messages), but to no avail.
>
> The closest (crummy) solution I've found is to use a deprecated
> function to access the HttpServletRequest and then retrieve the remote
> address/port from there. Obviously this isn't a real solution at all
> though! What's the -correct- way to do this in Tapestry 4.0?
>
>
> Cheers,
>
> Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]