Cache problem with Exist xquery Rest interface

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Cache problem with Exist xquery Rest interface

Andrew Bailey
Hi,

I have an xquery that I modify (I added test to the xml:base attribute)
I do a get on the xquery using the exist rest api
there is no Last-Modified header - why not?

I do a get using a url mapped to an xpl to "forward" the request from
the url I want the user to see
The contents are stale!
(but at least it has Last-Modified and Expires headers)

Is there any better way to do the forward? as far as I know in the
page flow I can only forward to another page flow and not a url.

Do I need to manually set the Last-Modified header in the xquery?

If I modify the file then shouldnt the last modification time be that
of the file modification time?

Thanks

Andy Bailey
http://www.hazlorealidad.com

PS the ... replace the host and port

  curl -v ..../orbeon/exist/rest/db/orbeon/xql/part/index.xql
> GET /orbeon/exist/rest/db/orbeon/xql/part/index.xql HTTP/1.1
> User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.1 libidn/0.6.5
> Host: ....
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
< X-XQuery-Cached: false
< Set-Cookie: JSESSIONID=A467167C224EFD7BDA3EAE2BC50CAF44; Path=/orbeon
< Content-Type: text/xml;charset=UTF-8
< Content-Length: 1999
< Date: Sat, 19 Jul 2008 15:32:51 GMT
<?xml version="1.0" encoding="UTF-8"?>
<atom:feed xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
xml:base="..../orbeon/mfg/part/test">


I have a pipeline

<?xml version="1.0" encoding="utf-8"?>
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
    xmlns:oxf="http://www.orbeon.com/oxf/processors">

    <p:param name="data" type="output"/>

    <!-- Execute REST submission -->
    <p:processor name="oxf:xforms-submission">
        <p:input name="submission">
            <xforms:submission
xmlns:xforms="http://www.w3.org/2002/xforms" serialize="false"
        method="get" action="/exist/rest/db/orbeon/xql/part/index.xql"/>
        </p:input>
        <p:input name="request"><dummy/></p:input>
        <p:output name="response" ref="data"/>
    </p:processor>

</p:config>

 curl -v ....../orbeon/exist/rest/db/orbeon/xql/part/index.mfg/part/index.xml
> GET /orbeon/mfg/part/index.xml HTTP/1.1
> User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.1 libidn/0.6.5
> Host: .....
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
< Last-Modified: Sat, 19 Jul 2008 15:26:58 GMT
< Expires: Sat, 19 Jul 2008 15:33:26 GMT
< Cache-Control: post-check=0, pre-check=0
< Pragma:
< Content-Type: application/atom+xml;charset=utf-8
< Content-Length: 1941
< Date: Sat, 19 Jul 2008 15:33:26 GMT
<?xml version="1.0" encoding="utf-8"?><atom:feed
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
xml:base="..../orbeon/mfg/part/">

$ date
Sat Jul 19 10:40:02 COT 2008
its GMT-5


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Cache problem with Exist xquery Rest interface

Andrew Bailey
Ok Im going to reply to myself!!

In the xquery I added
let $anticache := (response:set-header('Cache-Control', 'no-cache'),
                   response:set-header('Pragma', 'no-cache'))

and that did the trick.
It would be better to set the Last-Modified header but thats a TODO

I think its an eXist bug that the Last-Modification time isnt set by
default I think it should be the lastModification time of the
file or even better the later of the LastModification time the user
sets and the lastModification time of the file.

I will post a message on the eXist mailing list about this and Im also
going to ask how to format the an xs:date
as Sat, 19 Jul 2008 16:02:53 GMT
so that I can put the Last-Modification time in the header that would be great.

Andy Bailey
http://www.hazlorealidad.com


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws