org.exist.http
Class RESTServer
java.lang.Object
org.exist.http.RESTServer
public class RESTServer
- extends Object
- Author:
- wolf, ljo, adam, gev
Method Summary |
void |
doDelete(DBBroker broker,
XmldbURI path,
HttpServletResponse response)
|
void |
doGet(DBBroker broker,
HttpServletRequest request,
HttpServletResponse response,
String path)
Handle GET request. |
void |
doHead(DBBroker broker,
HttpServletRequest request,
HttpServletResponse response,
String path)
|
void |
doPost(DBBroker broker,
HttpServletRequest request,
HttpServletResponse response,
String path)
Handles POST requests. |
void |
doPut(DBBroker broker,
File tempFile,
XmldbURI path,
HttpServletRequest request,
HttpServletResponse response)
Handles PUT requests. |
RESTServer
public RESTServer(BrokerPool pool,
String formEncoding,
String containerEncoding,
boolean useDynamicContentType)
doGet
public void doGet(DBBroker broker,
HttpServletRequest request,
HttpServletResponse response,
String path)
throws BadRequestException,
PermissionDeniedException,
NotFoundException,
IOException
- Handle GET request. In the simplest case just returns the document or
binary resource specified in the path. If the path leads to a collection,
a listing of the collection contents is returned. If it resolves to a
binary resource with mime-type "application/xquery", this resource will
be loaded and executed by the XQuery engine.
The method also recognizes a number of predefined parameters:
- _xpath or _query: if specified, the given query is executed on the
current resource or collection.
- _howmany: defines how many items from the query result will be
returned.
- _start: a start offset into the result set.
- _wrap: if set to "yes", the query results will be wrapped into a
exist:result element.
- _indent: if set to "yes", the returned XML will be pretty-printed.
- _source: if set to "yes" and a resource with mime-type
"application/xquery" is requested then the xquery will not be executed,
instead the source of the document will be returned. Must be enabled in
descriptor.xml with the following syntax
- _xsl: an URI pointing to an XSL stylesheet that will be applied to
the returned XML.
- Parameters:
broker
- request
- response
- path
-
- Throws:
BadRequestException
PermissionDeniedException
NotFoundException
IOException
doHead
public void doHead(DBBroker broker,
HttpServletRequest request,
HttpServletResponse response,
String path)
throws BadRequestException,
PermissionDeniedException,
NotFoundException,
IOException
- Throws:
BadRequestException
PermissionDeniedException
NotFoundException
IOException
doPost
public void doPost(DBBroker broker,
HttpServletRequest request,
HttpServletResponse response,
String path)
throws BadRequestException,
PermissionDeniedException,
IOException
- Handles POST requests. If the path leads to a binary resource with
mime-type "application/xquery", that resource will be read and executed
by the XQuery engine. Otherwise, the request content is loaded and parsed
as XML. It may either contain an XUpdate or a query request.
- Parameters:
broker
- request
- response
- path
-
- Throws:
BadRequestException
PermissionDeniedException
IOException
doPut
public void doPut(DBBroker broker,
File tempFile,
XmldbURI path,
HttpServletRequest request,
HttpServletResponse response)
throws BadRequestException,
PermissionDeniedException,
IOException
- Handles PUT requests. The request content is stored as a new resource at
the specified location. If the resource already exists, it is overwritten
if the user has write permissions.
The resource type depends on the content type specified in the HTTP
header. The content type will be looked up in the global mime table. If
the corresponding mime type is not a know XML mime type, the resource
will be stored as a binary resource.
- Parameters:
broker
- tempFile
- The temp file from which the PUT will get its contentpath
- The path to which the file should be storedrequest
- response
-
- Throws:
BadRequestException
PermissionDeniedException
IOException
doDelete
public void doDelete(DBBroker broker,
XmldbURI path,
HttpServletResponse response)
throws PermissionDeniedException,
NotFoundException,
IOException
- Throws:
PermissionDeniedException
NotFoundException
IOException
Copyright (C) Wolfgang Meier. All rights reserved.