thanks for the good suggestion Chris - that is what exactly I am looking for.
I tried it and got part that involves reading the cookie from the Request and setting
a request object (easy part though). I seem to have problems implementing the
HttpServletResponseWrapper to collect the response
To: Tomcat Users List
Subject: Re: how to customize HTTPSession
Tim,
With the functionality you desire, stay away from the Session classes
as
defined in the servlet API.
I completely agree.
Instead, look into Filters and HttpServletRequestWrapper and
HttpServletResponse wrapper.
Ideally, you'd
Please remember that you can only add cookies to the response BEFORE
committing the response. That means, if you do write a (big) part of the
result and Tomcat starts sending it to the browser, you will not be able
to set any more cookies (or will not be sent to the browser anyway).
Yours,
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
You might look into implementing the
javax.servlet.hhtp.HttpSessionBindingListener interface, this will allow
you to act when an object is added/removed from the session. Simply put,
you could write valueBound/UnBound methods that set Cookies into the
HttpResponse.
-Mark
[EMAIL PROTECTED]
Thanks Mark - the problem with using HTTPSessionBindingListener is that the unbound
event is not triggered unless someone calls the session.removeAttribute() or
session.setAttribute(name, null). So there is no way for me to set the cookie from the
unbound() event without explicitly calling one
With the functionality you desire, stay away from the Session classes as
defined in the servlet API. Any developer will be greatly confused if they
try to read your code created by your description below since you are mixing
well known terminology and assumptions.
Instead, look into Filters
Tim,
With the functionality you desire, stay away from the Session classes as
defined in the servlet API.
I completely agree.
Instead, look into Filters and HttpServletRequestWrapper and
HttpServletResponse wrapper.
Ideally, you'd create some helper classes which do the gets and sets on
the