You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Adam Hardy <ah...@cyberspaceroad.com> on 2003/11/27 13:24:23 UTC
session invalidation and <%@ page session=false %>
I'm wondering what the servlet equivalent of <%@ page session=false %>
would be.
After all the discussion here about disabling URL rewriting, I have
knocked up a filter to overwrite the response so that encodeUrl() is
no-op'd (thanx Brice) for requests from callers like google that can't
handle or don't need a session.
In the same filter I can invalidate the session after the call to
chain.doFilter() so that the sessions created don't hang around.
However it seems an awkward solution, since the session is used
throughout the servlet - I thought I could use session.invalidate() just
to kill off the session right away and then do a test on the session
wherever I need it to see if it is valid or present.
The only test I can do to identify an invalidated session is to try
catch on an IllegalStateException on any session method call, but that's
goes against my philosophy.
If I overwrite the request as well and override the getSession() to
return null, is that going to present any unforeseen issues on these
requests that need no session? Or is there a better way of mimicking <%@
page session=false %> ?
Adam
--
struts 1.1 + tomcat 5.0.14 + java 1.4.2
Linux 2.4.20 RH9
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: session invalidation and <%@ page session=false %>
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Yes, but there it is just used in a call to JspFactory.getPageContext()
where the J2EE documentation says the needsSession parameter should be
true if the JSP participates in a session.
I wonder whether the session is always created by default or whether it
sometimes honestly doesn't get created if there's no call to
request.getSession(true).
Adam
On 11/27/2003 02:48 PM Ben Souther wrote:
> Remember, all JSPs get converted to servlets before being compiled.
> If you want to see how to mimick JSP functionality in a servlet, look at the
> generated servlet code in your TOMCAT_HOME/work directory.
>
>
>
>
> On Thursday 27 November 2003 07:24 am, you wrote:
>
>>I'm wondering what the servlet equivalent of <%@ page session=false %>
>>would be.
>>
>>After all the discussion here about disabling URL rewriting, I have
>>knocked up a filter to overwrite the response so that encodeUrl() is
>>no-op'd (thanx Brice) for requests from callers like google that can't
>>handle or don't need a session.
>>
>>In the same filter I can invalidate the session after the call to
>>chain.doFilter() so that the sessions created don't hang around.
>>
>>However it seems an awkward solution, since the session is used
>>throughout the servlet - I thought I could use session.invalidate() just
>>to kill off the session right away and then do a test on the session
>>wherever I need it to see if it is valid or present.
>>
>>The only test I can do to identify an invalidated session is to try
>>catch on an IllegalStateException on any session method call, but that's
>>goes against my philosophy.
>>
>>If I overwrite the request as well and override the getSession() to
>>return null, is that going to present any unforeseen issues on these
>>requests that need no session? Or is there a better way of mimicking <%@
>>page session=false %> ?
>>
>>
>>Adam
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
--
struts 1.1 + tomcat 5.0.14 + java 1.4.2
Linux 2.4.20 RH9
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: session invalidation and <%@ page session=false %>
Posted by Ben Souther <bp...@adelphia.net>.
Remember, all JSPs get converted to servlets before being compiled.
If you want to see how to mimick JSP functionality in a servlet, look at the
generated servlet code in your TOMCAT_HOME/work directory.
On Thursday 27 November 2003 07:24 am, you wrote:
> I'm wondering what the servlet equivalent of <%@ page session=false %>
> would be.
>
> After all the discussion here about disabling URL rewriting, I have
> knocked up a filter to overwrite the response so that encodeUrl() is
> no-op'd (thanx Brice) for requests from callers like google that can't
> handle or don't need a session.
>
> In the same filter I can invalidate the session after the call to
> chain.doFilter() so that the sessions created don't hang around.
>
> However it seems an awkward solution, since the session is used
> throughout the servlet - I thought I could use session.invalidate() just
> to kill off the session right away and then do a test on the session
> wherever I need it to see if it is valid or present.
>
> The only test I can do to identify an invalidated session is to try
> catch on an IllegalStateException on any session method call, but that's
> goes against my philosophy.
>
> If I overwrite the request as well and override the getSession() to
> return null, is that going to present any unforeseen issues on these
> requests that need no session? Or is there a better way of mimicking <%@
> page session=false %> ?
>
>
> Adam
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org