The Web Graph Database


Viewlet Framework: Viewlet Lifecycle

A Viewlet goes through the following life cycle:

  1. For each incoming request, the ViewletFactory is consulted for applicable ViewletFactoryChoices.
  2. If a specific Viewlet class is requested via the URL parameter lid-format=viewlet:CLASS, and the requested class is among the determined ViewletFactoryChoices, it is chosen. Otherwise, the ViewletFactoryChoices are ranked by match quality, and the highest-ranking choice is chosen by the ViewletFramework.
  3. The ViewletFactoryChoice is used as a factory to instantiate the Viewlet.
  4. The MeshObjectsToView object is instantiated with the context of the current request by the ViewletFramework.
  5. The method Viewlet.view( MeshObjectsToView ) is invoked by the ViewletFramework.
  6. Depending on whether the request is HTTP GET or POST, and whether a POST is considered safe or unsafe, one of the following three methods is invoked on the Viewlet:
    • JeeViewlet.performBeforeSafePost
    • JeeViewlet.performBeforeUnsafePost
    • JeeViewlet.performBeforeGet
  7. The method Viewlet.processRequest is invoked by the ViewletFramework. By default, this looks for a JSP file according to the described algorithms, and runs it. This may be overridden by the application developer.
  8. The method Viewlet.performAfter is invoked by the ViewletFramework.
  9. The Viewlet is garbage-collected.

Notice that the output of this invocation is buffered and included into a larger output file through Html templates.

See also:

Last modified 5 years ago Last modified on 07/21/09 18:22:53