Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.exist.http
Class RESTServer

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

public class RESTServer
extends java.lang.Object

Author:
  wolf

Constructor Summary
`RESTServer(java.lang.String formEncoding, java.lang.String containerEncoding, boolean useDynamicContentType)`

Method Summary
`void` | `doDelete(DBBroker broker, XmldbURI path, javax.servlet.http.HttpServletResponse response)`
`void` | `doGet(DBBroker broker, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String path)` Handle GET request.
`void` | `doHead(DBBroker broker, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String path)`
`void` | `doPost(DBBroker broker, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String path)` Handles POST requests.
`void` | `doPut(DBBroker broker, java.io.File tempFile, XmldbURI path, javax.servlet.http.HttpServletRequest request, javax.servlet.http.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(java.lang.String formEncoding,
                      java.lang.String containerEncoding,
                      boolean useDynamicContentType)

Method Detail

### doGet

    public void doGet(DBBroker broker,
                      javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response,
                      java.lang.String path)
               throws BadRequestException,
                      PermissionDeniedException,
                      NotFoundException,
                      java.io.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`
    `java.io.IOException`

### doHead

    public void doHead(DBBroker broker,
                       javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response,
                       java.lang.String path)
                throws BadRequestException,
                       PermissionDeniedException,
                       NotFoundException,
                       java.io.IOException

  Throws:
    `BadRequestException`
    `PermissionDeniedException`
    `NotFoundException`
    `java.io.IOException`

### doPost

    public void doPost(DBBroker broker,
                       javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response,
                       java.lang.String path)
                throws BadRequestException,
                       PermissionDeniedException,
                       java.io.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`
    `java.io.IOException`

### doPut

    public void doPut(DBBroker broker,
                      java.io.File tempFile,
                      XmldbURI path,
                      javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws BadRequestException,
                      PermissionDeniedException,
                      java.io.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`
    `java.io.IOException`

### doDelete

    public void doDelete(DBBroker broker,
                         XmldbURI path,
                         javax.servlet.http.HttpServletResponse response)
                  throws PermissionDeniedException,
                         NotFoundException,
                         java.io.IOException

  Throws:
    `PermissionDeniedException`
    `NotFoundException`
    `java.io.IOException`

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Wolfgang Meier. All rights reserved.