FileDocCategorySizeDatePackage
BookDBServlet.javaAPI DocExample2140Tue Dec 12 18:59:40 GMT 2000database

BookDBServlet

public class BookDBServlet extends GenericServlet
This is a simple example of a Generic Servlet. Other servlets call its public methods; it does not accept calls from clients.

Fields Summary
private BookstoreDB
books
Constructors Summary
Methods Summary
public voiddestroy()

        // Allow the database to be garbage collected
        books = null;
    
public BookDetailsgetBookDetails(java.lang.String bookId)

        return books.getBookDetails(bookId);
    
public BookDetails[]getBooksSortedByTitle()

        return books.getBooksSortedByTitle();
    
public intgetNumberOfBooks()

        return books.getNumberOfBooks();
    
public java.lang.StringgetServletInfo()

        return "The BookDB servlet manages the bookstore database.  " +
               "It is called by other servlets, not directly by a user.";
    
public voidinit(javax.servlet.ServletConfig config)

        // Store the ServletConfig object and log the initialization
        super.init(config);

        // Load the database to prepare for requests
        books = new BookstoreDB();
    
public voidservice(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)

            throw new UnavailableException(
                this,
                "This servlet does not accept client requests.");