tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Angus Mezick" <>
Subject RE: How to get the container within an instance event?
Date Thu, 03 Jul 2003 12:59:31 GMT
Cool! That is exactly what I needed!  I was getting miffed because
valves got the nice catalina request object while InstanceEvent had to
deal with the dumbed down HttpRequest.  Now onto a design question:

I am implementing a JdbcSessionManager for dealing with non-sticky
clusters.  We wish to use the DB to store all of our session data when
it is not in use.  Thanks to Craig's help I was able to figure out how
to do the updating of the session data in an InstanceEventListener that
catches the AFTER_SERVICE_EVENT.  In talking to Filip Hank about his
Clustered session manager I was also able to do the database updates in
a valve.  Which way is preferable?  In the InstanceEvent I can just
filter out all queries that make this true:
.  Filip used the file extensions to create an exclusion list.

Other notes:
I have had to create my own JdbcSession object instead of subclassing
StandardSession because the attributes HashMap is private and I need
access to it.  (I think)  I am serializing the HashMap and storing only
that in its own column.  My other columns are expire_time,
creation_time, app_name, and session_id.  I am currently limited to
sessions with 8k of data because of the DB limits on VARBINARY but that
can change at a later date.


> -----Original Message-----
> From: Craig R. McClanahan [] 
> Sent: Wednesday, July 02, 2003 11:50 PM
> On Wed, 2 Jul 2003, Angus Mezick wrote:
> > Date: Wed, 2 Jul 2003 15:08:33 -0400
> > From: Angus Mezick <>
> > Does anyone know how to access the container object from an instance
> > event?  Are there any specs that say an instance event can have no
> > internal access to the server?
> >
> I presume you're talking about 
> org.apache.catalina.InstanceEvent, right?
> If so, the "wrapper" property that is accessible via 
> getWrapper() is the
> org.apache.catalina.Container instance for this particular 
> servlet.  If
> you want the Context element for the webapp, for example, you'd say
> something like:
>   Context context = (Context) event.getWrapper().getParent();
> or, to get the Host for this virtual host:
>   Host host = (Host) event.getWrapper().getParent().getParent();
> and so on.
> > Sorry for the cross post but I am deep into the internals 
> of tomcat here
> > and I don't know which list is appropriate.  The list with "how do I
> > change the default port" type q's or the one that debates 
> how features
> > should be implemented.
> >
> The TOMCAT-USER list probably won't have many folks that 
> understand the
> internals well enough to answer a question like this :-).
> > Angus Mezick
> > GuideStar - Philanthropic Research Inc.
> Craig McClanahan

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message