users@jersey.java.net

[Jersey] Re: Caching config at startup time

From: Casper Bang <casper.bang_at_gmail.com>
Date: Wed, 9 Mar 2011 10:07:58 +0100

Hi Arthur,

You can implement a custom ServletContextListener and register it in your
web.xml. I use the ServletContextListener to place a DataSource in a
ServletContext, but I see no reason for why you couldn't use it to start
pre-fetching some data:

    <listener>

 <listener-class>com.brunata.webmon.ws.db.DBPoolingListener</listener-class>
    </listener>


/Casper

On Tue, Mar 8, 2011 at 10:35 PM, Arthur Yeo <artyyeo_at_gmail.com> wrote:

> All,
>
> Since RESTful services are event-driven (or request-driven), what's the
> best practices to cache a bunch of static data (mainly configs stuffs) from
> the Db when my GF webapp initially starts up? How do you kick off something
> with no external events driving it?
>
> --
> Arthur Y.
>