Dave,

Unless you have some kind of Shutdown Restlet that can invoke your
stopServer() method, that won't help you. I think the current behavior is
just fine. If someone wants a more realistic/serious way to manage a Restlet
server, the usage of the Java Service Wrapper is highly recommended:
http://wrapper.tanukisoftware.org/doc/english/introduction.html

BTW, it is bundled with the Restlet distribution. There is even a sample
script for launching the Tutorial03 example in the "bin" directory.

Best regards,
Jerome  

> -----Message d'origine-----
> De : Dave Pawson [mailto:[EMAIL PROTECTED] 
> Envoyé : mercredi 20 décembre 2006 12:59
> À : [email protected]
> Objet : Re: Tutorial, cleanup
> 
> On 20/12/06, Jerome Louvel <[EMAIL PROTECTED]> wrote:
> >
> > Dave,
> >
> > This is the default behavior for all Java servers/daemons.
> Which is clear (though not stated).
> 
> 
> 
> >If you only want
> > to launch a server for a limited time, you can do something like:
> 
> <snip/>
> 
> Yes, that was my other thought, a simple timeout.
> I thought the thread use, timeouts etc might be offputting?
> 
>     Server srv=null;
> 
>     /**
>      *Respond to a GET
>      **/
>     public void respondToGet(){
>         // Creating a minimal Restlet returning "Hello World"
>                 // Creating a minimal Restlet returning "Hello World"
>         Restlet restlet = new Restlet() {
>             @Override
>             public void handle(Request request, Response response) {
>                 response.setEntity("Hello World!", 
> MediaType.TEXT_PLAIN);
> 
>             }
>         };
>         // Create the HTTP server and listen on port 8182
>         //Server srv = new Server(Protocol.HTTP, 8182, restlet);
>         srv = new Server(Protocol.HTTP, 8182, restlet);
>         try {
>             srv.start();
>         } catch (Exception ex) {
>             ex.printStackTrace();
>         }
>     }
> 
> public void stopServer(){
>         try {
>             srv.stop();
>         } catch (Exception ex) {
>             ex.printStackTrace();
>         }
> }
> 
> Runs just the same as the example,
> yet offers the opportunity to shut down using code?
> 
> regards
> 
> 
> -- 
> Dave Pawson
> XSLT XSL-FO FAQ.
> http://www.dpawson.co.uk

Reply via email to