guillaume ORIOL wrote:

> When a servlet starts, the loader first invokes its init() method in order
> for the
> servlet to initialize. And the signature of this method is:
> public void init(ServletConfig config) throws ServletException.
> As the method doesn't return any object, is there any mean to tell the
> loader
> that the servlet could not be correctly initialized? In my case, the init()
> method
> first attempts to open a properties file. If the file cannot be found, the
> servlet will not function properly and thus i would like the web server to
> return an error and not to try to invoke any service() or doGet() method.
>

If you throw an UnavailableException (which is a subclass of
ServletException), you are telling the servlet engine that you did not
initialize successfully and that this instance should not be used to handle
requests.  You can also indicate whether this unavailability is "permanent",
or that the servlet engine might want to try initializing this servlet again
after a certain amount of time.

Craig McClanahan

___________________________________________________________________________
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