mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.2 to HEAD
7534: Merged V2.1 to HEAD 7398: XPath metadata extractor selector handles malformed and empty XML files 7401: Fix AR-1879: JBPM Timer never fires 7413: Contribution: Integrity checker ignores exceptions that would normally trigger transaction retries. 7416: AR-1884.Unicode wildcard processing. 7417: Added filtering of pseudo files when a partial wildcard search path is used, such as '*.csv'. AR-1889. 7436: AR-1863: major version's can now be created via the web service API; 7451: Fix for handling of UTF-8 application/x-www-form-urlencoded encoded form arguments as raised in support ticket 242 7458: Fix for AR-1900 7520: Fix to Template API where content was not retrievable from custom d:content properties on a node git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8413 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
package org.alfresco.web.app.servlet;
|
package org.alfresco.web.app.servlet;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -38,6 +39,7 @@ import javax.transaction.UserTransaction;
|
|||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||||
import org.alfresco.service.ServiceRegistry;
|
import org.alfresco.service.ServiceRegistry;
|
||||||
import org.alfresco.service.cmr.repository.FileTypeImageSize;
|
import org.alfresco.service.cmr.repository.FileTypeImageSize;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -124,34 +126,56 @@ public abstract class BaseTemplateContentServlet extends BaseServlet
|
|||||||
NodeRef nodeRef = null;
|
NodeRef nodeRef = null;
|
||||||
NodeRef templateRef = null;
|
NodeRef templateRef = null;
|
||||||
|
|
||||||
String contentPath = req.getParameter(ARG_CONTEXT_PATH);
|
try
|
||||||
if (contentPath != null && contentPath.length() != 0)
|
|
||||||
{
|
{
|
||||||
// process the name based path to resolve the NodeRef
|
String contentPath = req.getParameter(ARG_CONTEXT_PATH);
|
||||||
PathRefInfo pathInfo = resolveNamePath(getServletContext(), contentPath);
|
if (contentPath != null && contentPath.length() != 0)
|
||||||
|
{
|
||||||
|
// process the name based path to resolve the NodeRef
|
||||||
|
PathRefInfo pathInfo = resolveNamePath(getServletContext(), contentPath);
|
||||||
|
|
||||||
|
nodeRef = pathInfo.NodeRef;
|
||||||
|
}
|
||||||
|
else if (tokenCount > 3)
|
||||||
|
{
|
||||||
|
// get NodeRef to the content from the URL elements
|
||||||
|
StoreRef storeRef = new StoreRef(t.nextToken(), t.nextToken());
|
||||||
|
nodeRef = new NodeRef(storeRef, t.nextToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
// get NodeRef to the template if supplied
|
||||||
|
String templatePath = req.getParameter(ARG_TEMPLATE_PATH);
|
||||||
|
if (templatePath != null && templatePath.length() != 0)
|
||||||
|
{
|
||||||
|
// process the name based path to resolve the NodeRef
|
||||||
|
PathRefInfo pathInfo = resolveNamePath(getServletContext(), templatePath);
|
||||||
|
|
||||||
|
templateRef = pathInfo.NodeRef;
|
||||||
|
}
|
||||||
|
else if (tokenCount >= 7)
|
||||||
|
{
|
||||||
|
StoreRef storeRef = new StoreRef(t.nextToken(), t.nextToken());
|
||||||
|
templateRef = new NodeRef(storeRef, t.nextToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (AccessDeniedException err)
|
||||||
|
{
|
||||||
|
if (redirectToLogin)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
logger.debug("Redirecting to login page...");
|
||||||
|
|
||||||
|
redirectToLoginPage(req, res, getServletContext());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
logger.debug("Returning 403 Forbidden error...");
|
||||||
|
|
||||||
|
res.sendError(HttpServletResponse.SC_FORBIDDEN);
|
||||||
|
}
|
||||||
|
|
||||||
nodeRef = pathInfo.NodeRef;
|
return;
|
||||||
}
|
|
||||||
else if (tokenCount > 3)
|
|
||||||
{
|
|
||||||
// get NodeRef to the content from the URL elements
|
|
||||||
StoreRef storeRef = new StoreRef(t.nextToken(), t.nextToken());
|
|
||||||
nodeRef = new NodeRef(storeRef, t.nextToken());
|
|
||||||
}
|
|
||||||
|
|
||||||
// get NodeRef to the template if supplied
|
|
||||||
String templatePath = req.getParameter(ARG_TEMPLATE_PATH);
|
|
||||||
if (templatePath != null && templatePath.length() != 0)
|
|
||||||
{
|
|
||||||
// process the name based path to resolve the NodeRef
|
|
||||||
PathRefInfo pathInfo = resolveNamePath(getServletContext(), templatePath);
|
|
||||||
|
|
||||||
templateRef = pathInfo.NodeRef;
|
|
||||||
}
|
|
||||||
else if (tokenCount >= 7)
|
|
||||||
{
|
|
||||||
StoreRef storeRef = new StoreRef(t.nextToken(), t.nextToken());
|
|
||||||
templateRef = new NodeRef(storeRef, t.nextToken());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no context is specified, use the template itself
|
// if no context is specified, use the template itself
|
||||||
@@ -293,7 +317,11 @@ public abstract class BaseTemplateContentServlet extends BaseServlet
|
|||||||
while (names.hasMoreElements())
|
while (names.hasMoreElements())
|
||||||
{
|
{
|
||||||
String name = (String)names.nextElement();
|
String name = (String)names.nextElement();
|
||||||
args.put(name, req.getParameter(name));
|
try
|
||||||
|
{
|
||||||
|
args.put(name, new String(req.getParameter(name).getBytes(), "UTF-8"));
|
||||||
|
}
|
||||||
|
catch (UnsupportedEncodingException err) {}
|
||||||
}
|
}
|
||||||
root.put("args", args);
|
root.put("args", args);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user