ServerServlet load Application eagerly?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ServerServlet load Application eagerly?

pmorris
I'm passing in an org.restlet.application param to the ServerServlet and the application doesn't load until the first request actually comes in. That is what I would expect of course and the source code shows that lazy initialization is what the authors were trying to achieve. But for my purpose I need the Application to load eagerly (when the ServerServlet loads) since my Application and ServerResource objects are not only taking requests but are also part of a scheduling framework. I suppose what I am asking for are suggestions for the simplest way to load the Application object into the ServerServlet eagerly. I am willing to extend ServerServlet if I have to. Any suggestions?

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3061509
Reply | Threaded
Open this post in threaded view
|

Re: ServerServlet load Application eagerly?

wbasheer
This post has NOT been accepted by the mailing list yet.
Any updates to this question?  I too am wanting my Application class to initialize when my container(Tomcat) is started.

I've tried the following with no luck:

   <servlet> 
      <servlet-name>RestletServlet</servlet-name> 
      <servlet-class> 
         org.restlet.ext.servlet.ServerServlet  
      </servlet-class>
     
      <init-param>
        <param-name>org.restlet.application</param-name> 
      <param-value>com.MYCOMPANY.restlet.RestletApplication</param-value>
      </init-param>
   
      <load-on-startup>1</load-on-startup>
       
   </servlet>

I have read suggestion of subclassing ServerServlet but would rather not have to do that.

Any other suggestions?