Hello,

There are several possibilities for your initialization code depending 
on what you want to do.

You can use the constructor of your Restlet application implementation, 
but if you want to be tied to the Restlet application lifecycle, you 
should consider to override its start method (and eventually its stop 
method to clean things). The last possibility is to use the features 
provided by the servlet container (no link with Restlet) like webapp 
listeners. In these cases, you will be sure that processing will be 
called once.

Hope it will help you.
Thierry
> Hello, I'm developing an application with Restlet and GAE. Oks, I got this:
>
> http://codetidy.com/4125/
>
> public class MainRestletApplication extends Application {
>      
>      public MainRestletApplication()
>      {
>      //init code?
>      }
>
>
>      @Override
>      public Restlet createInboundRoot() {
>          Router router = new Router(getContext());
>   
>          router.attach("/v1/mainstatus",MainStatus.class);
>          router.attach("/v1/game/{id}/result",GameResult.class);
>   
>          return router;
>      }
> }
>
> and this:
> http://codetidy.com/4127/
>
>               <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.example.MainRestletApplication
>                       </param-value>
>               </init-param>
>       </servlet>
>
>       <!-- Catch all requests -->
>       <servlet-mapping>
>               <servlet-name>RestletServlet</servlet-name>
>               <url-pattern>/*</url-pattern>
>       </servlet-mapping>
>
> ------------------
> Well, where can I put a method to init the Web Service, ergo, some code to 
> init some data only when the app starts (one time), not when the first call 
> coming.
>
> Thanks

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3033218

Reply via email to