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
|
FileInfo |
createFile(FileInfo parentNodeInfo,
String path) |
static String |
decodeURL(String s) |
String |
determineSiteId(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() |
MimetypeService |
getMimetypeService() |
org.alfresco.service.namespace.NamespaceService |
getNamespaceService() |
FileInfo |
getNodeForPath(NodeRef rootNodeRef,
String path)
Get the file info for the given paths
|
NodeService |
getNodeService() |
org.xml.sax.helpers.AttributesImpl |
getNullAttributes() |
FileInfo |
getParentNodeForPath(NodeRef rootNodeRef,
String path) |
String |
getPathFromNode(NodeRef rootNodeRef,
NodeRef nodeRef)
Return the relative path for the node walking back to the specified root node
|
PermissionService |
getPermissionService() |
BehaviourFilter |
getPolicyBehaviourFilter() |
String |
getRepositoryPath(javax.servlet.http.HttpServletRequest request) |
SearchService |
getSearchService() |
ServiceRegistry |
getServiceRegistry() |
long |
getSizeLimit() |
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(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
|
void |
setActionService(ActionService actionService) |
void |
setAuthenticationService(AuthenticationService authService) |
void |
setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService) |
void |
setFileFolderService(FileFolderService fileFolderService) |
void |
setHiddenAspect(HiddenAspect hiddenAspect) |
void |
setLockService(WebDAVLockService lockService) |
void |
setMimetypeService(MimetypeService mimetypeService) |
void |
setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService) |
void |
setNodeService(NodeService nodeService) |
void |
setPermissionService(PermissionService permissionService) |
void |
setPolicyBehaviourFilter(BehaviourFilter behaviourFilter) |
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(SearchService searchService) |
void |
setServiceRegistry(ServiceRegistry serviceRegistry) |
void |
setSizeLimitString(String limit)
This method sets a value for the limit.
|
void |
setTenantService(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 NodeService getNodeService()
public FileFolderService getFileFolderService()
public final SearchService getSearchService()
public final org.alfresco.service.namespace.NamespaceService getNamespaceService()
public final org.alfresco.service.cmr.dictionary.DictionaryService getDictionaryService()
public final MimetypeService getMimetypeService()
public WebDAVLockService getLockService()
public final ActionService getActionService()
public final PermissionService getPermissionService()
public final HiddenAspect getHiddenAspect()
public TenantService getTenantService()
TenantService held by the helper.public final CopyService getCopyService()
public void setTenantService(TenantService tenantService)
public void setServiceRegistry(ServiceRegistry serviceRegistry)
serviceRegistry - the service registrypublic void setNodeService(NodeService nodeService)
nodeService - the node servicepublic void setFileFolderService(FileFolderService fileFolderService)
fileFolderService - the fileFolder servicepublic void setSearchService(SearchService searchService)
searchService - the search servicepublic void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
namespaceService - the namespace servicepublic void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
dictionaryService - the dictionary servicepublic void setMimetypeService(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(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(javax.servlet.http.HttpServletRequest request, String path, boolean isCollection)
public String getURLForPath(javax.servlet.http.HttpServletRequest request, String path, boolean isCollection, String userAgent)
public FileInfo getNodeForPath(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(NodeRef rootNodeRef, String path) throws FileNotFoundException
FileNotFoundExceptionpublic final String getPathFromNode(NodeRef rootNodeRef, NodeRef nodeRef) throws FileNotFoundException
rootNodeRef - the root below which the path will be validnodeRef - the node's path to getFileNotFoundExceptionpublic FileInfo createFile(FileInfo parentNodeInfo, String path) throws WebDAVServerException
WebDAVServerExceptionpublic List<FileInfo> getChildren(FileInfo fileInfo) throws WebDAVServerException
WebDAVServerExceptionpublic final String makeETag(FileInfo nodeInfo)
public final String makeQuotedETag(FileInfo nodeInfo)
protected final void makeETagString(FileInfo nodeInfo, StringBuilder etag)
public final org.xml.sax.helpers.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 - UnsupportedEncodingExceptionpublic String determineSiteId(WebDAVMethod method)
@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 - StringWebDAVServerExceptionpublic void setUrlPathPrefix(String urlPathPrefix)
public String getUrlPathPrefix(javax.servlet.http.HttpServletRequest request)
public String getRepositoryPath(javax.servlet.http.HttpServletRequest request)
public boolean isLockedAndReadOnly(NodeRef nodeRef)
nodeRef - the node referenceLockService#isLockedAndReadOnly(NodeRef)Copyright © 2005–2014 Alfresco Software. All rights reserved.