redirect problems in separate deployment

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

redirect problems in separate deployment

danielk1989
Hi Orbeon peoples.

Last week we decide to upgrade from Orbeon 4.4.1 to 4.5.1.

This also lead us to go from our previous setup with integrated deployment, to separated deployment.

We followed the steps by the link: http://wiki.orbeon.com/forms/doc/developer-guide/xforms-with-java-applications

We have our own custom pages to serve the overview of forms. It all seems to work fine, except different buttons in the builder, and we can't reach the review page in the runner.

When running Orbeon builder directly, http://localhost:8080/orbeon, it all works fine, but when we run through our custom solution: http://localhost:8080/ourSolution/orbeon, we experienced the problems below:

1. The new button (to create a new form) in the builder, doesn't work. It redirect to a wrong page. We have fixed this by made a change in the xform file in the builder: \web-app\WEB-INF\resources\forms\orbeon\builder\form\form.xhtml

Where we put \orbeon before in the link, as follow:

<xf:trigger>
     <xf:label mediatype="text/html" value="$form-resources/new-button/label"/>
          <xf:action ev:event="DOMActivate">
                <xf:load resource="/orbeon/fr/orbeon/builder/new"/>
          </xf:action>
     </xf:trigger>

Instead of:

<xf:trigger>
      <xf:label mediatype="text/html" value="$form-resources/new-button/label"/>
            <xf:action ev:event="DOMActivate">
                 <xf:load resource="/fr/orbeon/builder/new"/>
            </xf:action>
      </xf:trigger>

2. We experiences the same with the Preview button (To show the test view for at form).
Here we made the same fix in the following file: \web-app\WEB-INF\resources\forms\orbeon\builder\form\model.xml

Where we put /orbeon in front of the link to show the preview page.

3. Again we recognized a problem to show the review page on the runner, when filling out a form. When we go through a form, page after page, and want to go to the review page, before submitting the form, we get a blank page, when hitting the review button. We think we reach the same problem here. But we dont know what file to look in, to put /orbeon, like we did in the other files. So here I want to ask, what file can we edit, so we can redirect the review button it to the right page?


This also lead me to the question, why we have to change all this path. We have followed the guide mentioned above. It seems like all pages is not redirected correct. We are using Grails 2.2.4 for our custom solution.

I really hope you can help us with this. Perhaps it's just one place we missed, or is not mentioned in the guide, where we have to place this \orbeon, so all link will work?

Best Regards
Daniel Knudsen




Reply | Threaded
Open this post in threaded view
|

Re: redirect problems in separate deployment

Erik Bruchez
Administrator
Daniel,

Your custom pages can reside in your own webapp, that's fine.

Form Runner and Form Builder on the other hand are expected to run in the context of the Orbeon WAR.

If you need to link to Form Builder / Form Runner pages, you can do so simply by navigating to the Form Builder / Form Runner URLs.

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: redirect problems in separate deployment

danielk1989
Hi Erik.

Thanks for your reply.

I understand your answer as it is not expected to run the orbeon context inside our own application, as we do now. Like: /ourApplication/Orbeon.

But our application is required to be running in the same context, and not by switching between localhost/ourApplication and localhost/orbeon. Furthermore I can't see how we can get back to our custom overview page in ourApplication, if we are in the orbeon builder, without again to hack the links manually.

Is my understanding correct?

Can you please tell me what file I have to edit, for editing the link of the review button?, so we are redirected to the correct page, when we press the review button. Then we may do this as a solution for now.

// Daniel
Reply | Threaded
Open this post in threaded view
|

Re: redirect problems in separate deployment

Erik Bruchez
Administrator
Daniel,

The Summary button is defined in a process here:

    http://goo.gl/nCegDb

This calls a built-in action written in Scala, which redirects to the resulting path:

    http://goo.gl/aeTFRV

This in turn uses built-in URL rewriting mechanisms to add the context. It goes deep in the platform. URL rewriting and dealing with multiple contexts is hard and messy in our experience. I cannot provide a simple answer without probably spending hours digging into the code to figure out why the paths do not match what you expect, and I also would need to be able to reproduce your exact situation. I am really sorry as I wish I could help you here but that goes a bit outside of the work we can do in the scope of this forum.

However, with 4.6 the `navigate` action supports XPath, so you could manually change the process to do:

<property as="xs:string"  name="oxf.fr.detail.process.summary.*.*">
    navigate(uri = "http://your.host:8080/ourApplication/Orbeon/fr/{xxf:instance('fr-parameters-instance')/app}/{xxf:instance('fr-parameters-instance')/form}/summary")
</property>

The problem here is that you need an absolute URL. Also, that requires 4.6, but I would recommend 4.6 anyway.

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: redirect problems in separate deployment

danielk1989
Hi Erik

The file you point me to looks like the right one, I was asking for, thanks..

