Dashboard > RIFE > ... > Web engine > Element implementations through interfaces
RIFE Log In | Sign Up   View a printable version of the current page.
Element implementations through interfaces


Added by Geert Bevin, last edited by Geert Bevin on Jul 26, 2004  (view change)
Labels: 
(None)

It's possible to create elements by implementing the ElementAware interface. You have to implement one additional method public void noticeElement(ElementSupport element) which should be used to store the actual element instance that you receive from the engine in a member variable. You can then use this member variable to perform your logic in the processElement() method.

For example:

public class SimpleInterface implements ElementAware
{
    private ElementSupport    mElement = null;
    
    public void noticeElement(ElementSupport element)
    {
        mElement = element;
    }
    
    public void processElement()
    {
        mElement.print("Just some text "+
            mElement.getRemoteAddr()+":"+
            mElement.getRemoteHost()+":"+
            mElement.getPathInfo());
    }
}



Are you enjoying Confluence? Please consider purchasing it today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.1a Build:#515 May 19, 2006) - Bug/feature request - Contact Administrators