Session.invalidate would mark the session as no longer valid and available via any servlet. This original question indicated that only 1 servlet should be affected, the other should operate normally.
-- Joakim Erdfelt <[email protected]> www.webtide.com Developer advice, services and support from the Jetty & CometD experts. On Wed, Aug 15, 2012 at 11:40 AM, Evan Ruff <[email protected]>wrote: > Joakim, > > Would session.invalidate() have the same effect? > > E > > > On Wed, Aug 8, 2012 at 4:02 PM, Joakim Erdfelt <[email protected]> wrote: > >> Off the top of my head, this is how I would personally tackle this. >> >> Create a RemoveCookieFilter (extends Filter) >> In the RemoveCookieFilter.doFilter() method i would wrap the incoming >> ServletRequest (if an instanceof HttpServletRequest) with a new class >> called FilteredCookieRequestWrapper (extends HttpServletRequestWrapper) >> which overrides the HttpServletRequestWrapper.getCookies(). >> In the FilteredCookieRequestWrapper.getCookies() call, i would iterate >> over the list of incoming cookies and remove the cookies I don't want >> (namely the session tracking cookies) and return a new array of Cookies >> that has only the ones that are not session tracking cookies. >> Then I would have the RemoveCookieFilter.doFilter() use the >> FilteredCookieRequestWrapper in its call to chain.doFilter() >> >> -- >> Joakim Erdfelt <[email protected]> >> www.webtide.com >> Developer advice, services and support >> from the Jetty & CometD experts. >> >> >> >> On Wed, Aug 8, 2012 at 10:51 AM, Evan Ruff < >> [email protected]> wrote: >> >>> I think the latter scenario, not returning the session cookie for the >>> "non-sticky" servlet is what I'm looking for. >>> >>> The one wrinkle I have is that I'm using Guice to bind the servlet (as >>> of now) but moving it to the web.xml would not be an issue. >>> >>> So in the filter, would I just set the session variable to Null or is >>> there a way to remove it all together? >>> >>> Thanks! >>> >>> E >>> >>> >>> On Wed, Aug 8, 2012 at 12:41 PM, Joakim Erdfelt <[email protected]>wrote: >>> >>>> Seems like you could just add a servlet filter over the "non-sticky" >>>> servlet to invalidate the session. >>>> However if you do that, then the session is invalid, for all servlets. >>>> Is that what you want? >>>> Or do you just don't want the session cookie to be returned from the >>>> "non-sticky" servlet? >>>> That too could be done easily enough with a servlet filter. >>>> >>>> -- >>>> Joakim Erdfelt <[email protected]> >>>> www.webtide.com >>>> Developer advice, services and support >>>> from the Jetty & CometD experts. >>>> >>>> >>>> >>>> On Wed, Aug 8, 2012 at 9:34 AM, Evan Ruff < >>>> [email protected]> wrote: >>>> >>>>> Hey guys, >>>>> >>>>> I've been working on a Jetty based project and I was hoping someone >>>>> could clarify what I'm working on. >>>>> >>>>> So the application itself is going to be behind a Layer7 Load >>>>> Balancer that will sick the sessions. I have two servlets, one that needs >>>>> to be sticky, and one that CANNOT be sticky. I was wondering if there was >>>>> a >>>>> way to configure this in the servlet code to handle the conditions? Can I >>>>> invalidate the session somehow on my non-sticky servlet? >>>>> >>>>> Thanks! >>>>> >>>>> E >>>>> >>>>> _______________________________________________ >>>>> jetty-users mailing list >>>>> [email protected] >>>>> https://dev.eclipse.org/mailman/listinfo/jetty-users >>>>> >>>>> >>>> >>>> _______________________________________________ >>>> jetty-users mailing list >>>> [email protected] >>>> https://dev.eclipse.org/mailman/listinfo/jetty-users >>>> >>>> >>> >>> _______________________________________________ >>> jetty-users mailing list >>> [email protected] >>> https://dev.eclipse.org/mailman/listinfo/jetty-users >>> >>> >> >> _______________________________________________ >> jetty-users mailing list >> [email protected] >> https://dev.eclipse.org/mailman/listinfo/jetty-users >> >> > > _______________________________________________ > jetty-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/jetty-users > >
_______________________________________________ jetty-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/jetty-users
