Interface ElementAware

All Known Implementing Classes:
AbstractLogout, AbstractLogoutPassthrough, AbstractLogoutTemplate, Authenticated, DatabaseAuthenticated, DatabaseLogoutPassthrough, DatabaseLogoutTemplate, Defer, DwrService, Element, ElementScripted, FactoryPropertyAuthenticated, FeedProvider, Identified, MemoryAuthenticated, MemoryLogoutPassthrough, MemoryLogoutTemplate, MixedAuthenticated, PrintTemplate, PurgingDatabaseAuthenticated, PurgingMemoryAuthenticated, PurgingMixedAuthenticated, Redirect, RoleUserAuthenticated, ServeContent, SimpleLogoutPassthrough, SimpleLogoutTemplate, SoapXFire, Uncached, WebservicesHessian

public interface ElementAware

This interface contains all the methods that a class must implement to become an element for the web engine.

For convenience, you can also extend the abstract Element class which gives you the benefit of having local access to all its methods and having no abstract methods to implement.

Elements are the smallest logical building blocks of a RIFE web application. They are declared in the site structure and when a request arrives that maps to an element declaration, a new instance of the implementation is created. Element instances are thus never shared amongst requests, unless you are into a continuation tree that is set up to not clone its variable stack. This makes the logic inside elements fully thread-safe.

The processElement() method is the default entry point and will be called when a request arrives.

You're free to add any other method to this class. RIFE provides a convention syntax for methods that are supposed to handle submissions. The name of the submission is capitalized and the "do" literal is prepended. RIFE then looks for a method with that name, the public void modifiers and no arguments. When such a method is found, it is executed instead of processElement(). Nothing prevents you however from handling submissions conditionally in the processElement() method though, without isolating the logic in a separate method. For example, when a submission arrives with the name "storeUser", RIFE will look for the method:

public void doStoreUser()
If it's present, it will be called instead of processElement().

Often you want to initialize common data structures, both for regular requests as for submissions. The ElementSupport.initialize() method can be used for that. It will be the first element's method that is called in a fully setup element context. When extending Element, the easiest is to simply overload the ElementSupport.initialize() method, otherwise an ElementInitializer has to be registered in the noticeElement(com.uwyn.rife.engine.ElementSupport) method.

RIFE also supports setter-based dependency injection for element properties, inputs, global variables and submission parameters. If setter methods are present that correspond to declared variable names, they will be automatically invoked with the available values. Of course, you can always retrieve values through the dedicated ElementSupport methods for properties, inputs and submission parameters.

$Revision: 3634 $
Geert Bevin (gbevin[remove] at uwyn dot com)

Method Summary
 void noticeElement(ElementSupport elementSupport)
          This method is called immediately after the instantiation of the element to provide the support object that allows the element to function in the current context.
 void processElement()
          The default entry point that will be called when a request arrives.

Method Detail


void noticeElement(ElementSupport elementSupport)
This method is called immediately after the instantiation of the element to provide the support object that allows the element to function in the current context. Note that the context is not setup yet, the bridge object is merely provided at this stage.

It's good practice to store the elementSupport parameter in a member variable of the element, making it possible to use it from any method in the element.

This method should also be used to provide the elementSupport instance with an ElementDeployer, an ElementInitializer and an ElementChildTrigger, if they are needed.

elementSupport - the ElementSupport instance for this request and this element
See Also:


void processElement()
                    throws EngineException
The default entry point that will be called when a request arrives.


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.