But how can I edit it. When i browse the lib "orbeon", where I think it is placed, right? (WEB-INF\lib\orbeon\org\orbeon\oxf\fr\FormRunnerActions.class) It's all class files..

I can't find the .scala file for this file anywhere, so I can correct the link for our solution.. Is this true?

About update 4.6, I see it will do the job. But I can't update to 4.6 right now, because other have to accept this first. So I really want to do a temporarily fix now. We have first planned to update again, when 4.7 is released.

// Daniel
Reply | Threaded
Open this post in threaded view
|

Re: redirect problems in separate deployment

Erik Bruchez
Administrator
I'll be honest: I think you'll have trouble with this if you have never worked with Scala.

This said, if you want to make changes to the Scala code, you need to build Orbeon Forms from source. Here are some instructions:

    https://github.com/orbeon/orbeon-forms/wiki/Building-Orbeon-Forms

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: redirect problems in separate deployment

danielk1989
Hi Erik

Thanks again for your useful answers.

I think we are close to a solution now, and I just have a last question I hope will be easy for you to help me with.

In the meantime I have choosen to upgrade to Orbeon 4.6, as you suggest me to do, and got accept to do it, and we also get additional benefits of that.

I have edited the example code for properties you gave me, because the site we want to view, is not the summary page, but the review page (Perhaps I had mentioned the summary page instead previously.)

I have tried to add the following in properties-local.xml file for the form runner, where our application is running on https://esvrkdevfr01.esvrk.gkl.10n.dk, port: 8443 and the application is called blanketservice.

I got the link from the tryNavigateToReview method in the link you posted earlier: http://goo.gl/aeTFRV


<property as="xs:string"  name="oxf.fr.detail.process.review.*.*">
        navigate(uri = "https://esvrkdevfr01.esvrk.gkl.10n.dk:8443/blanketservice/orbeon/fr/{xxf:instance('fr-parameters-instance')/app}/{xxf:instance('fr-parameters-instance')/form}/view/{xxf:instance('fr-parameters-instance')/document}")
 </property>

The problem is now, when I press the review button, the browser ask me to leave the page, I click yes, and it redirect me to a page that says "Orbeon Forms - Page Not Found".

Also I dont like the "Do you want to leave the page" from my browser. I just want to add the "/orbeon" as I mentioned before, and do not want to redirect to a custom page, as it seems like it want to do. It seems like it's trying to leave the session, when I press the review button.

Can you please point me to correct the link, if it's wrong?

Or can I do some smart XPath stuff here? Like the pseudo code bellow?

navigate(uri ="Context.current + "/orbeon" + TryNavigateToReviewPage")

Best Regards
Daniel
Reply | Threaded
Open this post in threaded view
|

Re: redirect problems in separate deployment

danielk1989
Hi again.

Just to inform, I have tried the following as I see as my best bet, but this still doesn't work. It put the URL below afterwards the current host. So it looks correct, but doesn't work. It get the app, form and documentid correct in the path, but I still get this, Do you want to leave the page message, and it says Orbeon can't find the page?

<property as="xs:string"  name="oxf.fr.detail.process.review.*.*">
        navigate("/orbeon/fr/{xxf:instance('fr-parameters-instance')/app}/{xxf:instance('fr-parameters-instance')/form}/view/{xxf:instance('fr-parameters-instance')/document}")
</property>

//Daniel
Reply | Threaded
Open this post in threaded view
|

Re: redirect problems in separate deployment

Erik Bruchez
Administrator
Ah, it's a bit different to go to the review and edit pages, because they use an HTTP POST, not just a redirection.

Try using the `send` action instead, something like:

    send(uri = "/orbeon/fr/{xxf:instance('fr-parameters-instance')/app}/{xxf:instance('fr-parameters-instance')/form}/view/{xxf:instance('fr-parameters-instance')/document}", method = "post", replace = "all")

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: redirect problems in separate deployment

danielk1989
Hi Erik

I didn't tried the send action you suggest, because we found another solution in the meantime.

By using myApp name, followede by the # tag in the orbeon war file name, Tomcat exhibits orbeon as it is inside myApp folder, and this solved our problems with the paths.

So if our custom solution is called myCustomApp, our orbeon war file have to be called myCustomApp#orbeon.war

We can now call orbeon function by the path: http://host:8080/myCustomApp/orbeon, anyway the war file is extracted as myCustomApp#orbeon.war, and is located in the root of webapps folder.

We now experiences the opposite problem, with buttons that have to go back to our own soluton. Example when we press the overview button in the builder, we want to be redirected back to our custom overview page. Fortunately we could fix this by editing the link manually in few files, by inserting /../ in the link, or make a new button, because the link have to point to http://host:8080/myCustomApp/ and not to http://host:8080/myCustomApp/orbeon.

Perhaps the tricks with # tag can help others too.

//Daniel