static-base-uri() returns nothing in the Queries panel in the DBA.
I guess I was too quick: You'll probably have to include this function in your RESTXQ code. The function returns the URI of the currently evaluated XQuery module. As queries in the Queries panel will be evaluated via xquery:eval, there is no base uri attached to them..
Kristian
05.05.2015 12:20, Christian Grün kirjutas:
Thanks for the hints. Once again it seems we would need to spend more time on the deployment with Tomcat. I have reopened an old issue for that [1]. Feedback from other users is welcome, too.
- web:redirect() doesn't work with absolute paths, they instead strip
off the Tomcat webapp name from the url. For example, my BaseX lives in a webapp called BaseX811, so the base-url I have, is ```http://something:port/BaseX811%60%60%60. But doing ```web:redirect('/dba')``` redirects to a url with the webapp name and port chopped off, e.g http://something/dba
I'll see if the webapp name can be embedded if the specified URL is not relative..
- The file module behaves strangely:
```file:current-dir()``` returns on my development setup (fedora) "/usr/share/tomcat/" which is a symbolic link on my system to the Tomcat webapps folder.
This is in some way correct, because the "current directory" is always defined by the application (usually the JVM) that is starting BaseX. In other words, it's advisable not to use current-dir() in web applications.
```file:base-dir()``` returns on my development box the BaseX webapp folder e.g "/usr/share/tomcat/webapps/BaseX811/" (hurray!) but on my production setup it returns the empty string!
Hm, so it seems that the base URI cannot be resolved to a local file system directory. Could you please check (e.g. in the Queries panel of the DBA) what is returned by "static-base-uri()" ?
Please keep us informed if you should encounter some more irregularities when using Tomcat.
Best, Christian