There seems to be a difference in file referecense when using
%rest:path("/show/{$welcome}") %method("html")
vs.
%rest:path("/show") %rest:form-param("welcome", "{$welcome}") %method("html")
In the first version it appears that references within to folder /static inside the BaseX web directory are not found (images stylesheets etc.), while it works nicely using parameter.
This snippet may illustrate, the secon shows the logo, the other won't:
module namespace page = 'http://basex.org/modules/web-page';
declare %rest:path("/show/{$welcome}") %output:method("html") function page:show($welcome) { <html><body><img src="static/logo.png"/><p>{$welcome}</p></body></html> };
declare %rest:path("/show") %rest:form-param("welcome", "{$welcome}") %output:method("html") function page:showparam($welcome) { <html><body><img src="static/logo.png"/><p>{$welcome}</p></body></html> };
Hi Lars,
the relative URL "static/logo.png" will be rewritten by your browser to the destination URL. If your URL is e.g....
http://localhost:1234/show/xyz
...then the image URL will be rewritten to...
http://localhost:1234/show/static/logo.png
In other words, there is no way for BaseX, RESTXQ or the web server to do "correct" this address resolution.
The easiest solution to tackle this is to use absolute paths. The following URL...
<img src="/static/logo.png"/>
...will be rewritten to...
http://localhost:1234/static/logo.png
Hope this helps, Christian
Hi Christian
Thanks - that solved it!
Best, Lars
2014-09-02 17:48 GMT+02:00 Christian Grün christian.gruen@gmail.com:
Hi Lars,
the relative URL "static/logo.png" will be rewritten by your browser to the destination URL. If your URL is e.g....
http://localhost:1234/show/xyz
...then the image URL will be rewritten to...
http://localhost:1234/show/static/logo.png
In other words, there is no way for BaseX, RESTXQ or the web server to do "correct" this address resolution.
The easiest solution to tackle this is to use absolute paths. The following URL...
<img src="/static/logo.png"/>
...will be rewritten to...
http://localhost:1234/static/logo.png
Hope this helps, Christian
basex-talk@mailman.uni-konstanz.de