Package org.apache.jackrabbit.webdav.jcr
Class JCRWebdavServerServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.apache.jackrabbit.webdav.server.AbstractWebdavServlet
-
- org.apache.jackrabbit.webdav.jcr.JCRWebdavServerServlet
-
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
,DavConstants
- Direct Known Subclasses:
JcrRemotingServlet
,JCRWebdavServerServlet
public abstract class JCRWebdavServerServlet extends AbstractWebdavServlet
JCRWebdavServerServlet provides request/response handling for the JCRWebdavServer.Implementations of this abstract class must implement the
getRepository()
method to access the repository.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
CTX_ATTR_RESOURCE_PATH_PREFIX
Servlet context attribute used to store the path prefix instead of having a static field with this servlet.static String
INIT_PARAM_CONCURRENCY_LEVEL
Optional 'concurrency-level' parameter defining the concurrency level within the jcr-server.static String
INIT_PARAM_RESOURCE_PATH_PREFIX
Init parameter specifying the prefix used with the resource path.protected SubscriptionManager
subscriptionMgr
protected TxLockManagerImpl
txMgr
-
Fields inherited from class org.apache.jackrabbit.webdav.server.AbstractWebdavServlet
DEFAULT_AUTHENTICATE_HEADER, INIT_PARAM_AUTHENTICATE_HEADER, INIT_PARAM_CREATE_ABSOLUTE_URI, INIT_PARAM_CSRF_PROTECTION, INIT_PARAM_MISSING_AUTH_MAPPING
-
Fields inherited from interface org.apache.jackrabbit.webdav.DavConstants
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 Summary
Constructors Constructor Description JCRWebdavServerServlet()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected CredentialsProvider
getCredentialsProvider()
Returns a new instanceofBasicCredentialsProvider
.DavSessionProvider
getDavSessionProvider()
Returns theDavSessionProvider
DavLocatorFactory
getLocatorFactory()
Returns theDavLocatorFactory
static String
getPathPrefix(javax.servlet.ServletContext ctx)
Returns the configured path prefixprotected abstract Repository
getRepository()
Returns the repository to be used by this servlet.DavResourceFactory
getResourceFactory()
Returns theDavResourceFactory
.protected SessionProvider
getSessionProvider()
Returns a new instanceofSessionProviderImpl
.void
init()
Initializes the servlet set reads the following parameter from the servlet configuration: resource-path-prefix: optional prefix for all resources.protected boolean
isPreconditionValid(WebdavRequest request, DavResource resource)
Returns true if the preconditions are met.void
setDavSessionProvider(DavSessionProvider davSessionProvider)
ThrowsUnsupportedOperationException
.void
setLocatorFactory(DavLocatorFactory locatorFactory)
Sets theDavLocatorFactory
void
setResourceFactory(DavResourceFactory resourceFactory)
Sets theDavResourceFactory
.protected int
validateDestination(DavResource destResource, WebdavRequest request, boolean checkHeader)
Modified variant needed for JCR move and copy that isn't compliant to WebDAV.-
Methods inherited from class org.apache.jackrabbit.webdav.server.AbstractWebdavServlet
doAcl, doBaselineControl, doBind, doCheckin, doCheckout, doCopy, doDelete, doGet, doHead, doLabel, doLock, doMerge, doMkActivity, doMkCol, doMkWorkspace, doMove, doOptions, doOrderPatch, doPoll, doPost, doPropFind, doPropPatch, doPut, doRebind, doReport, doSearch, doSubscribe, doUnbind, doUncheckout, doUnlock, doUnsubscribe, doUpdate, doVersionControl, execute, getAuthenticateHeaderValue, getContentCodings, getInputContext, getOutputContext, getSingletonField, isCreateAbsoluteURI, sendUnauthorized, service
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
-
-
-
-
Field Detail
-
INIT_PARAM_RESOURCE_PATH_PREFIX
public static final String INIT_PARAM_RESOURCE_PATH_PREFIX
Init parameter specifying the prefix used with the resource path.- See Also:
- Constant Field Values
-
INIT_PARAM_CONCURRENCY_LEVEL
public static final String INIT_PARAM_CONCURRENCY_LEVEL
Optional 'concurrency-level' parameter defining the concurrency level within the jcr-server. If the parameter is omitted the internal default value (50) is used.- See Also:
- Constant Field Values
-
CTX_ATTR_RESOURCE_PATH_PREFIX
public static final String CTX_ATTR_RESOURCE_PATH_PREFIX
Servlet context attribute used to store the path prefix instead of having a static field with this servlet. The latter causes problems when running multiple- See Also:
- Constant Field Values
-
txMgr
protected TxLockManagerImpl txMgr
-
subscriptionMgr
protected SubscriptionManager subscriptionMgr
-
-
Method Detail
-
init
public void init() throws javax.servlet.ServletException
Initializes the servlet set reads the following parameter from the servlet configuration:- resource-path-prefix: optional prefix for all resources.
- Overrides:
init
in classAbstractWebdavServlet
- Throws:
javax.servlet.ServletException
-
isPreconditionValid
protected boolean isPreconditionValid(WebdavRequest request, DavResource resource)
Returns true if the preconditions are met. This includes validation ofIf header
and validation ofTransactionId header
. This method will also return false if the requested resource resides within a different workspace as is assigned to the repository session attached to the given request.- Specified by:
isPreconditionValid
in classAbstractWebdavServlet
- Returns:
- See Also:
AbstractWebdavServlet.isPreconditionValid(WebdavRequest, DavResource)
-
getDavSessionProvider
public DavSessionProvider getDavSessionProvider()
Returns theDavSessionProvider
- Specified by:
getDavSessionProvider
in classAbstractWebdavServlet
- Returns:
- server
- See Also:
AbstractWebdavServlet.getDavSessionProvider()
-
setDavSessionProvider
public void setDavSessionProvider(DavSessionProvider davSessionProvider)
ThrowsUnsupportedOperationException
.- Specified by:
setDavSessionProvider
in classAbstractWebdavServlet
- See Also:
AbstractWebdavServlet.setDavSessionProvider(DavSessionProvider)
-
getLocatorFactory
public DavLocatorFactory getLocatorFactory()
Returns theDavLocatorFactory
- Specified by:
getLocatorFactory
in classAbstractWebdavServlet
- Returns:
- the locator factory
- See Also:
AbstractWebdavServlet.getLocatorFactory()
-
setLocatorFactory
public void setLocatorFactory(DavLocatorFactory locatorFactory)
Sets theDavLocatorFactory
- Specified by:
setLocatorFactory
in classAbstractWebdavServlet
- See Also:
AbstractWebdavServlet.setLocatorFactory(DavLocatorFactory)
-
getResourceFactory
public DavResourceFactory getResourceFactory()
Returns theDavResourceFactory
.- Specified by:
getResourceFactory
in classAbstractWebdavServlet
- Returns:
- the resource factory
- See Also:
AbstractWebdavServlet.getResourceFactory()
-
setResourceFactory
public void setResourceFactory(DavResourceFactory resourceFactory)
Sets theDavResourceFactory
.- Specified by:
setResourceFactory
in classAbstractWebdavServlet
- See Also:
AbstractWebdavServlet.setResourceFactory(org.apache.jackrabbit.webdav.DavResourceFactory)
-
validateDestination
protected int validateDestination(DavResource destResource, WebdavRequest request, boolean checkHeader) throws DavException
Modified variant needed for JCR move and copy that isn't compliant to WebDAV. The latter requires both methods to fail if the destination already exists and Overwrite is set to F (false); in JCR however this depends on the node type characteristics of the parent (SNSiblings allowed or not).- Overrides:
validateDestination
in classAbstractWebdavServlet
- Parameters:
destResource
- destination resource to be validated.request
- The webdav requestcheckHeader
- flag indicating if the destination header must be present.- Returns:
- status code indicating whether the destination is valid.
- Throws:
DavException
-
getPathPrefix
public static String getPathPrefix(javax.servlet.ServletContext ctx)
Returns the configured path prefix- Parameters:
ctx
- The servlet context.- Returns:
- resourcePathPrefix
- See Also:
INIT_PARAM_RESOURCE_PATH_PREFIX
-
getRepository
protected abstract Repository getRepository()
Returns the repository to be used by this servlet.- Returns:
- the JCR repository to be used by this servlet
-
getCredentialsProvider
protected CredentialsProvider getCredentialsProvider()
Returns a new instanceofBasicCredentialsProvider
.- Returns:
- a new credentials provider
-
getSessionProvider
protected SessionProvider getSessionProvider()
Returns a new instanceofSessionProviderImpl
.- Returns:
- a new session provider
-
-