> -----Original Message-----
> From: Behalf Of Craig R. McClanahan

> What's wrong with calling doGet() / doPost() on every appropriate request?
> There are lots of ways to "short circuit" the normal processing that are
> entirely within the current standard, and quite understandable to boot.  The
> simplest example I can think of uses the "extra path" feature of the servlet
> API.
>
> Let's say you have your servlet mapped to the URL
> "http://www.mycompany.com/foo".  A trivially simple way to trigger reloading
> configuration information is by making a request to URL
> "http://www.mycompany.com/foo/reload" where you have code like this at the
> beginning of the doGet() method:
>
>     String pathInfo = request.getPathInfo();
>     if ((pathInfo != null) && pathInfo.equals("/reload")) {
>         ... reload the configuration file ...
>         ... construct an output page that says "reload done" ...
>         return;
>     }
>     ... do what the servlet normally does ...
>

What about thread-safety? Changing the servlet/application configuration may put
the config data into an illegal state; if the servlet is servicing other
threads, it may react incoherently.

(Same problem with defining another HTTP method or 'overriding' DELETE or PUT.)

It seems one would need a synchronized reference counter on the service method
pretty much what's described below (isShuttingDown() would be replaced by
isBeingReconfigured(); destroy() by reconfig()):

http://www.java.sun.com/docs/books/tutorial/servlets/lifecycle/service-threads.h
tml


Note: depending on the implementation, either wouldn't work for the
SingleThreadModel or you wouldn't need it, I believe.

-s

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to