Display user details in an Orbeon Liferay portlet

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Display user details in an Orbeon Liferay portlet

joppu
Hi,
My aim is to display user details in the orbeon portlet using xforms. Details like: screen name, userId, email etc.

This is what i've done so far:

1. I installed liferay-portal-tomcat-6.0-5.0.1 and got the orbeon portlet war from the community plugins site(sample-orbeon-forms-portlet-5.0.0.1.war). I deployed the war using the Admin portlet and I was able to add the orbeon portlet. The example xforms are working fine.

2. I created an orbeon xform application called liferay-userdetails and have placed it in \webapps\sample-orbeon-forms-portlet\WEB-INF\resources\apps\liferay-userdetails

Here's the page-flow.xml:

<config xmlns="http://www.orbeon.com/oxf/controller">
    <page path-info="/" view="http://localhost:8080/sample-orbeon-forms-portlet/xforms-jsp/test.jsp"/>
    <epilogue url="oxf:/config/epilogue.xpl"/>
</config>


Instead of using the default view.xhtml, I have set the view to a jsp page under \webapps\sample-orbeon-forms-portlet\xforms-jsp
This is beacuse an Orbeon filter has been defined in web.xml with a url-pattern of /xforms-jsp/*

test.jsp - I followed the instructions about using the liferay taglibs from here: http://www.liferay.com/web/rauge/blog/-/blogs/%5Bhowto%5D-personalization---getting-current-user-attributes

<%
    response.setContentType("application/xhtml+xml");
%>

<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>

<liferay-theme:defineObjects />
<portlet:defineObjects />

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml">
        <xhtml:head>
                <xhtml:title>Hello World Classic</xhtml:title>               
        </xhtml:head>
        <xhtml:body>               
                <xhtml:p>Hello World!</xhtml:p>
               
                <xhtml:p>
                        Your User Id: <%= user==null?"NULL"?user.getUserId() %><xhtml:br/>
                </xhtml:p>
               
        </xhtml:body>
</xhtml:html>

I've also modified page-flow-portlet.xml so that the home page points to my xforms application as shown below:

<config xmlns="http://www.orbeon.com/oxf/controller"
        xmlns:xu="http://www.xmldb.org/xupdate"
        xmlns:oxf="http://www.orbeon.com/oxf/processors">

   
    <page id="home" path-info="/" model="apps/liferay-userdetails/page-flow.xml"/>

   
    <page id="apps" path-info="/([^/]+)/.*" matcher="oxf:perl5-matcher" model="apps/${1}/page-flow.xml"/>

   
    <page id="not-found" path-info="/not-found" view="/config/not-found.xml"/>

    <epilogue url="/config/epilogue.xpl"/>
    <not-found-handler page="not-found"/>

</config>

3. I restarted tomcat and my xforms app gets rendered fine in the orbeon portlet..."Hello World" gets displayed but I get a "NULL" for the user id. I checked the servlet source of this jsp page and this is because the user object is null:

user = (com.liferay.portal.model.User) _jspx_page_context.findAttribute("user");

Why is this happening? Is there any other method I could follow to get the user details?