Hi Marc,
Most time is usually spent for parsing all the RESTXQ files, or running queries on large databases. The discussed function for serving static files shouldn't represent a serious bottleneck I believe, even if big media files are sent out (at least it hasn't been so far in our own applications).
I also would like to see a way of doing efficient static file serving from within a module but then there should be a way of excluding this static file directory from the search for RESTXQ and other XQuery code because one could then just put a nasty XQuery file in such a static directory and affect server performance or even do nasty things.
The conventional way to do this is to configure such paths in the web.xml file. Other ideas for more fine-grained solutions are welcome.
Christian
--Marc
On Thu, Feb 19, 2015 at 11:08 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Maud,
We are glad to hear that the DBA code serves as a good inspiration! After all, I think this should be its primary purpose. The way how we integrate user components like buttons or tables is a bit unorthodox; this may be simplified in a future version.
we want to distribute our static files inside our module, in a synopsx/files/ directory, [...]
In the DBA code, we solved this by creating a custom rest:response element for all files starting with the path "dba/files". I have slightly simplified the current code; please see here [1] how it's done! The web:mime-type($path) function calls an internal BaseX function to retrieve the content type of the response [2]; there may be a new XQuery function for that in future as well. We could even think about providing an XQuery function for everything that's happening in [1].
More feedback is welcome, Christian
[1] https://github.com/BaseXdb/basex/blob/master/basex-api/src/main/webapp/dba/u... [2] https://github.com/BaseXdb/basex/blob/master/basex-api/src/main/webapp/dba/m...
and of course we don't
want to ask people to modify the static path declaration in their WEB-INF/web.xml file to use our module. It works perfectly in your dba module : for exemple in dba/modules/tmpl.xqm, the created html element calls files/js.js or files/style.css and it simply works... But not in ours : we get this "No function matches the request" error because these files pathes are interpreted as restxq pathes (which sounds reasonable, but why not in yours ?) We are know trying more and more complicated things that don't work neither, like in https://github.com/mingarao/synopsx/blob/dev/webapp/synopsx/_restxq/files.xq... line 37... So I think we should better stop there and ask you : what's the trick in dba ? All the best ! Maud and the AHN/SynopsX people
--
« Ne travaillez jamais »
Maud Ingarao IHPC (UMR 5037) Institut d’histoire de la pensée classique, de l’Humanisme aux Lumières Ecole Normale Supérieure de Lyon - Site Descartes - Bureau R322 15 Parvis René Descartes - BP7000 - 69342 Lyon CEDEX 07 +33 4 37 37 65 79 - maud.ingarao@ens-lyon.fr
Je suis absente le jeudi | Out of office on Thursdays
http://pensee-classique.ens-lyon.fr http://institutdesanti.ens-lyon.fr http://ahn.ens-lyon.fr http://www.mutec-shs.fr http://cahier.hypotheses.org
-- --Marc