[plt-scheme] dynamically reload servlet on file change?

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Mar 27 17:53:12 EDT 2007

On Mar 27, Jay McCarthy wrote:
> This is not done in the server. (However, you can goto
> /conf/refresh-servlets.)
> This is not done for a design reason: Suppose some servlet has
> persistent data, for example a database or a log. If the servlet is
> reloaded, then the persistent data is reloaded as well.

I second the comment Jens sent -- when debugging, having an
auto-reload is extremely useful.  A way to mark a servlet as
auto-reloadable would be much more useful than refreshing a
/conf/refresh-servlets in a side window (which is only possible if
your server is not doing anything else important).

> It is possible, however, that this behavior would be reasonable for
> some servlets. Given that, it would relatively easy to write a
> generic `file watcher' and give it a thunk to execute on
> changes. Such a thunk could make a GET request on the
> refresh-servles URL, which could be modified to be more granular.

And a comment on this -- this kind of servlet->web-server
communication through a self GET requests is a bad idea.  We had at
least one occasion where this failed, because of
firewall+port-redirection issues.  It would be better to communicate
with the server as usual, using function calls.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.