org.alfresco.repo.webdav
Class WebDAVHelper

java.lang.Object
  extended by org.alfresco.repo.webdav.WebDAVHelper

public class WebDAVHelper
extends java.lang.Object

WebDAV Protocol Helper Class

Provides helper methods for repository access using the WebDAV protocol.


Field Summary
static java.lang.String PathSeperator
           
static char PathSeperatorChar
           
 
Constructor Summary
protected WebDAVHelper(org.alfresco.service.ServiceRegistry serviceRegistry, org.alfresco.service.cmr.security.AuthenticationService authService)
          Class constructor
 
Method Summary
static java.lang.String encodeHTML(java.lang.String string)
          Encodes the given string to valid HTML format
static java.lang.String encodeURL(java.lang.String s)
          Encodes the given string to valid URL format
static java.lang.String encodeURL(java.lang.String s, java.lang.String userAgent)
           
static java.lang.String encodeUrlReservedSymbols(java.lang.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()
           
 org.alfresco.service.cmr.repository.CopyService getCopyService()
           
 org.alfresco.service.cmr.dictionary.DictionaryService getDictionaryService()
           
 org.alfresco.service.cmr.model.FileFolderService getFileFolderService()
           
 org.alfresco.service.cmr.lock.LockService 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, java.lang.String path, java.lang.String servletPath)
          Get the file info for the given paths
 org.alfresco.service.cmr.repository.NodeService getNodeService()
           
 org.xml.sax.helpers.AttributesImpl getNullAttributes()
           
 org.alfresco.service.cmr.model.FileInfo getParentNodeForPath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, java.lang.String path, java.lang.String servletPath)
           
 java.lang.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.service.cmr.search.SearchService getSearchService()
           
 org.alfresco.service.ServiceRegistry getServiceRegistry()
           
 java.lang.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, java.lang.StringBuilder etag)
          Make an ETag value for a node using the GUID and modify date/time
 java.lang.String makeQuotedETag(org.alfresco.service.cmr.model.FileInfo nodeInfo)
          Make an ETag value for a node using the GUID and modify date/time
static java.lang.String replace(java.lang.String str, java.lang.String repl, java.lang.String with)
          Replace one string instance with another within the specified string
 java.util.List splitAllPaths(java.lang.String path)
          Split the path into all the component directories and filename
 java.lang.String[] splitPath(java.lang.String path)
          Split the path into seperate directory path and file name strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PathSeperator

public static final java.lang.String PathSeperator
See Also:
Constant Field Values

PathSeperatorChar

public static final char PathSeperatorChar
See Also:
Constant Field Values
Constructor Detail

WebDAVHelper

protected WebDAVHelper(org.alfresco.service.ServiceRegistry serviceRegistry,
                       org.alfresco.service.cmr.security.AuthenticationService authService)
Class constructor

Method Detail

getAuthenticationService

public final org.alfresco.service.cmr.security.AuthenticationService getAuthenticationService()
Returns:
Return the authentication service

getServiceRegistry

public final org.alfresco.service.ServiceRegistry getServiceRegistry()
Returns:
Return the service registry

getNodeService

public final org.alfresco.service.cmr.repository.NodeService getNodeService()
Returns:
Return the node service

getFileFolderService

public org.alfresco.service.cmr.model.FileFolderService getFileFolderService()

getSearchService

public final org.alfresco.service.cmr.search.SearchService 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

public final org.alfresco.service.cmr.repository.MimetypeService getMimetypeService()
Returns:
Return the mimetype service

getLockService

public final org.alfresco.service.cmr.lock.LockService getLockService()
Returns:
Return the lock service

getActionService

public final org.alfresco.service.cmr.action.ActionService getActionService()
Returns:
Return the action service

getPermissionService

public final org.alfresco.service.cmr.security.PermissionService getPermissionService()
Returns:
Return the permission service

getCopyService

public final org.alfresco.service.cmr.repository.CopyService getCopyService()
Returns:
Return the copy service

splitPath

public final java.lang.String[] splitPath(java.lang.String path)
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

public final java.util.List splitAllPaths(java.lang.String path)
Split the path into all the component directories and filename

Parameters:
path - the string to split
Returns:
an array of all the path components

getNodeForPath

public final org.alfresco.service.cmr.model.FileInfo getNodeForPath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
                                                                    java.lang.String path,
                                                                    java.lang.String servletPath)
                                                             throws org.alfresco.service.cmr.model.FileNotFoundException
Get the file info for the given paths

Parameters:
rootNodeRef - the acting webdav root
path - the path to search for
servletPath - the base servlet path, which may be null or empty
Returns:
Return the file info for the path
Throws:
org.alfresco.service.cmr.model.FileNotFoundException - if the path doesn't refer to a valid node

getParentNodeForPath

public final org.alfresco.service.cmr.model.FileInfo getParentNodeForPath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
                                                                          java.lang.String path,
                                                                          java.lang.String servletPath)
                                                                   throws org.alfresco.service.cmr.model.FileNotFoundException
Throws:
org.alfresco.service.cmr.model.FileNotFoundException

getPathFromNode

public final java.lang.String getPathFromNode(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
                                              org.alfresco.service.cmr.repository.NodeRef nodeRef)
                                       throws org.alfresco.service.cmr.model.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 valid
nodeRef - the node's path to get
Returns:
Returns string of form /A/B/C where C represents the from node and
Throws:
org.alfresco.service.cmr.model.FileNotFoundException

makeETag

public final java.lang.String makeETag(org.alfresco.service.cmr.model.FileInfo nodeInfo)
Make an ETag value for a node using the GUID and modify date/time


makeQuotedETag

public final java.lang.String makeQuotedETag(org.alfresco.service.cmr.model.FileInfo nodeInfo)
Make an ETag value for a node using the GUID and modify date/time


makeETagString

protected final void makeETagString(org.alfresco.service.cmr.model.FileInfo nodeInfo,
                                    java.lang.StringBuilder etag)
Make an ETag value for a node using the GUID and modify date/time


getNullAttributes

public final org.xml.sax.helpers.AttributesImpl getNullAttributes()
Returns:
Return the null XML attribute list

encodeURL

public static final java.lang.String encodeURL(java.lang.String s)
Encodes the given string to valid URL format

Parameters:
s - the String to convert

encodeURL

public static final java.lang.String encodeURL(java.lang.String s,
                                               java.lang.String userAgent)

replace

public static java.lang.String replace(java.lang.String str,
                                       java.lang.String repl,
                                       java.lang.String with)
Replace one string instance with another within the specified string

Returns:
Returns the replaced string

encodeHTML

public static final java.lang.String encodeHTML(java.lang.String string)
Encodes the given string to valid HTML format

Parameters:
string - the String to convert

encodeUrlReservedSymbols

public static final java.lang.String encodeUrlReservedSymbols(java.lang.String string)
                                                       throws java.io.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 -
Returns:
The encoded string for Microsoft clients
Throws:
java.io.UnsupportedEncodingException


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.