org.exist.http
Class RESTServer

java.lang.Object
  extended by org.exist.http.RESTServer

public class RESTServer
extends Object

Author:
wolf, ljo, adam, gev

Constructor Summary
RESTServer(BrokerPool pool, String formEncoding, String containerEncoding, boolean useDynamicContentType)
           
 
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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RESTServer

public RESTServer(BrokerPool pool,
                  String formEncoding,
                  String containerEncoding,
                  boolean useDynamicContentType)
Method Detail

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:

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 content
path - The path to which the file should be stored
request -
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.