Packaging and Deployment
1. Scope
This section explains the structure of the standard WAR distributed with Orbeon Forms and how this WAR integrates with the application server (or Servlet container). This information is useful if you need to repackage Orbeon Forms. For instance, if you want to build an EAR file, or if you need to deploy more complex Orbeon Forms applications containing Servlets, Servlet Filters, Portlets, and Servlet context listeners.
2. WAR Structure
The following table lists the most important files contained in ops.war
:
Files | Description |
---|---|
WEB-INF/lib/orbeon.jar
|
JAR file with all the Orbeon Forms classes. |
WEB-INF/lib/orbeon-resources-public.jar
|
JAR file with all the Orbeon Forms files that can be served to a web client, such as CSS and JavaScript files. |
WEB-INF/lib/orbeon-resources-private.jar
|
JAR file with all the Orbeon Forms files that can not be served to a web client. |
WEB-INF/lib/*.jar
|
All the other JAR files in the WEB-INF/lib directory are used either by the Orbeon
Forms core engine, or one of the Presentation Server processors.
|
WEB-INF/web.xml
|
The standard descriptor for this WAR file. It configures the Orbeon Forms properties and resource manager, the Orbeon Forms main servlet and Ajax servlet, as well as other resources such as the embedded eXist XML database. |
WEB-INF/portlet.xml
|
The standard portlet descriptor for this WAR file is required if you use portlets. It typically
declares instances of OPSPortlet . For more information, see JSR-168 Portlets.
|
WEB-INF/resources/*
|
Contains Orbeon Forms resources. |
WEB-INF/resources/config/*
|
Contains Orbeon Forms resources which you can configure. In particular, this directory
contains properties.xml , the main Orbeon Forms configuration file.
|
WEB-INF/resources/apps/*
|
Contains Orbeon Forms example applications resources. Each sub-directory contains a separate Orbeon Forms example application. When building your own application xxx |
xforms-jsp/*
|
Contains examples using JavaServer Pages (JSP) to produce XForms. This directory can be removed if you do not want to run these examples. |
3. Orbeon Forms Initialization
The following figure illustrates the initialization of a simple Orbeon Forms deployment in a J2EE application server:
The initialization follows this lifecycle:
-
The application server reads the
WEB-INF/web.xml
file, which:- Declares a Servlet named
ops-main-servlet
implemented by the classorg.orbeon.oxf.servlet.OPSServlet
(loaded fromlib/orbeon.jar
) - Defines
ops-main-servlet
as the default Servlet (i.e. the Servlet handling all the requests).
<web-app><servlet><servlet-name>ops-main-servlet</servlet-name><servlet-class>org.orbeon.oxf.servlet.OPSServlet</servlet-class><!-- Initialization parameters here (see below) --></servlet><servlet-mapping><servlet-name>ops-main-servlet</servlet-name><url-pattern>/</url-pattern></servlet-mapping></web-app> - Declares a Servlet named
-
The
web.xml
file configures theOPSServlet
with a minimal set of parameters. Those parameters tellOPSServlet
:-
What resource manager has to be used, and how this resource manager is configured. In the default WAR bundled in the Orbeon Forms distribution, Orbeon Forms loads resources from the
WEB-INF/resources
directory inside the WAR. If it can't find a resource in this directory, it will try to look for it insideorbeon.jar
ororbeon-resources-private.jar
. Only static resources that are part of Orbeon Forms are stored inorbeon.jar
andorbeon-resources-private.jar
(as opposed to Orbeon Forms applications). The Resource Managers section explains in detail how resource managers work. -
The location of
properties.xml
, by defaultoxf:/config/properties.xml
. -
What main processor or context listener processors must be used. By default, the Page Flow Controller is used as the main processor.:
<!-- The main processor that OPSServlet must execute --><init-param><param-name>oxf.main-processor.name</param-name><param-value>{http://www.orbeon.com/oxf/processors}page-flow</param-value></init-param><!-- The Page Flow Controller configuration file --><init-param><param-name>oxf.main-processor.input.controller</param-name><param-value>oxf:/page-flow.xml</param-value></init-param>
-
-
More Orbeon Forms configuration is available in an XML file,
properties.xml
, stored with the resources. The exact name and path of this file is specified withinweb.xml
. For more information about the properties file, see Orbeon Forms Properties. -
The
oxf.main-processor.input.controller
property connects thecontroller
input of the Page Flow Controller to the configuration fileoxf:/page-flow.xml
. The Page Flow Controller reads this input before it starts to operate. - The Page Flow Controller now handles client requests and dispatches them to other pipelines. For more information about the role of the controller, see the Page Flow Controller reference.
4. Main Processor
4.1. Definition
In the same way that an old-fashioned program has a main function, Presentation Server has the concept of main processor. Within a web application, the main processor is the processor that is run each time a Servlet, Servlet filter or Portlet receives a client request. Within a command-line application, the main processor is simply the processor that runs when the application is run.
In the simplest web application deployment scenario, as shown in the example above, only one Orbeon Forms Servlet needs to be configured. In more complex scenarios, it is possible to deploy multiple Orbeon Forms Servlets, Servlet filters, and Portlets, as well as one Orbeon Forms Servlet context listener, within the same Web or Portlet Application. The following figure illustrates this:
Additional non-Orbeon Forms components can obviously be deployed within the same Web or Portlet Application.
4.2. Orbeon Forms Servlet, Orbeon Forms Servlet Filter, and Orbeon Forms Portlet
These components can each have their own main processor. The main processor for such components is looked up in in the initialization parameters of the component. For example, in the case of a Servlet:
5. Error Processor
5.1. Definition
In case an error is encountered during the execution or the main processor associated with a servlet, Orbeon Forms tries to execute an error processor. The error processor is typically a pipeline that produces a page showing the exception that was encountered. For more information, please refer to the Error Page documentation.
5.2. Configuring the Error Processor
You can configure an error processor in the same way the main processor is configured. The preferred
way of configuring the error processor is using the component's initialization parameters in web.xml
. For example, in the case
of a Servlet: