|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
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.
| 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)
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 elementElementSupport
void processElement()
throws EngineException
EngineException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||