CS6320:  SW Engineering of Web Based Systems

 

   Exercise 3:  Servlet that uses HTTP Response Headers
NOT COLLECTED
  • Implement the Servlet discussed in section 7.3 of your "Core Servlets Book". See below for code taken from book's website.
  • This example shows the use of the HTTP Response header Refresh.
  • It also, illustrates how to synchronize access to data that multiple instances of a Servlet may be trying to alter.
  • Finally, it illustrates how to use multi-threaded programming to perform calculations using a Lower Priority thread (see setPriority(Thread.MIN_PRIORITY) method call).

Be able to discuss the code and how it works in class.

CODE from Book

PrimeNumbers.java A servlet that generates a list of large prime numbers. It sends an initial list to browser and instructs browser to reconnect periodically for updated results until list is complete. Uses the following auxiliary classes:

PrimeList.java Creates a Vector of large prime numbers, usually in a low-priority background thread. Provides a few small thread-safe access methods.

Primes.java Generates random BigIntegers and finds first prime ones above a given starting point.

ServletUtilities.java Provides a few simple HTML-generation utilities.

PrimeNumbers.html Front end to PrimeNumbers servlet

     
     
     
     
     
     
© Lynne Grewe