URL rewriting for resources

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

URL rewriting for resources

cvesters
I am having the following setup.
I have two servers, one that handles showing the forms (frontend) and another that stores the data (process).

When going to a form on the frontend server, the form and all images should be loaded from the process server. I do this by using a page-flow.xml containing:

<page path-info="/scriptura-htmlforms/display/([^/]*/)" matcher="oxf:perl5-matcher" view="pipelines/form.xpl" />
<page path-info="/scriptura-htmlforms/display/([^/]*/.*)" matcher="oxf:perl5-matcher" model="pipelines/resources.xpl" />

Forms have a url like: /scriptura-htmlforms/display/<name-of-form>
Images have a url like:  /scriptura-htmlforms/display/<name-of-form>/<name-of-image>

The last one is however not working, and as far as I have been able to find out, this is due to the fact that Orbeon automatically rewrites resources. I did a quick check, and it only happens with relative resources. Is there a way to bypass this mechanism, or is it advised to use absolute locations for this?

In cause of absolute URLs I need to use a url on the process server, as using one for the frontend server still has Orbeon intercepting my calls instead of using my page-flow.xml

Can you give me some advice on this?


Kind regards,
Chris Vesters
Reply | Threaded
Open this post in threaded view
|

Re: URL rewriting for resources

Alessandro  Vernet
Administrator
Hi Chris,

I am not sure to grasp where the problem lies. What is the resource being rewritten to, for example? Is the problem that the URL is rewritten incorrectly, or that the page flow doesn't handle that URL? Maybe some example would clarify the situation.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: URL rewriting for resources

cvesters
This post was updated on .
I have an XForm which contains an element like <img src="myImage.png"

This image however does not exist next to the Orbeon as some app resource.
The image has to be fetched from a different server. For this I have a pipeline that should handle it. But I discovered that the resource does not 'match' the regular expression, and it does so only because it ends with '.png'. If I write '.pna' then it does match.

Orbeon rewrites the location and includes a number in the path (because the resource is versioned), but even if it doesn't the resources still do not go through the pipeline. The pipeline would fetch the image from the server ("http://server/resources/myImage.png") and show that.
Reply | Threaded
Open this post in threaded view
|

Re: URL rewriting for resources

Alessandro  Vernet
Administrator
Hi Chris,

Here what I did to try to reproduce this issue:

1. I've edited apps/xforms-hello/view.xhtml to include <xh:img src="/xforms-hello/image.png"/>.
2. In the same directory as view.xhtml, I've placed an image.xpl, mapped it to /xforms-hello/image.png by adding <page path="/xforms-hello/image.png" model="image.xpl"/> to the page-flow.xml in the same directory. The source of the XPL is: https://gist.github.com/avernet/3e31257afeeaf6f9f01e.
3. I've removed the .png extension from <files> in the root page-flow.xml, as I don't have to have it serve the .png files anymore.

With this, the image shows on the page as expected. Are you seeing something different following the above steps?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet