Instead, look into Filters and HttpServletRequestWrapper and HttpServletResponse wrapper.
Ideally, you'd create some helper classes which do the gets and sets on the servletrequests and responses. How they get instantiated is up to you.
-Tim
[EMAIL PROTECTED] wrote:
Hi,
I am new to the java webapp development. I want to store some user data for my app in a client side cookie rather than as a server side object and referencing it with a sessionId. One of the main reasons for that is - we will be running multiple servers load balancing. Since the HTTPSessions are java container instance specific - I don't want to use them. I have read about distributed Session support - but it does involve complicated setup and seems to be a overkill when compared to the data that I want to store.
Anyway - in that aspect - I have these 2 questions :
1. Is there a way to override the HTTPSession and HTTPResponse provided by tomcat to save the contents of the Session as a cookie instead of just storing the sessionId ?
2. If I implement my own Session class, and store it as a attribute in the HTTPRequest object, how can I write the contents of the session as a cookie right before I return the response ? The way I used to do it in other apps in C++ is to write a destructor for my session object, which will get called when the request is being terminated and I could write the cookie in the response. But the java equivalent to destructor "finalize()" is not gauranteed to be called until the GC wakes up. So how can I make sure I set the cookie after the request is completely processed?
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
