BaseX as a web application server -- output option media-type?

Friday, 12 August 2011 · 3 messages
S
Sebastian.Wiemer12 Aug 2011 08:43 #
Hello, I tried to use basex 6.7.1 as a web application server through the jax-rx API: If you put the following file in the jax-rx directory of basex, then you have a simple web application:
[c:\Programme\BaseX\jax-rx\index.html]
declare option output:method "xhtml";
declare option output:media-type "text/html";
<html>
    <head><title>Testserver</title></head>
    <body>
        <p><a
href="http://127.0.0.1:8984/basex/jax-rx/DBNAME?run=index.html">Testme!<
/a></p>
    </body>
</html>
(DBNAME is you context for the xquery) Here comes the problem: the declare option output:media-type "text/html"; does not seem to work :-( But if you specify the serialization option directly in the URI:
<html>
    <head><title>Testserver</title></head>
    <body>
        <p><a
href="http://127.0.0.1:8984/basex/jax-rx/DBNAME?run=index.html&amp;outpu
t=media-type=text/html">Testme!</a></p>
    </body>
</html>
Then this works and is a very simple example of using BaseX as a web application server. Is it me or basex? Can anybody tell me, why the media-type=text/html output option did not work, when declared in the XQuery? Regards, Sebastian
LL
Lukas Lewandowski12 Aug 2011 10:05 #
Hey Sebastian, In our REST interface we currently support only media-type declaration as HTTP query parameter as in one of your examples:
Quoted text · Sebastian.Wiemer · 12 lines
> <html> > > <head><title>Testserver</title></head> > > <body> > > <p><a href="http://127.0.0.1:8984/basex/jax-rx/DBNAME?run=index.html&amp;output=media-type=text/html">Testme!</a></p> > > </body> > > </html> >
regards Lukas
Quoted text · Sebastian.Wiemer · 64 lines
Am 12.08.2011 um 08:43 schrieb <Sebastian.Wiemer at Bertelsmann.de>: > Hello, > > I tried to use basex 6.7.1 as a web application server through the jax-rx API: > > If you put the following file in the jax-rx directory of basex, then you have a simple web application: > > > [c:\Programme\BaseX\jax-rx\index.html] > > declare option output:method "xhtml"; > > declare option output:media-type "text/html"; > > <html> > > <head><title>Testserver</title></head> > > <body> > > <p><a href="http://127.0.0.1:8984/basex/jax-rx/DBNAME?run=index.html">Testme!</a></p> > > </body> > > </html> > > > (DBNAME is you context for the xquery) > > Here comes the problem: the declare option output:media-type "text/html"; > > does not seem to work L > > But if you specify the serialization option directly in the URI: > > > <html> > > <head><title>Testserver</title></head> > > <body> > > <p><a href="http://127.0.0.1:8984/basex/jax-rx/DBNAME?run=index.html&amp;output=media-type=text/html">Testme!</a></p> > > </body> > > </html> > > > Then this works and is a very simple example of using BaseX as a web application server. > > > Is it me or basex? Can anybody tell me, why the media-type=text/html output option did not work, when declared in the XQuery? > > > Regards, > > Sebastian > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
CG
Christian Grün12 Aug 2011 14:33 #
Dear Sebastian, a quick supplement to Lukas' answer: due to the abstraction of the JAX-RX interface and our implementation, the XQuery output parameters cannot be passed on to JAX-RX. One of our future plans, however (middle term, 2011-12), is to bring BaseX and REST closer together. JAX-RX will then be discarded, and all output parameters specified in XQuery will directly influence the HTTP response. Hope this helps, Christian
Quoted text · Lukas Lewandowski · 96 lines
On Fri, Aug 12, 2011 at 10:05 AM, Lukas Lewandowski <lukas.lewandowski at uni-konstanz.de> wrote: > Hey Sebastian, > In our REST interface we currently support only media-type declaration as > HTTP query parameter as in one of your examples: > > <html> > > <head><title>Testserver</title></head> > > <body> > > <p><a > href="http://127.0.0.1:8984/basex/jax-rx/DBNAME?run=index.html&amp;output=media-type=text/html">Testme!</a></p> > > </body> > > </html> > > regards > Lukas > > > > Am 12.08.2011 um 08:43 schrieb <Sebastian.Wiemer at Bertelsmann.de>: > > Hello, > > I tried to use basex 6.7.1 as a web application server through the jax-rx > API: > > If you put the following file in the jax-rx directory of basex, then you > have a simple web application: > > [c:\Programme\BaseX\jax-rx\index.html] > > declare option output:method "xhtml"; > > declare option output:media-type "text/html"; > > <html> > > <head><title>Testserver</title></head> > > <body> > > <p><a > href="http://127.0.0.1:8984/basex/jax-rx/DBNAME?run=index.html">Testme!</a></p> > > </body> > > </html> > > (DBNAME is you context for the xquery) > > Here comes the problem: the declare option output:media-type "text/html"; > > does not seem to work L > > But if you specify the serialization option directly in the URI: > > <html> > > <head><title>Testserver</title></head> > > <body> > > <p><a > href="http://127.0.0.1:8984/basex/jax-rx/DBNAME?run=index.html&amp;output=media-type=text/html">Testme!</a></p> > > </body> > > </html> > > Then this works and is a very simple example of using BaseX as a web > application server. > > Is it me or basex? Can anybody tell me, why the media-type=text/html output > option did not work, when declared in the XQuery? > > Regards, > > Sebastian > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >

⚡Generated with XQuery