tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Rhoden <ja...@rhoden.id.au>
Subject Re: How to set global variable in Tomcat 5.5.17
Date Wed, 07 Mar 2007 03:12:17 GMT
Instead of attaching information to a session context you can attach 
information to an application context, whats more, instead of loading 
the config each time a session is created, you can create what is called 
a "Lifecycle listener" which will load the configuraiton file once, when 
the application is loaded into the web server! Look up lifecycle 
listener in google. I can send sample code if you need it.

Best Regards,
Jacob

Kathy Lo wrote:
> Hi,
>
> I setup Tomcat 5.5.17 in Linux Fedora Core 4 and develop a Web
> Application under /webapps directory.
>
> I have so many configuration files that need to be loaded into my web
> application. These configuration files are in a self-defined format
> and I wrote some Java classes to parse these configuration files and
> save the parsing result in a linked list (java.util.List or
> java.util.Map). These configuration files are static (not change).
>
> In my web application, when a user session created, I call these Java
> classes to parse these configuration files and save the linked lists
> into the session. So, every user sessions contain the same set of
> linked list and, as a result, it reads these files every time when
> session created (so many I/O access, if many session created as the
> same time, it will slow down the server).
>
> Now, I want to save these linked lists as a global variables in Tomcat
> so that each JSP and Servlet can access these global variables and
> reduce I/O access and memory usage.
>
> So, would you please tell me how to set global variables in Tomcat and
> initialize them using the Java classes that I wrote.
>
> Thanks
>


-- 
__________________________________________
Jacob Rhoden - http://www.jacobrhoden.com/


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message