Hi Marco, Does the behavior change if you remove output:method("html")?
Cheers, Christian > declare > %rest:path("/dasbox/ui/resources/{$resource=.+}") > %rest:GET > %output:method("html") > function ui:resources($resource as xs:string){ > let $path := file:base-dir() || 'resources/' || $resource > let $mediatype := web:content-type($path) > return ( > web:response-header(map { 'media-type': $mediatype }), > if (matches($mediatype, "^text/.+")) then file:read-text($path) > else file:read-binary($path) > ) > }; > > Thanks for your support, > Marco. > > > On 03/05/2016 02:59, Murray, Gregory wrote: >> >> Hi Christian, >> >> Thanks for the hints! I see that using webapp/static does work, but I >> prefer to keep all files related to an app together under one directory, so >> I'll use the second option you provided -- using RESTXQ. >> >> Many thanks, >> Greg >> >> ________________________________________ >> From: Christian Grün [christian.gr...@gmail.com] >> Sent: Monday, May 02, 2016 3:20 AM >> To: Murray, Gregory >> Cc: basex-talk@mailman.uni-konstanz.de >> Subject: Re: [basex-talk] Web application static files >> >> Hi Greg, >> >> Thanks for your mail. If you are working with the ZIP distribution, >> you could compare your code with the RESTXQ examples in the restxq.xqm >> file. >> >> I assume you get 404 because your static directory is a sub-directory >> of bookplates. Here are two things you can do: >> >> * Move your static directory from "webapp/bookplates" to "webapp" >> * Deliver static files via RESTXQ (see common.xqm and the REST path >> "/dba/static/{$file=.+}"). >> >> Does this help? >> Christian >> >> >> >> On Sun, May 1, 2016 at 6:43 PM, Murray, Gregory >> <gregory.mur...@ptsem.edu> wrote: >>> >>> Hello, >>> >>> I'm new to BaseX, and I'm setting up a simple web application (on >>> Mac/Unix, using the ZIP distribution of BaseX). I'm unable to bring in >>> static files like CSS. Following the documentation and the "dba" web >>> application that comes with BaseX, I have included the following in the >>> HTML: >>> >>> <link rel="stylesheet" type="text/css" href="static/app.css"/> >>> >>> to point to a file that resides here: >>> >>> ~/basex/webapp/bookplates/static/app.css >>> >>> I have a module sitting here: >>> >>> ~/basex/webapp/bookplates/controller.xqm >>> >>> with a function with these annotations: >>> >>> %rest:path("bookplates") >>> %output:method("html") >>> >>> When I point my browser to http://localhost:8984/bookplates/ the server >>> successfully returns the HTML, but when the browser tries to load the CSS it >>> requests http://localhost:8984/bookplates/static/app.css and the server >>> responds with a 404 saying "No function found that matches the request" as >>> if the server is looking for a RESTXQ function. >>> >>> What am I doing wrong? >>> >>> Thanks, >>> Greg > >