How are you planning on logging/tracking this information anyway? My thinking would be to use a filter for all requests. And then you can do what you want with the information in the filter. And getSession() is to me clearer.
A couple of other things though. 1) Are you sure you don't have sessions now? I am not asking if you are using them but are you sure they don't exist? By default when you have JSPs involved at any point you'll have sessions. 2) I'd be mildly concerned with a "stateless" webservice trying to track usage via sessions because one way or another (cookies or URL) sessions *require* client co-operation to work and it's possible that you don't have that. I would check that assumption before continuing. -----Original Message----- From: Jeff Thorn [mailto:j...@thorntechnologies.com] Sent: Thursday, September 23, 2010 3:04 PM To: users@tomcat.apache.org Subject: Automatically Add Session ID Hello, I have a stateless webservice that I am running with Tomcat 6.0. The product owners want to start tracking user sessions to the webservice (how many request per session, etc.). Since its been stateless up to this point, I am not using the HttpSession object at all. Is there any way I can add a session id automatically just by changing the Tomcat configuration? If I can't do it via config, I assume I can do if via code simply by calling: httpRequest.getSession(true); with each request. All I really care about is the session ID so we can log and group requests. I am not going to store any objects in the session. What kind of overhead is there to doing this? I know it defeats the purpose of being stateless. But if I don't put anything in the session will it have a relatively low impact? Thanks! Jeff --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org