Monday, May 19, 2008

Separate Deployment of Orbeon

Orbeon Forms has the slickest implementation of XForms for now. However, integrating it with other apps is a bit rough around the edges. The first hurdle was figuring out how to capture submissions and load data (discussed in previous posts here). However we were still quite limited by the static pages served by Orbeon, so we had to find a way to have Orbeon process JSP output. There are actually two methods to achieve this; one merges the Orbeon application into an existing one, but this would be messy and hard to upgrade. The other uses filters to process the output of one application.

After almost a solid day of guess-and-test, Ben made Liferay's JSPs produce xhtml that get interpreted correctly by Orbeon's filter. This is known as the "separate deployment". He followed the instructions at:

http://www.orbeon.com/ops/doc/reference-xforms-java

But, the missing piece of information is that the order in which the filters are setup in Liferay's web.xml are important. In that file, Liferay already has a bunch of filters (about 160 lines worth). The orbeon OPSXFormsFilter must be inserted AFTER the last standard Liferay
filter. This is a problem because there are other filters that handle *.jsp for the whole app. If the filter chain is not assembled in the correct order, the "resource URL" is not correctly
passed to Orbeon, and the parser will not receive any xhtml.

Just for the record, this is the bit of web.xml code which enables Orbeon to filter xhtml inside Liferay:


<!-- Declare and configure the Orbeon Forms XForms filter -->
<filter>
<filter-name>ops-xforms-filter</filter-name>
<filter-class>
org.orbeon.oxf.servlet.OPSXFormsFilter
</filter-class>
<init-param>
<param-name>oxf.xforms.renderer.context</param-name>
<param-value>/orbeon</param-value>
</init-param>
</filter>
<!-- Any web resource under /xforms-jsp is processed by the XForms engine -->
<filter-mapping>
<filter-name>ops-xforms-filter</filter-name>
<url-pattern>/html/xforms-jsp/*</url-pattern>
</filter-mapping>
<!-- This is necessary so that XForms engine resources can be served appropriately -->
<filter-mapping>
<filter-name>ops-xforms-filter</filter-name>
<url-pattern>/orbeon/*</url-pattern>
</filter-mapping>

Ben also copied these libraries to Liferay's WEB-INF/lib, but only the one mentioned in the Orbeon doc may be necessary.
  • orbeon-resources-private.jar
  • orbeon-resources-public.jar
  • orbeon-xforms-filter.jar

4 comments:

joppu said...

Hi Peter,
I've been following what you've written in your blog and also that orbeon doc. So if I understand you correctly, I make the changes to the Liferay web.xml as you suggest and I place my jsp's that generate xform content in the html/xforms folder. But then, how would i get that xform to display in a portlet?

joppu said...

Just so u know, I quoted you in the Liferay forums...
http://www.liferay.com/web/guest/community/forums/-/message_boards/message/1008303

Peter V said...

Hi Joppu, I am not sure about the portlet part. We tried this but didn't have much luck, so we used IFrames. The iframe pings a JSP that spits back a rendered orbeon form. This is why I needed to do the seperate deployment of Orbeon-- you can configure post processing by Orbeon of JSP output in web.xml.

Unknown said...

I have problems with separated deployment.
Where should I deploy my JSP services called from my separated J2EE application (I mean services as JSP pages called by XForms submissions)?

Unfortunately I noticed that JSP pages of separated application calls JSP services under 'orbeon' web application and not JSPs in the SAME application - in contrast with user guide:

http://www.orbeon.com/ops/doc/reference-xforms-java

about JSP locations:
"You must not deploy resources under the /orbeon/ directory, as that directory is reserved for Orbeon Forms resources."




Environment:
Orbeon 3.7.1
Tomcat 6.0
JDK: 1.6.0_16

Labels

Blog Archive

Contributors