Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

108203: Merged 5.0.N (5.0.3) to HEAD-BUG-FIX (5.1/Cloud)
      108157: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.3)
         108115: Merged DEV to V4.2-BUG-FIX (4.2.5)
            107373 : MNT-13057 : Problem when using CMIS and with document names containing %
               - Updated some code, was added unit test.
            107742 : MNT-13057 : Problem when using CMIS and with document names containing %
               - Changed the logic that checks whether uri is cmis uri to be more specific.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@108219 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-07-14 07:02:53 +00:00
parent a58e05d267
commit 4bfbc7e5f9
2 changed files with 75 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2012 Alfresco Software Limited.
* Copyright (C) 2005-2015 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -18,6 +18,8 @@
*/
package org.alfresco.rest.api;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -31,6 +33,8 @@ import org.springframework.extensions.webscripts.servlet.ServletAuthenticatorFac
public class PublicApiTenantWebScriptServletRuntime extends TenantWebScriptServletRuntime
{
private static final Pattern CMIS_URI_PATTERN = Pattern.compile(".*/cmis/versions/[0-9]+\\.[0-9]+/.*");
public PublicApiTenantWebScriptServletRuntime(RuntimeContainer container, ServletAuthenticatorFactory authFactory, HttpServletRequest req,
HttpServletResponse res, ServerProperties serverProperties)
{
@@ -54,6 +58,11 @@ public class PublicApiTenantWebScriptServletRuntime extends TenantWebScriptServl
// NOTE: this is unlikely, and we'll take the hit if the path contains a semi-colon
pathInfo = req.getPathInfo();
}
// MNT-13057 fix, do not decode CMIS uris.
else if (CMIS_URI_PATTERN.matcher(requestURI).matches())
{
pathInfo = requestURI.substring(serviceContextPath.length());
}
else
{
pathInfo = URLDecoder.decode(requestURI.substring(serviceContextPath.length()));