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(HttpServletRequest request,
String urlStr)
Check that the destination path is on this server and is a valid WebDAV
path for this server
|
FileInfo |
createFile(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.
|
ActionService |
getActionService() |
AuthenticationService |
getAuthenticationService() |
List<FileInfo> |
getChildren(FileInfo fileInfo) |
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() |
FileFolderService |
getFileFolderService() |
HiddenAspect |
getHiddenAspect() |
WebDAVLockService |
getLockService() |
org.alfresco.service.cmr.repository.MimetypeService |
getMimetypeService() |
org.alfresco.service.namespace.NamespaceService |
getNamespaceService() |
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() |
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() |
BehaviourFilter |
getPolicyBehaviourFilter() |
String |
getRepositoryPath(HttpServletRequest request) |
org.alfresco.service.cmr.search.SearchService |
getSearchService() |
ServiceRegistry |
getServiceRegistry() |
long |
getSizeLimit() |
org.alfresco.repo.tenant.TenantService |
getTenantService()
Retrieve the
TenantService held by the helper. |
String |
getURLForPath(HttpServletRequest request,
String path,
boolean isCollection) |
String |
getURLForPath(HttpServletRequest request,
String path,
boolean isCollection,
String userAgent) |
String |
getUrlPathPrefix(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(FileInfo nodeInfo)
Make an ETag value for a node using the GUID and modify date/time
|
protected void |
makeETagString(FileInfo nodeInfo,
StringBuilder etag)
Make an ETag value for a node using the GUID and modify date/time
|
String |
makeQuotedETag(FileInfo nodeInfo)
Make an ETag value for a node using the GUID and modify date/time
|
protected void |
publishReadEvent(FileInfo realNodeInfo,
String mimetype,
Long size,
String contentEncoding,
String range)
Notifies listeners that a read has taken place
|
void |
setActionService(ActionService actionService) |
void |
setAuthenticationService(AuthenticationService authService) |
void |
setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService) |
void |
setEventPublisher(org.alfresco.repo.events.EventPublisher eventPublisher) |
void |
setFileFolderService(FileFolderService fileFolderService) |
void |
setHiddenAspect(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(BehaviourFilter behaviourFilter) |
void |
setPoster(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(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 AuthenticationService getAuthenticationService()
public ServiceRegistry getServiceRegistry()
public final org.alfresco.service.cmr.repository.NodeService getNodeService()
public 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 ActionService getActionService()
public final org.alfresco.service.cmr.security.PermissionService getPermissionService()
public final HiddenAspect getHiddenAspect()
public org.alfresco.repo.tenant.TenantService getTenantService()
TenantService
held by the helper.public final CopyService getCopyService()
public void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
public void setServiceRegistry(ServiceRegistry serviceRegistry)
serviceRegistry
- the service registrypublic void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
nodeService
- the node servicepublic void setFileFolderService(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.repo.events.EventPublisher eventPublisher)
eventPublisher
- the eventPublisher servicepublic void setPoster(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(ActionService actionService)
actionService
- the action servicepublic void setAuthenticationService(AuthenticationService authService)
authService
- the authentication servicepublic void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
permissionService
- the permission servicepublic void setHiddenAspect(HiddenAspect hiddenAspect)
hiddenAspect
- the hiddenAspect to setpublic BehaviourFilter getPolicyBehaviourFilter()
public void setPolicyBehaviourFilter(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(HttpServletRequest request, String path, boolean isCollection)
public String getURLForPath(HttpServletRequest request, String path, boolean isCollection, String userAgent)
public 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 nodepublic final FileInfo getParentNodeForPath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, String path) throws FileNotFoundException
FileNotFoundException
public final String getPathFromNode(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, org.alfresco.service.cmr.repository.NodeRef nodeRef) throws FileNotFoundException
rootNodeRef
- the root below which the path will be validnodeRef
- the node's path to getFileNotFoundException
public FileInfo createFile(FileInfo parentNodeInfo, String path) throws WebDAVServerException
WebDAVServerException
public List<FileInfo> getChildren(FileInfo fileInfo) throws WebDAVServerException
WebDAVServerException
public final String makeETag(FileInfo nodeInfo)
public final String makeQuotedETag(FileInfo nodeInfo)
protected final void makeETagString(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(HttpServletRequest request, String urlStr) throws WebDAVServerException
request
- The request made against the WebDAV server.urlStr
- StringWebDAVServerException
public void setUrlPathPrefix(String urlPathPrefix)
public String getUrlPathPrefix(HttpServletRequest request)
protected void publishReadEvent(FileInfo realNodeInfo, String mimetype, Long size, String contentEncoding, String range)
realNodeInfo
- FileInfomimetype
- Stringsize
- LongcontentEncoding
- Stringrange
- Stringpublic String getRepositoryPath(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–2017 Alfresco Software. All rights reserved.