qexo-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qexo-general] re: XqlServlet and Communication between XQL scripts


From: Ivelin Ivanov
Subject: Re: [Qexo-general] re: XqlServlet and Communication between XQL scripts
Date: Wed, 22 Jan 2003 21:21:15 -0600

-=Ivelin=-
----- Original Message -----
From: "Per Bothner" <address@hidden>
To: "Ivelin Ivanov" <address@hidden>
Cc: <address@hidden>
Sent: Wednesday, January 22, 2003 2:08 AM
Subject: Re: [Qexo-general] re: XqlServlet and Communication between XQL
scripts


> Ivelin Ivanov wrote:
> > This patch detects when the CallContext is a ServletCallContext and
treats a
> > non qualified URL as a local servlet path relative to the current xql
> > servlet.
> > For example if the calling xql resides under webapp/rss2html.xql, and it
> > uses
> > document("sample/rssfilter.xql")
> > QEXO will resolve it to something like
> > document("http://localhost:8080/qexo/sample/rssfilter.xql";)
> > assuming that http://localhost:8080/qexo is the base URL for
rss2html.xql.
>
> I'm somewhat unsure to what extent this is needed.  In the servlet
> example at http://www.gnu.org/software/qexo/XQ-Gen-XML.html
> I managed to use relative path ok - however, it's been a while
> since I wrote and tested this code, so I'm a little hazy on exactly
> what is going on in terms of finding the default diretory.
>
> Presumably URLs should be relative to the "web-app", but I'm not
> sure whether they currently are.  I thought they were ...

Just noticed that you actually use a special QEXO function to prepend the
absolute path to the relative:
 request-servlet-path(). This in effect reads the content of the file, but
will not evaluate it if it is an XQL script, because it will not go through
the servlet engine.

This is a snippet from your source:

let $path := request-servlet-path(),
    $last-slash := last-index-of($path, "/"),
    $dir := substring($path, 1, $last-slash),
    $file := substring($path, $last-slash+1),
    $webapp-dir := servlet-context-realpath(),
    $xml-file := concat($webapp-dir, $dir, "index.xml"),
    $group := document($xml-file)/group



Ivelin


>
> An alternative, as you mention in another message, is to implement
> the two-argument version of document.
>
> (According to the spec, relative URLs are supposed to be relative
> to the document *source*, which to me makes little sense.)
>
> I've been on a 3-day trip and so I'm a little behind on various
> things, including my "day job" work.  So it make take a few more
> days before I can really look at your submission.
> --
> --Per Bothner
> address@hidden   http://www.bothner.com/per/
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]