Hi!

I got this result
```static-base-uri() = file:/opt/bitnami/apache-tomcat/webapps/BaseX811/hans.xq```

which is the name of the file I included this temporary function for you

```
(:~
 : Temporary test for debugging BaseX on Tomcat for CG on the list.
 : @deprecated
 :)
declare
updating function eelex:path-test()
{
  db:output("static-base-uri() = " || static-base-uri())
};
```

Which I summon from the DBA using this
```
xquery version "3.0" encoding "UTF-8";

import module namespace eelex = 'some-eelex' at '/opt/bitnami/apache-tomcat/webapps/BaseX811/hans.xq';

return eelex:path-test()
```


Did I do it correctly?
kristian


05.05.2015 17:16, Christian Grün kirjutas:
Some of the path issues should be resolved with the latest snapshot [1,2]:

* web:redirect will now resolve absolute paths against the name of a
web app (if there is one)
* root requests without trailing slash will be redirected to the same
address with trailing slash

I still need your help with fn:static-base-uri, though; I couldn't
reproduce it on our machines so far..

Christian

[1] http://files.basex.org/releases/latest
[2] https://github.com/BaseXdb/basex/issues/1026


On Tue, May 5, 2015 at 11:20 AM, Christian Grün
<[email protected]> wrote:
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.

1) 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```.
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..

2) 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

[1] https://github.com/BaseXdb/basex/issues/1026

Reply via email to