Merged BRANCHES/DEV/THOR1_SPRINTS to HEAD:

37459: THOR-1429: Webdav returns 500 when you don't have access to moderated site



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@37460 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2012-06-06 16:28:51 +00:00
parent 1225ac194e
commit 8bba69f6a8
2 changed files with 116 additions and 2 deletions

View File

@@ -90,6 +90,8 @@ public abstract class WebDAVMethod
{
// Log output
private static final String VERSION_NUM_PATTERN = "\\d+\\.\\d+(\\.\\d+)?";
protected static Log logger = LogFactory.getLog("org.alfresco.webdav.protocol");
// Output formatted XML in the response
@@ -102,7 +104,11 @@ public abstract class WebDAVMethod
private static final Map<String, Integer> accessDeniedStatusCodes = new LinkedHashMap<String, Integer>();
static
{
accessDeniedStatusCodes.put("(darwin)|(macintosh)", HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
accessDeniedStatusCodes.put("^WebDAVLib/" + VERSION_NUM_PATTERN + "$",
HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
accessDeniedStatusCodes.put("^WebDAVFS/" + VERSION_NUM_PATTERN + " \\(\\d+\\)\\s+Darwin/" +
VERSION_NUM_PATTERN + "\\s+\\(.*\\)$",
HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
accessDeniedStatusCodes.put(".*", HttpServletResponse.SC_FORBIDDEN);
}
@@ -1479,7 +1485,7 @@ public abstract class WebDAVMethod
{
if (m_request != null && m_request.getHeader(WebDAV.HEADER_USER_AGENT) != null)
{
String userAgent = m_request.getHeader(WebDAV.HEADER_USER_AGENT).toLowerCase();
String userAgent = m_request.getHeader(WebDAV.HEADER_USER_AGENT);
for (Entry<String, Integer> entry : accessDeniedStatusCodes.entrySet())
{