struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joseph Barefoot" <jose...@hereuare.com>
Subject RE: Please help clarify or confirm -- HttpSession
Date Thu, 13 Jun 2002 21:23:17 GMT
Oops, forgot to clarify Jerry:

Any access to a java.util.Hashtable is synchronized, so using it as a static
repository for shared in-memory data should be safe and fast.  Also, the
class definition for any objects that are stored in this Hashtable should be
loaded from the same (shared) classloader as the class containing the
hashtable itself.  So the utility class plus shared object classes should be
contained in the same JAR and dropped in the shared library folder (or
whatever you have to do to get the container to load this classes as
shared).


peace,
Joe

> -----Original Message-----
> From: Joseph Barefoot [mailto:josephb@hereuare.com]
> Sent: Thursday, June 13, 2002 2:11 PM
> To: Struts Users Mailing List
> Subject: RE: Please help clarify or confirm -- HttpSession
>
>
> Thanks for confirming this Kevin.  Should work for sharing object
> instances
> just fine based on your test.
>
> Jerry:
>
> I would recommend using a java.util.Hashtable, and storing your
> authenticated user bean with a String containing the jsessionid.  This
> should be safe.
>
>
> peace,
> Joe
>
> > -----Original Message-----
> > From: Kevin.Bedell@sunlife.com [mailto:Kevin.Bedell@sunlife.com]
> > Sent: Thursday, June 13, 2002 1:28 PM
> > To: Struts Users Mailing List
> > Subject: RE: Please help clarify or confirm -- HttpSession
> >
> >
> >
> > Not sure about these - maybe someone else can grab the ball and
> > push ahead.
> >
> > One of the things I was wondering about were FormBean instances
> and other
> > complex objects such as DB Pool connections.
> >
> >
> >
> >
> >
> >
> >
> > "Jerry Jalenak" <Jerry.Jalenak@LABONE.com> on 06/13/2002 04:38:28 PM
> >
> > Please respond to "Struts Users Mailing List"
> >       <struts-user@jakarta.apache.org>
> >
> > To:   "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
> > cc:    (bcc: Kevin Bedell/Systems/USHO/SunLife)
> > Subject:  RE: Please help clarify or confirm -- HttpSession
> >
> >
> > Cool.  Building on this then, I should be able to define some sort of
> > Collection (HashMap? Vector?) that I should be able to store
> > instances of a
> > bean into (i.e. my authenticated user bean).  It looks like everything
> > needs
> > to be defined as static - no problem.  What about synchronization
> > problems?
> > Does the access need to be serialized in anyway?
> >
> > Jerry
> >
> > -----Original Message-----
> > From: Kevin.Bedell@sunlife.com [mailto:Kevin.Bedell@sunlife.com]
> > Sent: Thursday, June 13, 2002 3:04 PM
> > To: Struts Users Mailing List
> > Subject: RE: Please help clarify or confirm -- HttpSession
> >
> >
> >
> >
> > OK. I checked this out.
> >
> > I'm running Tomcat 4.03 on NT with JDK 1.3.1.
> >
> > I created a simple static class:
> > -------------------------
> > public class ClassLoaderTest {
> >
> >    public static int counter;
> >
> >    public static void addCounter() {
> >        counter++;
> >    }
> >
> >    public static String getCounter () {
> >        return Integer.toString(counter);
> >    }
> > }
> >
> >
> > I compiled it and put the .class file in %CATALINA_HOME%\classes
> >
> > -------------------------
> >
> > I then created a simple jsp named "test.jsp"
> >
> > <%@ page import="ClassLoaderTest" %>
> > <html>
> >   <head>
> >    <title>Testing Class Loaders</title>
> >   </head>
> >   <body>
> >    <% ClassLoaderTest.addCounter(); %>
> >    <% out.print("Counter = " + ClassLoaderTest.getCounter() );  %>
> >   </body>
> > </html>
> >
> > -------------------------
> >
> > I then created two webapps, "webapp1" and "webapp2".  They are
> completely
> > empty except for the test.jsp file and the following web.xml file:
> >
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> >
> > <!DOCTYPE web-app
> >   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
> >   "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
> >
> > <web-app>
> >
> >   <!-- The Usual Welcome File List -->
> >   <welcome-file-list>
> >    <welcome-file>index.jsp</welcome-file>
> >   </welcome-file-list>
> >
> > </web-app>
> >
> >
> >
> > Now - I then restarted Tomcat and opened two browsers. I pointed one to:
> >
> >     http://localhost:8080/webapp1/test.jsp
> >
> > and the other to:
> >
> >     http://localhost:8080/webapp2/test.jsp
> >
> >
> > Then when I hit refresh on them I can see THEY ARE HITTING THE
> > SAME OBJECT.
> > That is, this works. The counter increments each time I refresh either
> > browser.
> >
> > Thanks for the thoughts on this Joe -
> >
> > Kevin
> >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@jakarta.apache.org>
> >
> >
> > This transmission (and any information attached to it) may be
> confidential
> > and is intended solely for the use of the individual or entity
> to which it
> > is addressed. If you are not the intended recipient or the person
> > responsible for delivering the transmission to the intended
> recipient, be
> > advised that you have received this transmission in error and
> > that any use,
> > dissemination, forwarding, printing, or copying of this information is
> > strictly prohibited. If you have received this transmission in error,
> > please immediately notify LabOne at (800)388-4675.
> >
> >
> >
> > --
> > To unsubscribe, e-mail:   <
> > mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <
> > mailto:struts-user-help@jakarta.apache.org>
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>


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


Mime
View raw message