You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ian Hunter <ih...@hunterweb.net> on 2003/05/08 20:00:27 UTC

How do i determine if a given session ID is currently a valid one?

I want to allow reporting access from a struts app to a server running an
ASP-based reporting application.  I'd like to pass the session ID as a
parameter to the ASP document, which would "call back" to the JSP container
to validate the session ID.

How do I validate a session Id?  I'd like a JSP that works something like
this:

<%
if (someObject.IsSessionIdAValidOne (request.getParameter("sessionId")) {
%>
YES
<%
} else {
%>
NO
<% } %>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: How do i determine if a given session ID is currently a valid one?

Posted by jo...@cyntact.com.
Ian,

I suppose you could setup an HttpSessionListener in your webapp that
stores the sessionid's for new sessions:

public class MySeshListener
Implements HttpSessionListener
{
  public void sessionCreated(HttpSessionEvent se)
  {
    Database.store(se.getSession().getId());
  }
  public void sessionDestroyed(HttpSessionEvent se)
  {
    Database.remove(se.getSession().getId());
  }
}

Then in your callback JSP/servlet/etc you could search the store for the
session. Of course, you don't have to save to a db. An accessible
Hashtable or something would do.

--
Josh

> -----Original Message-----
> From: Ian Hunter
> Sent: Thursday, May 08, 2003 2:00 PM
> To: Struts Users Mailing List
> Subject: How do i determine if a given session ID is 
> currently a valid one?


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org