public abstract class WebDAVMethod extends Object
Modifier and Type | Class and Description |
---|---|
protected class |
WebDAVMethod.Condition
Class used for storing conditions which comes with "If" header of the request
|
Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.logging.Log |
logger |
protected Map<org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.cmr.repository.NodeRef> |
m_childToParent |
protected LinkedList<WebDAVMethod.Condition> |
m_conditions |
protected WebDAVHelper |
m_davHelper |
protected int |
m_depth |
protected Map<org.alfresco.service.cmr.repository.NodeRef,LockInfo> |
m_parentLockInfo |
protected HttpServletRequest |
m_request |
protected String |
m_resourceTag |
protected HttpServletResponse |
m_response |
protected org.alfresco.service.cmr.repository.NodeRef |
m_rootNodeRef |
protected String |
m_strPath |
protected String |
m_userAgent |
Constructor and Description |
---|
WebDAVMethod()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
protected LockInfo |
checkNode(FileInfo fileInfo)
Checks if write operation can be performed on node.
|
protected LockInfo |
checkNode(FileInfo fileInfo,
boolean ignoreShared,
boolean lockMethod)
Checks if write operation can be performed on node.
|
protected org.dom4j.io.XMLWriter |
createXMLWriter()
Create an XML writer for the response
|
void |
execute()
Executes the method, wrapping the call to
executeImpl() in an appropriate transaction
and handling the error conditions. |
protected abstract void |
executeImpl()
Access the content repository to satisfy the request and generates the appropriate WebDAV
response.
|
protected void |
flushXML(org.dom4j.io.XMLWriter writer)
Flushes all XML written so far to the response
|
protected void |
generateLockDiscoveryXML(org.dom4j.io.XMLWriter xml,
FileInfo lockNodeInfo,
boolean emptyNamespace,
String scope,
String depth,
String lToken,
String owner,
Date expiryDate)
Generates the lock discovery XML response
|
protected void |
generateLockDiscoveryXML(org.dom4j.io.XMLWriter xml,
FileInfo lockNodeInfo,
LockInfo lockInfo)
Generates the lock discovery XML response
|
protected String |
generateNamespaceDeclarations(HashMap<String,String> nameSpaces)
Generates a list of namespace declarations for the response
|
protected void |
generateResponseImpl()
Does nothing unless overridden - for reasons of backwards compatibility.
|
protected ActionService |
getActionService()
Convenience method to return the action service
|
protected AuthenticationService |
getAuthenticationService()
Convenience method to return the authentication service
|
protected ContentService |
getContentService()
Convenience method to return the content service
|
protected String |
getContextPath() |
protected WebDAVHelper |
getDAVHelper()
Return the WebDAV protocol helper
|
protected WebDAVLockService |
getDAVLockService()
Retrieve the (WebDAV protocol-level) locking service.
|
int |
getDepth()
Return the property find depth
|
protected FileFolderService |
getFileFolderService() |
protected org.alfresco.service.cmr.repository.MimetypeService |
getMimetypeService()
Convenience method to return the mimetype service
|
protected org.alfresco.service.namespace.NamespaceService |
getNamespaceService()
Convenience method to return the namespace service
|
protected FileInfo |
getNodeForPath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
String path)
Get the file info for the given paths
|
protected LockInfo |
getNodeLockInfo(FileInfo nodeInfo)
Returns node Lock token in consideration of WebDav lock depth.
|
protected org.alfresco.service.cmr.repository.NodeService |
getNodeService()
Convenience method to return the node service
|
String |
getPath()
Return the relative path
|
protected org.alfresco.service.cmr.security.PermissionService |
getPermissionService()
Convenience method to return the permission service
|
protected Document |
getRequestBodyAsDocument()
Retrieves the request body as an XML document
|
protected org.alfresco.service.cmr.repository.NodeRef |
getRootNodeRef()
Return the root node
|
protected org.alfresco.service.cmr.search.SearchService |
getSearchService()
Convenience method to return the search service
|
protected ServiceRegistry |
getServiceRegistry()
Return the service registry
|
protected String |
getServletPath() |
protected String |
getSiteId()
Get the site ID (short-name) that the current request relates to.
|
protected int |
getStatusForAccessDeniedException()
Determines status code for AccessDeniedException based on client's HTTP headers.
|
protected String |
getTenantDomain()
Get the tenant domain for the current user and request.
|
protected TransactionService |
getTransactionService()
Convenience method to return the transaction service
|
protected String |
getURLForPath(HttpServletRequest request,
String path,
boolean isFolder)
Returns a URL that could be used to access the given path.
|
protected FileInfo |
getWorkingCopy(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Returns a working copy of node for current user.
|
protected org.dom4j.io.OutputFormat |
getXMLOutputFormat()
Returns the format required for an XML response.
|
protected boolean |
isReadOnly()
Override and return true if the method is a query method only.
|
protected void |
parseDepthHeader()
Parses "Depth" request header
|
protected void |
parseIfHeader()
Parses "If" header of the request.
|
protected abstract void |
parseRequestBody()
Parses the given request body represented as an XML document and sets any necessary context
ready for execution.
|
protected abstract void |
parseRequestHeaders()
Parses the HTTP headers of the request and sets any necessary context ready for execution.
|
void |
setDetails(HttpServletRequest req,
HttpServletResponse resp,
WebDAVHelper davHelper,
org.alfresco.service.cmr.repository.NodeRef rootNode)
Set the request/response details
|
protected boolean |
shouldFlushXMLWriter()
Determines whether the XMLWriter should be flushed when XML is flushed.
|
String |
toString() |
protected static org.apache.commons.logging.Log logger
protected HttpServletRequest m_request
protected HttpServletResponse m_response
protected WebDAVHelper m_davHelper
protected org.alfresco.service.cmr.repository.NodeRef m_rootNodeRef
protected String m_strPath
protected String m_userAgent
protected LinkedList<WebDAVMethod.Condition> m_conditions
protected String m_resourceTag
protected int m_depth
protected Map<org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.cmr.repository.NodeRef> m_childToParent
public void setDetails(HttpServletRequest req, HttpServletResponse resp, WebDAVHelper davHelper, org.alfresco.service.cmr.repository.NodeRef rootNode)
req
- HttpServletRequestresp
- HttpServletResponsedavHelper
- WebDAVHelperrootNode
- NodeRefprotected boolean isReadOnly()
public final int getDepth()
public void execute() throws WebDAVServerException
executeImpl()
in an appropriate transaction
and handling the error conditions.WebDAVServerException
protected abstract void executeImpl() throws WebDAVServerException, Exception
WebDAVServerException
- a general server exceptionException
- any unhandled exceptionprotected void generateResponseImpl() throws Exception
executeImpl()
method
and should NOT contain any code that writes to the response. Conversely response generation logic
should NOT contain any code relating to the desired effect of the WebDAV method (e.g. setting properties
on a node) and should be contained purely within this method.
Older methods, until refactored will not override this method, relying only on executeImpl()
.
Exception
protected abstract void parseRequestBody() throws WebDAVServerException
WebDAVServerException
protected abstract void parseRequestHeaders() throws WebDAVServerException
WebDAVServerException
protected Document getRequestBodyAsDocument() throws WebDAVServerException
WebDAVServerException
protected void parseDepthHeader() throws WebDAVServerException
WebDAVServerException
protected void parseIfHeader() throws WebDAVServerException
WebDAVServerException
protected final WebDAVHelper getDAVHelper()
protected final ServiceRegistry getServiceRegistry()
protected final TransactionService getTransactionService()
protected final org.alfresco.service.cmr.repository.NodeService getNodeService()
protected final org.alfresco.service.cmr.search.SearchService getSearchService()
protected final org.alfresco.service.namespace.NamespaceService getNamespaceService()
protected final FileFolderService getFileFolderService()
protected final ContentService getContentService()
protected final org.alfresco.service.cmr.repository.MimetypeService getMimetypeService()
protected final WebDAVLockService getDAVLockService()
protected final ActionService getActionService()
protected final org.alfresco.service.cmr.security.PermissionService getPermissionService()
protected final AuthenticationService getAuthenticationService()
protected final String getServletPath()
protected final String getContextPath()
protected final org.alfresco.service.cmr.repository.NodeRef getRootNodeRef()
public String getPath()
protected org.dom4j.io.OutputFormat getXMLOutputFormat()
protected final org.dom4j.io.XMLWriter createXMLWriter() throws IOException
IOException
protected void generateLockDiscoveryXML(org.dom4j.io.XMLWriter xml, FileInfo lockNodeInfo, LockInfo lockInfo) throws Exception
xml
- XMLWriterlockNodeInfo
- FileInfolockInfo
- LockInfoException
protected void generateLockDiscoveryXML(org.dom4j.io.XMLWriter xml, FileInfo lockNodeInfo, boolean emptyNamespace, String scope, String depth, String lToken, String owner, Date expiryDate) throws Exception
xml
- XMLWriterlockNodeInfo
- FileInfoemptyNamespace
- boolean True if namespace should be empty. Used to avoid bugs in WebDAV clients.scope
- String lock scopedepth
- String lock depthlToken
- String locktokenowner
- String lock ownerexpiryDate
- the date/time the lock should expireException
protected String generateNamespaceDeclarations(HashMap<String,String> nameSpaces)
protected LockInfo checkNode(FileInfo fileInfo, boolean ignoreShared, boolean lockMethod) throws WebDAVServerException
fileInfo
- - node's file infoignoreShared
- - if true ignores shared lockslockMethod
- - must be true if used from lock methodWebDAVServerException
- if node has shared or exclusive lock
or If header preconditions failedprotected LockInfo checkNode(FileInfo fileInfo) throws WebDAVServerException
fileInfo
- FileInfoWebDAVServerException
- if node has shared or exclusive lock
or If header preconditions failedprotected LockInfo getNodeLockInfo(FileInfo nodeInfo)
nodeInfo
- FileInfoprotected FileInfo getNodeForPath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, String path) throws FileNotFoundException
rootNodeRef
- the acting webdav rootpath
- the path to search forFileNotFoundException
- if the path doesn't refer to a valid nodeprotected String getURLForPath(HttpServletRequest request, String path, boolean isFolder)
request
- HttpServletRequestpath
- the path to search forisFolder
- indicates file or folder is requestedprotected boolean shouldFlushXMLWriter()
true
if the XMLWriter should be flushed when XML is flushedprotected final void flushXML(org.dom4j.io.XMLWriter writer) throws IOException
writer
- XMLWriter that should be flushedIOException
protected FileInfo getWorkingCopy(org.alfresco.service.cmr.repository.NodeRef nodeRef)
nodeRef
- node referenceprotected int getStatusForAccessDeniedException()
protected String getSiteId()
DEFAULT_SITE_ID
if not specifically set.protected String getTenantDomain()
TenantService.DEFAULT_DOMAIN
if not specifically set.Copyright © 2005–2017 Alfresco Software. All rights reserved.