Viewlet Framework: Viewlet Lifecycle
A Viewlet goes through the following life cycle:
- For each incoming request, the ViewletFactory is consulted for applicable ViewletFactoryChoices.
- 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.
- The ViewletFactoryChoice is used as a factory to instantiate the Viewlet.
- The MeshObjectsToView object is instantiated with the context of the current request by the ViewletFramework.
- The method Viewlet.view( MeshObjectsToView ) is invoked by the ViewletFramework.
- 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
- 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.
- The method Viewlet.performAfter is invoked by the ViewletFramework.
- 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:
![[Logo]](/trac/chrome/site/projectlogo.png)