public class WebDAVHelper extends Object
Provides helper methods for repository access using the WebDAV protocol.
Modifier and Type | Field and Description |
---|---|
static String |
BEAN_NAME |
static String |
EMPTY_SITE_ID |
protected static org.apache.commons.logging.Log |
logger |
static String |
PathSeperator |
static char |
PathSeperatorChar |
Constructor and Description |
---|
WebDAVHelper() |
Modifier and Type | Method and Description |
---|---|
void |
checkDestinationURL(javax.servlet.http.HttpServletRequest request,
String urlStr)
Check that the destination path is on this server and is a valid WebDAV
path for this server
|
org.alfresco.service.cmr.model.FileInfo |
createFile(org.alfresco.service.cmr.model.FileInfo parentNodeInfo,
String path) |
static String |
decodeURL(String s) |
String |
determineSiteId(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
String path) |
String |
determineSiteId(WebDAVMethod method) |
String |
determineTenantDomain() |
String |
determineTenantDomain(WebDAVMethod method)
Deprecated.
|
static String |
encodeHTML(String string)
Encodes the given string to valid HTML format
|
static String |
encodeURL(String s)
Encodes the given string to valid URL format
|
static String |
encodeURL(String s,
String userAgent) |
static String |
encodeUrlReservedSymbols(String string)
ALF-5333: Microsoft clients use ISO-8859-1 to decode WebDAV responses
so this method should only be used for Microsoft user agents.
|
org.alfresco.service.cmr.action.ActionService |
getActionService() |
org.alfresco.service.cmr.security.AuthenticationService |
getAuthenticationService() |
List<org.alfresco.service.cmr.model.FileInfo> |
getChildren(org.alfresco.service.cmr.model.FileInfo fileInfo) |
org.alfresco.service.cmr.repository.CopyService |
getCopyService() |
String |
getDestinationPath(String contextPath,
String servletPath,
String destURL)
Extract the destination path for MOVE or COPY commands from the
supplied destination URL header.
|
org.alfresco.service.cmr.dictionary.DictionaryService |
getDictionaryService() |
org.alfresco.service.cmr.model.FileFolderService |
getFileFolderService() |
org.alfresco.repo.model.filefolder.HiddenAspect |
getHiddenAspect() |
WebDAVLockService |
getLockService() |
org.alfresco.service.cmr.repository.MimetypeService |
getMimetypeService() |
org.alfresco.service.namespace.NamespaceService |
getNamespaceService() |
org.alfresco.service.cmr.model.FileInfo |
getNodeForPath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
String path)
Get the file info for the given paths
|
org.alfresco.service.cmr.repository.NodeService |
getNodeService() |
AttributesImpl |
getNullAttributes() |
org.alfresco.service.cmr.model.FileInfo |
getParentNodeForPath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
String path) |
String |
getPathFromNode(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
org.alfresco.service.cmr.repository.NodeRef nodeRef)
Return the relative path for the node walking back to the specified root node
|
org.alfresco.service.cmr.security.PermissionService |
getPermissionService() |
org.alfresco.repo.policy.BehaviourFilter |
getPolicyBehaviourFilter() |
String |
getRepositoryPath(javax.servlet.http.HttpServletRequest request) |
org.alfresco.service.cmr.search.SearchService |
getSearchService() |
org.alfresco.service.ServiceRegistry |
getServiceRegistry() |
long |
getSizeLimit() |
org.alfresco.repo.tenant.TenantService |
getTenantService()
Retrieve the
TenantService held by the helper. |
String |
getURLForPath(javax.servlet.http.HttpServletRequest request,
String path,
boolean isCollection) |
String |
getURLForPath(javax.servlet.http.HttpServletRequest request,
String path,
boolean isCollection,
String userAgent) |
String |
getUrlPathPrefix(javax.servlet.http.HttpServletRequest request) |
boolean |
isLockedAndReadOnly(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Indicates if the node is unlocked or the current user has a WRITE_LOCK
|
boolean |
isRenameShuffle(String newPath)
Checks a new path in a move operation to detect whether clients are starting a renaming shuffle - common during
file saving on various clients.
|
boolean |
isRootPath(String path,
String servletPath) |
String |
makeETag(org.alfresco.service.cmr.model.FileInfo nodeInfo)
Make an ETag value for a node using the GUID and modify date/time
|
protected void |
makeETagString(org.alfresco.service.cmr.model.FileInfo nodeInfo,
StringBuilder etag)
Make an ETag value for a node using the GUID and modify date/time
|
String |
makeQuotedETag(org.alfresco.service.cmr.model.FileInfo nodeInfo)
Make an ETag value for a node using the GUID and modify date/time
|
protected void |
publishReadEvent(org.alfresco.service.cmr.model.FileInfo realNodeInfo,
String mimetype,
Long size,
String contentEncoding,
String range)
Notifies listeners that a read has taken place
|
void |
setActionService(org.alfresco.service.cmr.action.ActionService actionService) |
void |
setAuthenticationService(org.alfresco.service.cmr.security.AuthenticationService authService) |
void |
setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService) |
void |
setEventPublisher(org.alfresco.sync.repo.events.EventPublisher eventPublisher) |
void |
setFileFolderService(org.alfresco.service.cmr.model.FileFolderService fileFolderService) |
void |
setHiddenAspect(org.alfresco.repo.model.filefolder.HiddenAspect hiddenAspect) |
void |
setLockService(WebDAVLockService lockService) |
void |
setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService) |
void |
setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService) |
void |
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService) |
void |
setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService) |
void |
setPolicyBehaviourFilter(org.alfresco.repo.policy.BehaviourFilter behaviourFilter) |
void |
setPoster(org.alfresco.service.cmr.activities.ActivityPoster poster) |
void |
setRenameShufflePattern(Pattern renameShufflePattern)
Set the regular expression that will be applied to filenames during renames
to detect whether clients are performing a renaming shuffle - common during
file saving on various clients.
|
void |
setSearchService(org.alfresco.service.cmr.search.SearchService searchService) |
void |
setServiceRegistry(org.alfresco.service.ServiceRegistry serviceRegistry) |
void |
setSizeLimitString(String limit)
This method sets a value for the limit.
|
void |
setTenantService(org.alfresco.repo.tenant.TenantService tenantService) |
void |
setUrlPathPrefix(String urlPathPrefix) |
List<String> |
splitAllPaths(String path)
Split the path into all the component directories and filename
|
String[] |
splitPath(String path)
Split the path into seperate directory path and file name strings.
|
public static final String BEAN_NAME
public static final String PathSeperator
public static final char PathSeperatorChar
public static final String EMPTY_SITE_ID
protected static org.apache.commons.logging.Log logger
public void setSizeLimitString(String limit)
parse
to a
java long.limit
- a String representing a valid Java long.public void setRenameShufflePattern(Pattern renameShufflePattern)
renameShufflePattern
- a regular expression filename matchpublic long getSizeLimit()
public final org.alfresco.service.cmr.security.AuthenticationService getAuthenticationService()
public org.alfresco.service.ServiceRegistry getServiceRegistry()
public final org.alfresco.service.cmr.repository.NodeService getNodeService()
public org.alfresco.service.cmr.model.FileFolderService getFileFolderService()
public final org.alfresco.service.cmr.search.SearchService getSearchService()
public final org.alfresco.service.namespace.NamespaceService getNamespaceService()
public final org.alfresco.service.cmr.dictionary.DictionaryService getDictionaryService()
public final org.alfresco.service.cmr.repository.MimetypeService getMimetypeService()
public WebDAVLockService getLockService()
public final org.alfresco.service.cmr.action.ActionService getActionService()
public final org.alfresco.service.cmr.security.PermissionService getPermissionService()
public final org.alfresco.repo.model.filefolder.HiddenAspect getHiddenAspect()
public org.alfresco.repo.tenant.TenantService getTenantService()
TenantService
held by the helper.public final org.alfresco.service.cmr.repository.CopyService getCopyService()
public void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
public void setServiceRegistry(org.alfresco.service.ServiceRegistry serviceRegistry)
serviceRegistry
- the service registrypublic void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
nodeService
- the node servicepublic void setFileFolderService(org.alfresco.service.cmr.model.FileFolderService fileFolderService)
fileFolderService
- the fileFolder servicepublic void setSearchService(org.alfresco.service.cmr.search.SearchService searchService)
searchService
- the search servicepublic void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
namespaceService
- the namespace servicepublic void setEventPublisher(org.alfresco.sync.repo.events.EventPublisher eventPublisher)
eventPublisher
- the eventPublisher servicepublic void setPoster(org.alfresco.service.cmr.activities.ActivityPoster poster)
poster
- ActivityPosterpublic void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
dictionaryService
- the dictionary servicepublic void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
mimetypeService
- the mimetype servicepublic void setLockService(WebDAVLockService lockService)
lockService
- the lock servicepublic void setActionService(org.alfresco.service.cmr.action.ActionService actionService)
actionService
- the action servicepublic void setAuthenticationService(org.alfresco.service.cmr.security.AuthenticationService authService)
authService
- the authentication servicepublic void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
permissionService
- the permission servicepublic void setHiddenAspect(org.alfresco.repo.model.filefolder.HiddenAspect hiddenAspect)
hiddenAspect
- the hiddenAspect to setpublic org.alfresco.repo.policy.BehaviourFilter getPolicyBehaviourFilter()
public void setPolicyBehaviourFilter(org.alfresco.repo.policy.BehaviourFilter behaviourFilter)
public boolean isRenameShuffle(String newPath)
public final String[] splitPath(String path)
path
- Full path string.public List<String> splitAllPaths(String path)
path
- the string to splitpublic String getURLForPath(javax.servlet.http.HttpServletRequest request, String path, boolean isCollection)
public String getURLForPath(javax.servlet.http.HttpServletRequest request, String path, boolean isCollection, String userAgent)
public org.alfresco.service.cmr.model.FileInfo getNodeForPath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, String path) throws org.alfresco.service.cmr.model.FileNotFoundException
rootNodeRef
- the acting webdav rootpath
- the path to search fororg.alfresco.service.cmr.model.FileNotFoundException
- if the path doesn't refer to a valid nodepublic final org.alfresco.service.cmr.model.FileInfo getParentNodeForPath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, String path) throws org.alfresco.service.cmr.model.FileNotFoundException
org.alfresco.service.cmr.model.FileNotFoundException
public final String getPathFromNode(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, org.alfresco.service.cmr.repository.NodeRef nodeRef) throws org.alfresco.service.cmr.model.FileNotFoundException
rootNodeRef
- the root below which the path will be validnodeRef
- the node's path to getorg.alfresco.service.cmr.model.FileNotFoundException
public org.alfresco.service.cmr.model.FileInfo createFile(org.alfresco.service.cmr.model.FileInfo parentNodeInfo, String path) throws WebDAVServerException
WebDAVServerException
public List<org.alfresco.service.cmr.model.FileInfo> getChildren(org.alfresco.service.cmr.model.FileInfo fileInfo) throws WebDAVServerException
WebDAVServerException
public final String makeETag(org.alfresco.service.cmr.model.FileInfo nodeInfo)
public final String makeQuotedETag(org.alfresco.service.cmr.model.FileInfo nodeInfo)
protected final void makeETagString(org.alfresco.service.cmr.model.FileInfo nodeInfo, StringBuilder etag)
public final AttributesImpl getNullAttributes()
public static final String encodeURL(String s)
s
- the String to convertpublic static final String encodeHTML(String string)
string
- the String to convertpublic static final String encodeUrlReservedSymbols(String string) throws UnsupportedEncodingException
string
- StringUnsupportedEncodingException
public String determineSiteId(WebDAVMethod method)
public String determineSiteId(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, String path)
@Deprecated public String determineTenantDomain(WebDAVMethod method)
public String determineTenantDomain()
public String getDestinationPath(String contextPath, String servletPath, String destURL)
servletPath
- Path prefix of the WebDAV servlet.destURL
- The Destination header.public void checkDestinationURL(javax.servlet.http.HttpServletRequest request, String urlStr) throws WebDAVServerException
request
- The request made against the WebDAV server.urlStr
- StringWebDAVServerException
public void setUrlPathPrefix(String urlPathPrefix)
public String getUrlPathPrefix(javax.servlet.http.HttpServletRequest request)
protected void publishReadEvent(org.alfresco.service.cmr.model.FileInfo realNodeInfo, String mimetype, Long size, String contentEncoding, String range)
realNodeInfo
- FileInfomimetype
- Stringsize
- LongcontentEncoding
- Stringrange
- Stringpublic String getRepositoryPath(javax.servlet.http.HttpServletRequest request)
public boolean isLockedAndReadOnly(org.alfresco.service.cmr.repository.NodeRef nodeRef)
nodeRef
- the node referenceLockService.isLockedAndReadOnly(org.alfresco.service.cmr.repository.NodeRef)
Copyright © 2005–2018 Alfresco Software. All rights reserved.