Hi Max. Thanks for your response. I am sure there are no sessions now. Its a REST based XML API. There are no views or jsp pages at all. It was designed from scratch to be stateless. I truly don't even like the idea of adding a session id either. But that is out of my control. The session id will simply end up in the access log files so we can group by and count unique sessions. The clients of the API do support cookies and will return the session id in subsequent requests.
So my question is what kind of overhead does getSession() have? If its anything more than just generating an uid and settings a response header, I will just do that myself. But I would rather not reinvent the wheel since the session api does exactly what I want. On Thu, Sep 23, 2010 at 3:59 PM, Maximilian Stocker <m...@talentoyster.com> wrote: > 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 > > -- Jeff Thorn Thorn Technologies, LLC (443) 255-2803 j...@thorntechnologies.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org