users@glassfish.java.net

Re: How to Disable HttpSessions?

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Fri, 05 Jun 2009 14:44:22 -0700

On 04/30/09 01:16 PM, Jan Luehe wrote:
> On 04/30/09 09:32 AM, glassfish_at_javadesktop.org wrote:
>> Hello all,
>>
>> I need to make my web application completely stateless, and thus
>> would like to turn off http session generation by the app server (ie,
>> no memory consumed, no jsessionid generation, etc). These are
>> business requirements (not my fault!). In any event, the only thing
>> I've done is set the JSP tags to not participate in sessions - but I
>> don't see anything in the sun-web.xml that indicates if GlassFish can
>> be told to NOT create a session. Is this possible, and if so, where
>> is that configured (short of me writing a servlet filter that
>> programmatically calls session.invalidate() ) ?
>>
>
> There is no such config option available, as it would be in violation
> of the Servlet spec,
> which requires that a call to HttpServletRequest#getSession create a
> session if one does
> not already exist.

I was able to think of a simple and portable solution when this issue
was brought up again
during a meeting earlier this morning: How about declaring an
HttpSessionListener in your app,
and implementing its sessionCreated callback such that it throws an
IllegalStateException?

Jan


> http://forums.java.net/jive/thread.jspa?messageID=344520
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net