Dear friends We updated 2 days ago from 8.2 to 8.4 and are experiencing a few strange things. Aside this : https://github.com/BaseXdb/basex/issues/702#issuecomment-212352923, we discovered that this kind of function doesn't work anymore : (:~ : resource function for the static files : : @param $file file or unknown path : @return rest response and binary file :) declare %rest:path('/synopsx/files/{$file=.+}') function synopsx.files:file($file as xs:string) as item()+ { let $path := $G:FILES || $file return ( <rest:response> <http:response> <http:header name='Cache-Control' value='max-age=3600,public'/> </http:response> <output:serialization-parameters> <output:media-type value='{ synopsx.files:mime-type($path) }'/> <output:method value='raw'/> </output:serialization-parameters> </rest:response>, file:read-binary($path)) }; Response : HTTP ERROR 400 Problem accessing /synopsx/files/synopsx.js. Reason: Stopped at /resource/basex/webapp/synopsx/_restxq/files.xqm, 38/10: [SEPM0017] Value of 'method' must be one of (xml,xhtml,html,json,csv,text,adaptive,basex). ------------------------------------------------------------------------ /Powered by Jetty:// /where, on my computer, an exact clone of the webapp runing with a 8.3 works perfectly and sends me my js file as expected. I read the changelogs but couldn't figure out what could be involved here. I tried to change "raw" to "adaptive" but then I get a file not found answer : HTTP ERROR 400 Problem accessing /synopsx/files/synopsx.js. Reason: Stopped at /resource/basex/webapp/synopsx/_restxq/files.xqm, 50/21: [file:not-found] '/resource/basex/webapp/synopsx/files/synopsx.js' does not exist. ------------------------------------------------------------------------ /Powered by Jetty:/// Thanks :)))) Maud PS : We're having a showcase with BaseX tomorrow at 4pm :( -- /« Ne travaillez jamais »/ *Maud Ingarao* IHRIM - UMR 5317 Institut d’histoire des représentations et des idées dans les modernités 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 http://ihrim.ens-lyon.fr http://institutdesanti.ens-lyon.fr http://ahn.ens-lyon.fr
Hi Maud, Sorry for the delay, I’ll soon give you an answer on your other e-mails!
Response : HTTP ERROR 400 Problem accessing /synopsx/files/synopsx.js. Reason:
Stopped at /resource/basex/webapp/synopsx/_restxq/files.xqm, 38/10: [SEPM0017] Value of 'method' must be one of (xml,xhtml,html,json,csv,text,adaptive,basex).
With 8.4, the "raw" output method has become obsolete. Your code should work if you remove the following line: <output:method value='raw'/> Here is yet another solution for the synopsx.files:file() function, which is a bit more compact: function synopsx.files:file($file as xs:string) as item()+ { let $path := $G:FILES || $file return ( web:response-header(map { 'media-type': web:content-type($path) }), file:read-binary($path) ) }; Hope this helps, feel free to ask more questions, Christian
participants (2)
-
Christian Grün -
Maud Ingarao