Package org.alfresco.repo.webdav
Class WebDAVHelper
java.lang.Object
org.alfresco.repo.webdav.WebDAVHelper
WebDAV Protocol Helper Class
Provides helper methods for repository access using the WebDAV protocol.
- Author:
- GKSpencer
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckDestinationURL(jakarta.servlet.http.HttpServletRequest request, String urlStr) Check that the destination path is on this server and is a valid WebDAV path for this servercreateFile(FileInfo parentNodeInfo, String path) static final StringdetermineSiteId(WebDAVMethod method) determineSiteId(NodeRef rootNodeRef, String path) determineTenantDomain(WebDAVMethod method) Deprecated.static final StringencodeHTML(String string) Encodes the given string to valid HTML formatstatic final StringEncodes the given string to valid URL formatstatic final Stringstatic final StringencodeUrlReservedSymbols(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.final ActionServicefinal AuthenticationServicegetChildren(FileInfo fileInfo) final CopyServicegetDestinationPath(String contextPath, String servletPath, String destURL) Extract the destination path for MOVE or COPY commands from the supplied destination URL header.final org.alfresco.service.cmr.dictionary.DictionaryServicefinal HiddenAspectfinal MimetypeServicefinal org.alfresco.service.namespace.NamespaceServicegetNodeForPath(NodeRef rootNodeRef, String path) Get the file info for the given pathsfinal NodeServicefinal AttributesImplfinal FileInfogetParentNodeForPath(NodeRef rootNodeRef, String path) final StringgetPathFromNode(NodeRef rootNodeRef, NodeRef nodeRef) Return the relative path for the node walking back to the specified root nodefinal PermissionServicegetRepositoryPath(jakarta.servlet.http.HttpServletRequest request) final SearchServicelongRetrieve theTenantServiceheld by the helper.getURLForPath(jakarta.servlet.http.HttpServletRequest request, String path, boolean isCollection) getURLForPath(jakarta.servlet.http.HttpServletRequest request, String path, boolean isCollection, String userAgent) getUrlPathPrefix(jakarta.servlet.http.HttpServletRequest request) booleanisLockedAndReadOnly(NodeRef nodeRef) Indicates if the node is unlocked or the current user has a WRITE_LOCKbooleanisRenameShuffle(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.booleanisRootPath(String path, String servletPath) final StringMake an ETag value for a node using the GUID and modify date/timeprotected final voidmakeETagString(FileInfo nodeInfo, StringBuilder etag) Make an ETag value for a node using the GUID and modify date/timefinal StringmakeQuotedETag(FileInfo nodeInfo) Make an ETag value for a node using the GUID and modify date/timeprotected voidpublishReadEvent(FileInfo realNodeInfo, String mimetype, Long size, String contentEncoding, String range) Notifies listeners that a read has taken placevoidsetActionService(ActionService actionService) voidsetAuthenticationService(AuthenticationService authService) voidsetDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService) voidsetEventPublisher(org.alfresco.sync.repo.events.EventPublisher eventPublisher) voidsetFileFolderService(FileFolderService fileFolderService) voidsetHiddenAspect(HiddenAspect hiddenAspect) voidsetLockService(WebDAVLockService lockService) voidsetMimetypeService(MimetypeService mimetypeService) voidsetNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService) voidsetNodeService(NodeService nodeService) voidsetPermissionService(PermissionService permissionService) voidsetPolicyBehaviourFilter(BehaviourFilter behaviourFilter) voidsetPoster(ActivityPoster poster) voidsetRenameShufflePattern(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.voidsetSearchService(SearchService searchService) voidsetServiceRegistry(ServiceRegistry serviceRegistry) voidsetSizeLimitString(String limit) This method sets a value for the limit.voidsetTenantService(TenantService tenantService) voidsetUrlPathPrefix(String urlPathPrefix) splitAllPaths(String path) Split the path into all the component directories and filenamefinal String[]Split the path into seperate directory path and file name strings.
-
Field Details
-
BEAN_NAME
- See Also:
-
PathSeperator
- See Also:
-
PathSeperatorChar
public static final char PathSeperatorChar- See Also:
-
EMPTY_SITE_ID
- See Also:
-
logger
protected static org.apache.commons.logging.Log logger
-
-
Constructor Details
-
WebDAVHelper
public WebDAVHelper()
-
-
Method Details
-
setSizeLimitString
This method sets a value for the limit. If the string does notparseto a java long.- Parameters:
limit- a String representing a valid Java long.
-
setRenameShufflePattern
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. ALF-3856, ALF-7079, MNT-181- Parameters:
renameShufflePattern- a regular expression filename match
-
getSizeLimit
public long getSizeLimit()- Returns:
- Return the limit size
-
getAuthenticationService
- Returns:
- Return the authentication service
-
getServiceRegistry
- Returns:
- Return the service registry
-
getNodeService
- Returns:
- Return the node service
-
getFileFolderService
-
getSearchService
- Returns:
- Return the search service
-
getNamespaceService
public final org.alfresco.service.namespace.NamespaceService getNamespaceService()- Returns:
- Return the namespace service
-
getDictionaryService
public final org.alfresco.service.cmr.dictionary.DictionaryService getDictionaryService()- Returns:
- Return the dictionary service
-
getMimetypeService
- Returns:
- Return the mimetype service
-
getLockService
- Returns:
- Return the lock service
-
getActionService
- Returns:
- Return the action service
-
getPermissionService
- Returns:
- Return the permission service
-
getHiddenAspect
- Returns:
- the hidden aspect bean
-
getTenantService
Retrieve theTenantServiceheld by the helper.- Returns:
- TenantService
-
getCopyService
- Returns:
- Return the copy service
-
setTenantService
-
setServiceRegistry
- Parameters:
serviceRegistry- the service registry
-
setNodeService
- Parameters:
nodeService- the node service
-
setFileFolderService
- Parameters:
fileFolderService- the fileFolder service
-
setSearchService
- Parameters:
searchService- the search service
-
setNamespaceService
public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService) - Parameters:
namespaceService- the namespace service
-
setEventPublisher
public void setEventPublisher(org.alfresco.sync.repo.events.EventPublisher eventPublisher) - Parameters:
eventPublisher- the eventPublisher service
-
setPoster
- Parameters:
poster- ActivityPoster
-
setDictionaryService
public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService) - Parameters:
dictionaryService- the dictionary service
-
setMimetypeService
- Parameters:
mimetypeService- the mimetype service
-
setLockService
- Parameters:
lockService- the lock service
-
setActionService
- Parameters:
actionService- the action service
-
setAuthenticationService
- Parameters:
authService- the authentication service
-
setPermissionService
- Parameters:
permissionService- the permission service
-
setHiddenAspect
- Parameters:
hiddenAspect- the hiddenAspect to set
-
getPolicyBehaviourFilter
-
setPolicyBehaviourFilter
-
isRenameShuffle
Checks a new path in a move operation to detect whether clients are starting a renaming shuffle - common during file saving on various clients. ALF-3856, ALF-7079, MNT-181 -
splitPath
Split the path into seperate directory path and file name strings. If the path is not empty, then there will always be an entry for the filename- Parameters:
path- Full path string.- Returns:
- Returns a String[2] with the folder path and file path.
-
splitAllPaths
Split the path into all the component directories and filename- Parameters:
path- the string to split- Returns:
- an array of all the path components
-
getURLForPath
-
getURLForPath
-
getNodeForPath
Get the file info for the given paths- Parameters:
rootNodeRef- the acting webdav rootpath- the path to search for- Returns:
- Return the file info for the path
- Throws:
FileNotFoundException- if the path doesn't refer to a valid node
-
isRootPath
-
getParentNodeForPath
public final FileInfo getParentNodeForPath(NodeRef rootNodeRef, String path) throws FileNotFoundException - Throws:
FileNotFoundException
-
getPathFromNode
public final String getPathFromNode(NodeRef rootNodeRef, NodeRef nodeRef) throws FileNotFoundException Return the relative path for the node walking back to the specified root node- Parameters:
rootNodeRef- the root below which the path will be validnodeRef- the node's path to get- Returns:
- Returns string of form /A/B/C where C represents the from node and
- Throws:
FileNotFoundException
-
createFile
- Throws:
WebDAVServerException
-
getChildren
- Throws:
WebDAVServerException
-
makeETag
Make an ETag value for a node using the GUID and modify date/time -
makeQuotedETag
Make an ETag value for a node using the GUID and modify date/time -
makeETagString
Make an ETag value for a node using the GUID and modify date/time -
getNullAttributes
- Returns:
- Return the null XML attribute list
-
encodeURL
Encodes the given string to valid URL format- Parameters:
s- the String to convert
-
encodeURL
-
decodeURL
-
encodeHTML
Encodes the given string to valid HTML format- Parameters:
string- the String to convert
-
encodeUrlReservedSymbols
public static final String encodeUrlReservedSymbols(String string) throws UnsupportedEncodingException ALF-5333: Microsoft clients use ISO-8859-1 to decode WebDAV responses so this method should only be used for Microsoft user agents.- Parameters:
string- String- Returns:
- The encoded string for Microsoft clients
- Throws:
UnsupportedEncodingException
-
determineSiteId
-
determineSiteId
-
determineTenantDomain
Deprecated. -
determineTenantDomain
-
getDestinationPath
Extract the destination path for MOVE or COPY commands from the supplied destination URL header.- Parameters:
servletPath- Path prefix of the WebDAV servlet.destURL- The Destination header.- Returns:
- The path to move/copy the file to.
-
checkDestinationURL
public void checkDestinationURL(jakarta.servlet.http.HttpServletRequest request, String urlStr) throws WebDAVServerException Check that the destination path is on this server and is a valid WebDAV path for this server- Parameters:
request- The request made against the WebDAV server.urlStr- String- Throws:
WebDAVServerException
-
setUrlPathPrefix
-
getUrlPathPrefix
-
publishReadEvent
protected void publishReadEvent(FileInfo realNodeInfo, String mimetype, Long size, String contentEncoding, String range) Notifies listeners that a read has taken place- Parameters:
realNodeInfo- FileInfomimetype- Stringsize- LongcontentEncoding- Stringrange- String
-
getRepositoryPath
-
isLockedAndReadOnly
Indicates if the node is unlocked or the current user has a WRITE_LOCK- Parameters:
nodeRef- the node reference- See Also:
-