tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Darwin <>
Subject Re: custom HttpSession server.xml
Date Sat, 12 Aug 2006 13:21:49 GMT

>    I'm interested in customize the default HttpSession, but I don't know how
> can I custom it? I should like when form my servlet I execute
> req.getSession(), it returns me my customized HttpSession:
>                      HttpSession session = req.getSession(true);
>                      CustomHttpSession mySession =
> (CustomHttpSession)session;
> I want it because I need classes associated to session and I've thunk extend
> a httpSession and add properties to use later. Is it possible modifying the
> server.xml?

This is not a question that belongs on the dev list, and I'm not even 
sure it belongs on the users list. You seem to be unaware that the 
HttpSession is designed to work as a container, so you don't need to 
subclass it to add properties (e.g., as you put it to associate objects 
with the user's session). It has methods that work like a Map (or a 
Hashtable), allowing you to set any properties on it that you like. 
Please refer to the documentation for HttpSession, or read any of the 
good books out there about Servlet development.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message