in data 18/05/2005 11.25 Hendrik Neumann ha scritto:
By the way: is it possivle to get the ip-address associated with a session? I have not found a method like getIPAdress() and the method myHttpSessionEvent.getSource() does also not contain the ip address. Is there another solution to get it, because I want to write something like "Session created for 127.0.0.1" in my logfile. Is it possible?
You can get it from the request: put a filter in the request chain and
in the doFilter method see if the session is a new session:
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if(((HttpServletRequest)request).getSession().isNew()) {
//Do your stuff here with request.getLocalAddr()
}
chain..doFilter(request, response);
}
bye
--
Pierpaolo Follia
Wave S.r.l. - Vai Benaco 24/B, Bedizzole (BS)
Telefono: +39 030 687561
Fax: +39 030 6875690