Hi,

Normally this is done use an initialization servlet.
You need a separate class inheriting javax.servlet.http.HttpServlet
and a entry in your web.xml file to get it executed once at application
startup.

Look at load-on-startup here:
http://www.caucho.com/resin-3.0/servlet/servlet.xtp#load-on-startup

I'm two inches from implementing this in our medical record viewer
which uses Compojure and Ring, I have the same issue.
I will no have it done before next Tuesday however, I have some higher priority
stuff to deliver first.

Hope it helps you

Mike Meyer <mwm-keyword-googlegroups.620...@mired.org> wrote ..
> My simple web app
> (http://blog.mired.org/2010/11/x10-controller-in-clojure.html) has
> some stuff that needs to happen just once (in this case, opening the
> serial port). It's not clear how to get this to happen using ring. If
> I do it inside my ring handler, then it gets run on every request, and
> I have to check to make sure it's not run multiple times. If I run it
> outside the handler, then it gets run when I do "lein uberwar", which
> is simply wrong.
> 
> When the deployment platform activates the war would seem to be the
> right time to run this ("war load time"?). So maybe this is a question
> that depends on the deployment platform, or war? However, a quick
> google search didn't turn up anything that looked interesting.
> 
> Anyone got suggestions on how to set up code to be run when Jetty (or
> tomcat, or ...)?
> 
>       thanks,
>       <mike
> -- 
> Mike Meyer <m...@mired.org>           http://www.mired.org/consulting.html
> Independent Network/Unix/Perforce consultant, email for more information.
> 
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first
> post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
Luc P.

================
The rabid Muppet

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to