public abstract class JcrRemotingServlet extends JCRWebdavServerServlet
JcrRemotingServlet
is an extended version of the
JCR Remoting Servlet
that provides improved
functionality and supports cross workspace copy and cloning.
Batch read is triggered by adding a '.json' extension to the resource href. Optionally the client may explicitly specify the desired batch read depth by appending '.depth.json' extension. If no json extension is present the GET request is processed by the base servlet.
The JSON writer applies the following rules:
- Nodes are represented as JSON objects. - Each Node has its properties included as JSON key/value pairs. - Single valued Properties are simple key/value pairs. - Multi valued Properties are represented as JSON array. - Each Node has its child nodes included as long a maximal depths is not reached. - Nodes without any child nodes get a special JSON member named ::NodeIteratorSize, whose value is zero. - If the maximal depth is reached only name, index and unique id of the direct child are included (incomplete node info). In order to obtain the complete information the client sends another GET with .json extension.Same name sibling nodes and properties whose type cannot be unambiguously be extracted from the JSON on the client side need some special handling:
- Node with index > 1, get a JSON key consisting of Node.getName() + "[" + Node.getIndex() + "]" - Binary Property JSON value = length of the JCR value. The JCR value must be retrieved separately. - Name, Path, Reference and Date Property The JSON member representing the Property (name, value) is preceded by a special member consisting of JSON key = ":" + Property.getName() JSON value = PropertyType.nameFromValue(Property.getType()) - Multi valued properties with Property.getValues().length == 0 will be treated as special property types above (extra property indicating the type of the property). - Double Property JSON value must not have any trailing ".0" removed.
Since Jackrabbit 2.3.6 it is also possible to request multiple subtrees in a single request. This is done by adding one or more ":include" parameters to a batch read request describe above. These extra parameters specify the (relative) paths of all the nodes to be included in the response. The response is a JSON object whose "nodes" property contains all the selected nodes keyed by path. Missing nodes are not included in the response. Each included node is serialized as defined above for batch read.
Example:
$ curl 'http://.../parent.json?:path=child1&:path=child2' {"nodes":{"/parent/child1":{...},"/parent/child2":{...}}}
diff ::= members members ::= pair | pairs pair ::= key " : " value pairs ::= pair line-end pair | pair line-end pairs line-end ::= "\r\n" | "\n" | "\r" key ::= diffchar path diffchar ::= "+" | "^" | "-" | ">" path ::= abspath | relpath abspath ::= * absolute path to an item * relpath ::= * relpath from item at request URI to an item * value ::= value+ | value- | value^ | value> value+ ::= * a JSON object * value- ::= "" value^ ::= * any JSON value except JSON object * value> ::= path | path "#before" | path "#after" | "#first" | "#last"In other words:
"+" addNode "^" setProperty / setValue / removeProperty "-" remove Item ">" move / reorder Nodes
Modifier and Type | Field and Description |
---|---|
static String |
ATTR_TMP_DIRECTORY
temp-dir attribute to be set to the servlet-context
|
static String |
INIT_PARAM_BATCHREAD_CONFIG
the 'temp-directory' init parameter
|
static String |
INIT_PARAM_HOME
the home init parameter.
|
static String |
INIT_PARAM_PROTECTED_HANDLERS_CONFIG
the 'protectedhandlers-config' init paramter.
|
static String |
INIT_PARAM_TMP_DIRECTORY
the 'temp-directory' init parameter
|
CTX_ATTR_RESOURCE_PATH_PREFIX, INIT_PARAM_CONCURRENCY_LEVEL, INIT_PARAM_RESOURCE_PATH_PREFIX, subscriptionMgr, txMgr
DEFAULT_AUTHENTICATE_HEADER, INIT_PARAM_AUTHENTICATE_HEADER, INIT_PARAM_CREATE_ABSOLUTE_URI, INIT_PARAM_CSRF_PROTECTION, INIT_PARAM_MISSING_AUTH_MAPPING
creationDateFormat, DEPTH_0, DEPTH_1, DEPTH_INFINITY, DEPTH_INFINITY_S, HEADER_AUTHORIZATION, HEADER_CONTENT_LANGUAGE, HEADER_CONTENT_LENGTH, HEADER_CONTENT_TYPE, HEADER_DAV, HEADER_DEPTH, HEADER_DESTINATION, HEADER_ETAG, HEADER_IF, HEADER_LAST_MODIFIED, HEADER_LOCK_TOKEN, HEADER_OVERWRITE, HEADER_TIMEOUT, INFINITE_TIMEOUT, modificationDateFormat, NAMESPACE, OPAQUE_LOCK_TOKEN_PREFIX, PROPERTY_CREATIONDATE, PROPERTY_DISPLAYNAME, PROPERTY_GETCONTENTLANGUAGE, PROPERTY_GETCONTENTLENGTH, PROPERTY_GETCONTENTTYPE, PROPERTY_GETETAG, PROPERTY_GETLASTMODIFIED, PROPERTY_LOCKDISCOVERY, PROPERTY_RESOURCETYPE, PROPERTY_SOURCE, PROPERTY_SUPPORTEDLOCK, PROPFIND_ALL_PROP, PROPFIND_ALL_PROP_INCLUDE, PROPFIND_BY_PROPERTY, PROPFIND_PROPERTY_NAMES, TIMEOUT_INFINITE, UNDEFINED_TIME, UNDEFINED_TIMEOUT, XML_ACTIVELOCK, XML_ALLPROP, XML_COLLECTION, XML_DEPTH, XML_DST, XML_EXCLUSIVE, XML_HREF, XML_INCLUDE, XML_KEEPALIVE, XML_LINK, XML_LOCKENTRY, XML_LOCKINFO, XML_LOCKROOT, XML_LOCKSCOPE, XML_LOCKTOKEN, XML_LOCKTYPE, XML_MULTISTATUS, XML_OMIT, XML_OWNER, XML_PROP, XML_PROPERTYBEHAVIOR, XML_PROPERTYUPDATE, XML_PROPFIND, XML_PROPNAME, XML_PROPSTAT, XML_REMOVE, XML_RESPONSE, XML_RESPONSEDESCRIPTION, XML_SET, XML_SHARED, XML_SOURCE, XML_STATUS, XML_TIMEOUT, XML_WRITE
Constructor and Description |
---|
JcrRemotingServlet() |
Modifier and Type | Method and Description |
---|---|
protected void |
doGet(WebdavRequest webdavRequest,
WebdavResponse webdavResponse,
DavResource davResource)
The GET method
|
protected void |
doPost(WebdavRequest webdavRequest,
WebdavResponse webdavResponse,
DavResource davResource)
The POST method.
|
DavResourceFactory |
getResourceFactory()
Returns the
DavResourceFactory . |
protected String |
getResourcePathPrefix() |
void |
init()
Initializes the servlet set reads the following parameter from the
servlet configuration:
resource-path-prefix: optional prefix for all resources.
|
getCredentialsProvider, getDavSessionProvider, getLocatorFactory, getPathPrefix, getRepository, getSessionProvider, isPreconditionValid, setDavSessionProvider, setLocatorFactory, setResourceFactory, validateDestination
doAcl, doBaselineControl, doBind, doCheckin, doCheckout, doCopy, doDelete, doHead, doLabel, doLock, doMerge, doMkActivity, doMkCol, doMkWorkspace, doMove, doOptions, doOrderPatch, doPoll, doPropFind, doPropPatch, doPut, doRebind, doReport, doSearch, doSubscribe, doUnbind, doUncheckout, doUnlock, doUnsubscribe, doUpdate, doVersionControl, execute, getAuthenticateHeaderValue, getContentCodings, getInputContext, getOutputContext, getSingletonField, isCreateAbsoluteURI, sendUnauthorized, service
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
public static final String INIT_PARAM_HOME
public static final String INIT_PARAM_TMP_DIRECTORY
public static final String ATTR_TMP_DIRECTORY
public static final String INIT_PARAM_BATCHREAD_CONFIG
public static final String INIT_PARAM_PROTECTED_HANDLERS_CONFIG
public void init() throws javax.servlet.ServletException
JCRWebdavServerServlet
init
in class JCRWebdavServerServlet
javax.servlet.ServletException
protected String getResourcePathPrefix()
public DavResourceFactory getResourceFactory()
JCRWebdavServerServlet
DavResourceFactory
.getResourceFactory
in class JCRWebdavServerServlet
AbstractWebdavServlet.getResourceFactory()
protected void doGet(WebdavRequest webdavRequest, WebdavResponse webdavResponse, DavResource davResource) throws IOException, DavException
AbstractWebdavServlet
doGet
in class AbstractWebdavServlet
IOException
DavException
protected void doPost(WebdavRequest webdavRequest, WebdavResponse webdavResponse, DavResource davResource) throws IOException, DavException
AbstractWebdavServlet
doPost
in class AbstractWebdavServlet
IOException
DavException
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.