basexhttp and static content

Friday, 18 November 2011 · 2 messages · last reply 19 Nov 2011
LJ
Leigh L. Klotz, Jr.18 Nov 2011 00:32 #
Thank you Michael and Christian. db:retrieve and the XQuery framework look quite interesting and I see how they could work. I had in mind something more lightweight. I've done some examples using BaseX with AgenceXML XSLTForms, which is a 100% in-browser implementation of XForms that needs to be served up as static content. Here's what I mean: 1. Change BaseXHTTPServer so that it tells Jetty about a directory for static resources; Jetty already knows how to handle this. 2. Create an "xsltforms" directory and unzip XSLTForms into it. 3. Create an application directory, and put the XHTML+XForms XML file (and associated CSS) into that directory. I've attached a couple of git patches that enable #1 above, just as an example of what I mean. They enable the command-line option "-x <directory>" and provide help text for it. I've tried this and it works great with the current git version of basex, after applying the two attached patches to basex and basex-api: cd basex mkdir static cd static mkdir xsltforms; pushd xsltforms; unzip /path/to/xsltforms.zip; popd mkdir mypage; pushd mypage; cp /path/to/mypage/index.xml .; popd ./bin/basexhttp -x static & Please consider adding a quick deploy test facility like this to the BaseXHTTPServer. Leigh.
CG
Christian Grün19 Nov 2011 21:46 #
Dear Leigh, I've looked at your patch, and I've modified the HTTP server start class to use the directory addressed by HTTPPATH as Jetty root directory [1]. As Michael mentioned, we might soon extend this solution, so that XQuery files, which are stored in this directory, can be directly evaluated (but I remember well that, for now, you're mainly interested in static resources). By the way: if the HTTP server is running, you can easily embed database resources into a page, by linking them from the static pages, or reference dynamic pages. Examples:
  <img src="/rest/Database/BinaryResource.png" />
  <a href="/rest/Database/DynamicallyBuiltPage.xq" />
Hope this helps, Christian [1] http://docs.basex.org/wiki/Releases
Quoted text · Jr. · 36 lines
On Thu, Nov 17, 2011 at 11:32 PM, Leigh L. Klotz, Jr. <klotz at graflex.org> wrote: > Thank you Michael and Christian. > > db:retrieve and the XQuery framework look quite interesting and I see how > they could work. > > I had in mind something more lightweight. I've done some examples using > BaseX with AgenceXML XSLTForms, which is a 100% in-browser implementation > of XForms that needs to be served up as static content. > > Here's what I mean: > > 1. Change BaseXHTTPServer so that it tells Jetty about a directory for > static resources; Jetty already knows how to handle this. > 2. Create an "xsltforms" directory and unzip XSLTForms into it. > 3. Create an application directory, and put the XHTML+XForms XML file (and > associated CSS) into that directory. > > I've attached a couple of git patches that enable #1 above, just as an > example of what I mean. They enable the command-line option "-x > <directory>" and provide help text for it. > > I've tried this and it works great with the current git version of basex, > after applying the two attached patches to basex and basex-api: > cd basex > mkdir static > cd static > mkdir xsltforms; pushd xsltforms; unzip /path/to/xsltforms.zip; popd > mkdir mypage; pushd mypage; cp /path/to/mypage/index.xml .; popd > ./bin/basexhttp -x static & > > Please consider adding a quick deploy test facility like this to the > BaseXHTTPServer. > > Leigh. >

⚡Generated with XQuery