mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
WebDAV: removed static WebDAV.getRepositoryPath() method. Only use the non-static version.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@39172 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -867,6 +867,62 @@ public class WebDAVHelper
|
||||
|
||||
public String getRepositoryPath(HttpServletRequest request)
|
||||
{
|
||||
return WebDAV.getRepositoryPath(request);
|
||||
// Try and get the path
|
||||
|
||||
String strPath = null;
|
||||
|
||||
try
|
||||
{
|
||||
strPath = WebDAVHelper.decodeURL(request.getRequestURI());
|
||||
}
|
||||
catch (Exception ex) {}
|
||||
|
||||
// Find the servlet path and trim from the request path
|
||||
|
||||
String servletPath = request.getServletPath();
|
||||
|
||||
int rootPos = strPath.indexOf(servletPath);
|
||||
if ( rootPos != -1)
|
||||
{
|
||||
strPath = strPath.substring( rootPos);
|
||||
}
|
||||
|
||||
// If we failed to get the path from the request try and get the path from the servlet path
|
||||
|
||||
if (strPath == null)
|
||||
{
|
||||
strPath = request.getServletPath();
|
||||
}
|
||||
|
||||
if (strPath == null || strPath.length() == 0)
|
||||
{
|
||||
// If we still have not got a path then default to the root directory
|
||||
strPath = RootPath;
|
||||
}
|
||||
else if (strPath.startsWith(request.getServletPath()))
|
||||
{
|
||||
// Check if the path starts with the base servlet path
|
||||
int len = request.getServletPath().length();
|
||||
|
||||
if (strPath.length() > len)
|
||||
{
|
||||
strPath = strPath.substring(len);
|
||||
}
|
||||
else
|
||||
{
|
||||
strPath = RootPath;
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure there are no trailing slashes
|
||||
|
||||
if (strPath.length() > 1 && strPath.endsWith(DIR_SEPARATOR))
|
||||
{
|
||||
strPath = strPath.substring(0, strPath.length() - 1);
|
||||
}
|
||||
|
||||
// Return the path
|
||||
|
||||
return strPath;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user