Changes

Jump to navigation Jump to search
683 bytes removed ,  20:07, 17 March 2012
no edit summary
RESTXQ, specified by [http://www.adamretter.org.uk/ Adam Retter], is a new API that facilitates the use of XQuery
as a Server Side processing language for the Web whilst maintaining portability. It RESTXQ has been largely inspired byJava’s [http://en.wikipedia.org/wiki/Java_API_for_RESTful_Web_Services JAX-RS API], and : it defines a pre-definedset of XQuery 3.0 annotations for mapping HTTP requests to XQuery functions, which in turn generate and returnHTTP responses.As of {{Version|7.2}}, RESTXQ is supported by BaseX.
=Getting started=
<!-- [CG] I guess we need another general page on the HTTP Server and the Servlet that summarizes all this information... -->
First of all, launch the [[Startup#BaseX HTTP Server|BaseX HTTP Server]], which will itself start an instance of the [http://jetty.codehaus.org/jetty/ Jetty WebServer], which listens to the port <code>8984</code> by default (check out the additional [[Startup Options#BaseX HTTP Server|command-line options]]).
By default, the HTTP Server will be accessible at http://localhost:8984.<!-- [CG] I guess we need another general page on the HTTP Server and the Servlet that summarizes all this information...Get a fresh copy of [https://github.com/basexdb/basex-api basex-api] from our github repositories. It contains the base server architecture. Refer to [[Startup#BaseX HTTP Server|BaseX HTTP Server]] for details. To start the HTTP Server, there are two possibilities: * Inside the {{Mono|basex-api}} directory, run the command {{Mono|mvn jetty:run}}. (stop with {{Mono|CTRL + C}})* Run the script RESTXQ service is available via {{Mono|etc/basexhttp}} (inside the {{Mono|basex-api}} package). There is a script to stop the server, located in the same folder. By default, the HTTP Server will be accessible at http://localhost:8984. The server root is <code>src/mainrestxq/webapp</code>}}.-->=Server configuration= If the server is started as Servlet, the {{Mono|.basex}} configuration file will be stored in the root of the web directory. (usually {{Mono|src/main/webapp/}}). The .basex file contains all [[Options#Main Options|Main Options]], such as the path to the database, the HTTP directory and the [[Packaging|Package Repository]]. Initial The initial configuration options can be adjusted in the {{Mono|src/main/webapp/WEB-INF/web.xml}} file.
=Module Declarations=
All RESTXQ modules can be accessed at {{Mono|http://localhost:8984/restxq/}}. Some instructions on how to write such a module follow: A regular module contains a declaration to the rest RESTXQ namespace {{Mono|http://exquery.org/ns/rest/annotation}}. So-called REST RESTXQ annotations are introduced with the annotation character <code>%</code>, followed by the declared rest prefixassigned to the RESTXQ namespace. These annotations define when a modules function will be invoked and which values will be bound to its arguments.A RESTXQ module may look as follows:
<pre class="brush:xquery">(:~ A simple module with REST-annotations :)
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu