Login  Register

Dynamic redirection to sub-app?

Posted by ncrofts on Feb 11, 2011; 5:22pm
URL: https://discuss.orbeon.com/Dynamic-redirection-to-sub-app-tp3301659.html

Hi,

I'm an trying to figure out how to dynamically redirect to a sub-application of an Orbeon Forms application.

My starting point is that I have several different applications deployed under the "resources/apps" folder of a webapp e.g.

.../WEB-INF/resources/apps/alpha
.../WEB-INF/resources/apps/beta
... more apps


From my home XForms page I want to be able to list the available apps and then click on a link to redirect to that sub-app. To start with I have an XForm page with an instance that contains the names of the apps e.g.

<xforms:instance id="apps">
    <apps>
        <app><name>alpha</name><app>
        <app><name>beta</name><app>
         ....
    </apps>
</xforms:instance>


.... and in the XForm I use a repeat element to generate a series of (links) submissions to the selected app e.g.

<xforms:repeat nodeset="instance('apps')/app" id="app-index">

    <xxforms:variable name="app" select"."/>

    <xforms:submission submit="go-app" appearance="minimal">
        <xforms:label ref="$app/name"/>
    </xforms:submission>

</xforms:repeat>


...and the XForm page contains a submission as follows:

<xforms:submission id="go-app" resource="app-redirect" ref="instance('apps')/app[index('app-index')]"/>

This submission works, but I can't seem to figure out (if it is indeed possible) how to then redirect to the correct sub-application?


Effectively what I want to end up with is the ability to dynamically redirect to "/alpha", "/beta" etc. based on the instance value.

By the way, if I manually navigate to the sub-application I have been able to redirect to the page flow of each application by adding a rule to the main page flow i.e.
<c:page id="apps" path-info="/([^/]+)/.*" matcher="oxf:perl5-matcher" model="apps/${1}/page-flow.xml"/>

However I just can seem to figure out how extract the app/name from the instance submitted to /app-redirect and then get it to build the appropriate URL based on this before redirecting to the appropriate sub-flow.

<c:page id="app-redirect" path-info="/app-redirect">

    ????

</c:page>


I hope what I am trying to achieve is clear from this description? Can anyone advise on the way to handle the dynamic submission to the pages?
 
Regards,
Neil