tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Braae" <andrewbr...@gmail.com>
Subject Re: Running code on Tomcat startup
Date Thu, 22 Jun 2006 21:18:29 GMT
I've handled this by using a servlet filter that intercepts all requests
(something like this in your web.xml file)...

<filter-mapping>
      <filter-name>Do Startup Filter</filter-name>
      <url-pattern>/*</url-pattern>
</filter-mapping>

Then inside the do.. method you can set up your object and attach to either
a context such as your session or to the ServletContext (if you want it
globally available).

However, I don't know know if this is the best way - one problem is that the
startup cost is suffered by the first user to hit the site, whereas it would
be better if the startup was performed when tomcat itself starts up. This is
not such an issue I guess for a site that is hammered the second it comes
up.



On 6/23/06, 0 8 <0112358@gmail.com> wrote:
>
> Hello,
>
> I have a newbie Tomcat question.
>
> A search application I need to work with uses RMI.  When I start
> Tomcat, is there a way I can run the code to create an object that I
> can reference in a JSP later?
>
> What I need to run is straight forward:
>
> ClientServices cs =
> com.mycompany.searchapp.ClientServicesFactory.getInstance("RMI",
> parms); // Get the ClientServices
> cs.Login(strDomain, strUser, strPassword); // Login
>
> Can I run this and reference the object cs from my JSP?
>
> If someone could point me in a general direction it would be
> appreciated.  If there's a better way to handle this, I'm open to
> suggestions.
>
> Thanks,
> Matt
>
> ---------------------------------------------------------------------
> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message