Orbeon Forms User Guide

Listeners

1. Servlet Context Listener

The Orbeon Forms Servlet Context Listener allows configuring one processor to be called when the Servlet context is initialized, and one to be called when the Servlet context is destroyed. These processors are looked up in the following locations, in this order:

  1. properties.xml:
    <properties><!-- Other properties -->...<!-- Servlet Context Listener properties --><property as="xs:QName" name="oxf.context-initialized-processor.name" value="oxf:pipeline"/><property as="xs:anyURI" name="oxf.context-initialized-processor.input.config" value="oxf:/context/context-initialized.xpl"/><property as="xs:QName" name="oxf.context-destroyed-processor.name" value="oxf:pipeline"/><property as="xs:anyURI" name="oxf.context-destroyed-processor.input.config" value="oxf:/context/context-destroyed.xpl"/></properties>
  2. Context parameters in web.xml:

    <context-param><param-name>oxf.context-initialized-processor.name</param-name><param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value></context-param><context-param><param-name>oxf.context-initialized-processor.input.config</param-name><param-value>oxf:/context/context-initialized.xpl</param-value></context-param><context-param><param-name>oxf.context-destroyed-processor.name</param-name><param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value></context-param><context-param><param-name>oxf.context-destroyed-processor.input.config</param-name><param-value>oxf:/context/context-destroyed.xpl</param-value></context-param>

Not every processor can be run from those pipelines, because the execution context is limited. In particular, you can't call processors like the Request generator or the HTTP serializer. You do however have access to the Application context.

For the Orbeon Forms Servlet Context Listener to be called, you need to configure the following listener in your web.xml:

<listener><listener-class>org.orbeon.oxf.webapp.OPSServletContextListener</listener-class></listener>
Note

There are no default processors. If no processor is specified, no processor is run on context initialization or destruction. This allows configuring a listener with only an initialization pipeline, only a destruction pipeline, both, or none.

The Servlet Context Listener logs its actions at level info. This can be controlled in log4j.xml:

<category name="org.orbeon.oxf.webapp.OPSServletContextListener"><priority value="info"/></category>

2. Session Listener

The Orbeon Forms Session Listener allows configuring one processor to be called when the Session is created, and one to be called when the Session is destroyed. These processors are looked up in the following locations, in this order:

  1. properties.xml:
    <properties><!-- Other properties -->...<!-- Session Listener properties --><property as="xs:QName" name="oxf.session-created-processor.name" value="oxf:pipeline"/><property as="xs:anyURI" name="oxf.session-created-processor.input.config" value="oxf:/context/session-created.xpl"/><property as="xs:QName" name="oxf.session-destroyed-processor.name" value="oxf:pipeline"/><property as="xs:anyURI" name="oxf.session-destroyed-processor.input.config" value="oxf:/context/session-destroyed.xpl"/></properties>
  2. Context parameters in web.xml:

    <context-param><param-name>oxf.session-created-processor.name</param-name><param-value>oxf:pipeline</param-value></context-param><context-param><param-name>oxf.session-created-processor.input.config</param-name><param-value>oxf:/context/session-created.xpl</param-value></context-param><context-param><param-name>oxf.session-destroyed-processor.name</param-name><param-value>oxf:pipeline</param-value></context-param><context-param><param-name>oxf.session-destroyed-processor.input.config</param-name><param-value>oxf:/context/session-destroyed.xpl</param-value></context-param>

Not every processor can be run from those pipelines, because the execution context is limited. In particular, you can't call processors like the Request generator, or any HTTP serializers. You have access to the Application and Session contexts.

For the Orbeon Forms Session Listener to be called, you need to configure the following listener in your web.xml:

<listener><listener-class>org.orbeon.oxf.webapp.OPSSessionListener</listener-class></listener>
Note

There are no default processors. If no processor is specified, no processor is run on session creation or destruction. This allows configuring a listener with only a creation pipeline, only a destruction pipeline, both, or none.

The Session Listener logs its actions at level info. This can be controlled in log4j.xml:

<category name="org.orbeon.oxf.webapp.OPSSessionListener"><priority value="info"/></category>