Maintenance

  • Home
  • Log in
  • « New upyerdb script ready for review/testing
  • Building exist 2.1 from git »

eXist tip for myself: serving files from outside the current controller context

Posted by mholmes on 11 Sep 2013 in Announcements

Two ways to serve up static files that are not in the context of the controller.xql:

if (contains($currentUri, 'pix/')) then 
    <dispatch xmlns="http://exist.sourceforge.net/NS/exist">
    	<forward absolute="no" url="{concat('/../data/pix/', $exist:resource)}"/>
    </dispatch>
if (contains($currentUri, 'graphics/')) then 
    <dispatch xmlns="http://exist.sourceforge.net/NS/exist">
    	<forward absolute="yes" url="{concat('/rest/db/data/graphics/', substring-after($currentUri, 'graphics/'))}"/>
    </dispatch>
    

This is commonly used when e.g. the site logic and controller are in /db//site (which may be mapped to a subdomain), controlled by admin, while the content needs to be controllable by editors (so it's in e.g. a /db/data). I've had to re-figure this out a couple of times, so I'm blogging it for future reference.

This entry was posted by Martin and filed under Announcements.

Maintenance

This blog is the location for all work involving software and hardware maintenance, updates, installs, etc., both routine and urgent.
  • Home
  • Recently
  • Archives
  • Categories

Search

Categories

  • All
  • Announcements
  • Hit by a bus
  • Labs
    • Activity log
    • Documentation
  • Notes
  • R & D
    • Activity log
    • Documentation
  • Servers
    • Activity log
    • Documentation
  • Tasks

All blogs

  • Academic
  • AdaptiveDB
  • Admin
  • Announcements
  • CanMys
  • Cascade
  • CGWP
  • ColDesp
  • Depts
  • DVPP
  • Endings
  • HCMC Blogs
  • Landscapes
  • LEMDO
  • Linguistics
  • Maint
  • LondonMap
  • Mariage
  • MoM
  • Moses
  • Pro-D
  • Projects
  • ScanCan
  • HumsSites
  • Wendat

This collection ©2026 by admin • Help • Open-source blog