UnavailableException

Java Servlet Programming, 2nd Edition > A. Servlet API Quick Reference > UnavailableException

 
< BACKCONTINUE >
UnavailableException

Synopsis

Class Name: javax.servlet.UnavailableException

Superclass: javax.servlet.ServletException

Immediate Subclasses: None

Interfaces Implemented: None

Availability: Servlet API 1.0 and later

Description

A servlet can throw an UnavailableException at any time to indicate that it is not available to service client requests. There are two types of unavailability: permanent (where the problem will not correct itself and administrative action needs to be taken) and temporary (where the problem will likely correct itself after some length of time). To mark a servlet as temporarily unavailable, specify a duration (in seconds) when constructing the exception. Well-written servlet containers will use the duration to provide better error messages to the client. Servlet implementations are allowed to treat temporary unavailability as permanent unavailability.

Class Summary

public class UnavailableException extends ServletException {   // Constructors   public UnavailableException(int seconds, Servlet servlet, String msg);  // Deprecated   public UnavailableException(Servlet servlet, String msg);  // Deprecated   public UnavailableException(String msg);                   // New in 2.2   public UnavailableException(String msg, int seconds);      // New in 2.2   // Instance methods   public Servlet getServlet();                               // Deprecated   public int getUnavailableSeconds();   public boolean isPermanent(); }

Constructors

UnavailableException()

public UnavailableException(String msg) public UnavailableException(String msg, int seconds) public UnavailableException(Servlet servlet, String msg) public UnavailableException(int seconds, Servlet servlet, String msg)
Description

Constructs an UnavailableException with a given explanatory message. A period of unavailability may optionally be provided, given in seconds. The two constructors with signatures that accept a Servlet parameter were deprecated in Servlet API 2.2 in favor of the simpler and safer constructor versions that do not accept a servlet instance.

Instance Methods

getServlet()

public Servlet getServlet()
Description

Returns the servlet that threw this exception or null if the servlet instance was not provided to the constructor. This method was deprecated as of Servlet API 2.2 for safety reasons.

getUnavailableSeconds()

public int getUnavailableSeconds()
Description

Returns the number of seconds for which this servlet will be unavailable. A nonpositive number indicates permanent unavailability. No attempt is made to compensate for the time elapsed since the exception was thrown.

isPermanent()

public boolean isPermanent()
Description

Returns true if the servlet is unavailable indefinitely, false otherwise.


Last updated on 3/20/2003
Java Servlet Programming, 2nd Edition, © 2001 O'Reilly

< BACKCONTINUE >


Java servlet programming
Java Servlet Programming (Java Series)
ISBN: 0596000405
EAN: 2147483647
Year: 2000
Pages: 223

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net