com.mortbay.Servlets
Class PagePush

java.lang.Object
  |
  +--com.mortbay.Servlets.PagePush

public abstract class PagePush
extends java.lang.Object

Class to handle pushing of new pages upon changes within the parameters of a maximum and minimum time period.

The user can specify a minimum and/or maximum time for the makePage method to be called within. Both can be -1, meaning that this is not checked for. The user can call the markChange method to indicate that the Model being viewed has changed. If within the minimum time since the page was last sent, nothing happens until the minimum time has expired, whereupon the fillPage method is called. If no change happens and the maximum time is reached, the fillPage method is called regardless.

Version:
1.0 Thu Jul 16 1998
Author:
Matthew Watson (watsonm)

Field Summary
protected  boolean finished
          Is the multi-page push finished?
protected  boolean footer
           
protected  boolean header
           
protected  java.lang.String lookAndFeelName
           
protected  long maxTime
           
protected  long minTime
           
 
Constructor Summary
protected PagePush(long minTime, long maxTime, java.lang.String lookAndFeelName, boolean header, boolean footer)
          Constructor.
 
Method Summary
abstract  void fillPage(javax.servlet.http.HttpServletRequest req, Page page)
           
protected  void markChange()
          Notify the object that something has changed
 void serve(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Called by the user to initiate the pushing of pages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

minTime

protected long minTime

maxTime

protected long maxTime

lookAndFeelName

protected java.lang.String lookAndFeelName

header

protected boolean header

footer

protected boolean footer

finished

protected boolean finished
Is the multi-page push finished?
Constructor Detail

PagePush

protected PagePush(long minTime,
                   long maxTime,
                   java.lang.String lookAndFeelName,
                   boolean header,
                   boolean footer)
Constructor.
Parameters:
minTime - Minimum time between page refreshes
maxTime - Maximum time between page refreshes
lookAndFeelName - Type of Page to create
header - Should the Page header be printed?
footer - Should the Page footer be printed?
Method Detail

markChange

protected void markChange()
Notify the object that something has changed

serve

public void serve(javax.servlet.http.HttpServletRequest req,
                  javax.servlet.http.HttpServletResponse res)
           throws java.lang.Exception
Called by the user to initiate the pushing of pages. This calls fillPage immediately before going into a timing pattern.

fillPage

public abstract void fillPage(javax.servlet.http.HttpServletRequest req,
                              Page page)