From 76c566db6160a982edb41b7f16d6229f366b514a Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Tue, 16 May 2006 16:22:52 +0000 Subject: [PATCH] =?UTF-8?q?.=20Fixes=20to=20the=20various=20servlets=20to?= =?UTF-8?q?=20allow=20any=20number=20of=20elements=20in=20the=20web-app=20?= =?UTF-8?q?context=20path=20=20=20-=20currently=20anything=20other=20than?= =?UTF-8?q?=20exactly=201=20element=20(e.g.=20/alfresco)=20will=20fail=20?= =?UTF-8?q?=20=20-=20now=20correctly=20supports=20any=20length=20including?= =?UTF-8?q?=20the=20root=20context=20of=20"/"=20.=20Clipboard=20copy/move?= =?UTF-8?q?=20op=20correctly=20uses=20FileFolderService=20for=20folders=20?= =?UTF-8?q?(which=20means=20"Copy=20of=E2=80=A6"=20gets=20prepended=20corr?= =?UTF-8?q?ectly)=20.=20Added=20more=20explicit=20IDs=20for=20JbossPortal?= =?UTF-8?q?=20pages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2901 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/web/app/servlet/CommandServlet.java | 8 ++++---- .../web/app/servlet/DownloadContentServlet.java | 4 ++-- .../web/app/servlet/ExternalAccessServlet.java | 11 ++++++----- .../web/app/servlet/TemplateContentServlet.java | 14 ++++++++------ .../alfresco/web/bean/clipboard/ClipboardBean.java | 13 ++++++++----- source/web/jsp/browse/browse.jsp | 2 +- source/web/jsp/login.jsp | 2 +- 7 files changed, 30 insertions(+), 24 deletions(-) diff --git a/source/java/org/alfresco/web/app/servlet/CommandServlet.java b/source/java/org/alfresco/web/app/servlet/CommandServlet.java index 3b49327adc..5b7f918145 100644 --- a/source/java/org/alfresco/web/app/servlet/CommandServlet.java +++ b/source/java/org/alfresco/web/app/servlet/CommandServlet.java @@ -84,14 +84,14 @@ public class CommandServlet extends BaseServlet return; } + uri = uri.substring(req.getContextPath().length()); StringTokenizer t = new StringTokenizer(uri, "/"); int tokenCount = t.countTokens(); - if (tokenCount < 4) + if (tokenCount < 3) { throw new IllegalArgumentException("Command Servlet URL did not contain all required args: " + uri); } - t.nextToken(); // skip web app name t.nextToken(); // skip servlet name // get the command processor to execute the command e.g. "workflow" @@ -101,8 +101,8 @@ public class CommandServlet extends BaseServlet String command = t.nextToken(); // get any remaining uri elements to pass to the processor - String[] args = new String[tokenCount - 4]; - for (int i=0; i= 8) + if (tokenCount >= 7) { storeRef = new StoreRef(t.nextToken(), t.nextToken()); templateRef = new NodeRef(storeRef, t.nextToken()); @@ -165,7 +166,7 @@ public class TemplateContentServlet extends BaseServlet } // create the model - put the supplied noderef in as space/document as appropriate - Object model = getModel(serviceRegistry, req, res, nodeRef); + Object model = getModel(serviceRegistry, req.getSession(), req.getParameterMap(), nodeRef); // process the template against the node content directly to the response output stream // assuming the repo is capable of streaming in chunks, this should allow large files @@ -215,14 +216,15 @@ public class TemplateContentServlet extends BaseServlet * * @param services ServiceRegistry required for TemplateNode construction * @param session HttpSession for accessing current User + * @param paramMap Request parameter map * @param nodeRef NodeRef of the space/document to process template against * * @return an object model ready for executing template against */ - private Object getModel(ServiceRegistry services, HttpServletRequest req, HttpServletResponse res, NodeRef nodeRef) + private Object getModel(ServiceRegistry services, HttpSession session, Map paramMap, NodeRef nodeRef) { // build FreeMarker default model and merge - Map root = DefaultModelHelper.buildDefaultModel(services, Application.getCurrentUser(req.getSession())); + Map root = DefaultModelHelper.buildDefaultModel(services, Application.getCurrentUser(session)); // put the current NodeRef in as "space" and "document" TemplateNode node = new TemplateNode(nodeRef, services, this.imageResolver); diff --git a/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java b/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java index fe5bbe4163..cef45fff85 100644 --- a/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java +++ b/source/java/org/alfresco/web/bean/clipboard/ClipboardBean.java @@ -306,9 +306,10 @@ public class ClipboardBean if (logger.isDebugEnabled()) logger.debug("Attempting to copy node ID: " + item.Node.getId() + " into node ID: " + destRef.getId()); - if (dd.isSubClass(item.Node.getType(), ContentModel.TYPE_CONTENT)) + if (dd.isSubClass(item.Node.getType(), ContentModel.TYPE_CONTENT) || + dd.isSubClass(item.Node.getType(), ContentModel.TYPE_FOLDER)) { - // call the node ops service to initiate the copy + // copy the file/folder this.fileFolderService.copy( item.Node.getNodeRef(), destRef, @@ -316,6 +317,7 @@ public class ClipboardBean } else { + // copy the node this.copyService.copy( item.Node.getNodeRef(), destRef, @@ -330,13 +332,14 @@ public class ClipboardBean if (logger.isDebugEnabled()) logger.debug("Attempting to move node ID: " + item.Node.getId() + " into node ID: " + destRef.getId()); - if (dd.isSubClass(item.Node.getType(), ContentModel.TYPE_CONTENT)) + if (dd.isSubClass(item.Node.getType(), ContentModel.TYPE_CONTENT) || + dd.isSubClass(item.Node.getType(), ContentModel.TYPE_FOLDER)) { - // move the node + // move the file/folder this.fileFolderService.move( item.Node.getNodeRef(), destRef, - name); // TODO: could add "Copy of ..." here if move fails + name); } else { diff --git a/source/web/jsp/browse/browse.jsp b/source/web/jsp/browse/browse.jsp index 7915bc0164..3d0b6e7859 100644 --- a/source/web/jsp/browse/browse.jsp +++ b/source/web/jsp/browse/browse.jsp @@ -155,7 +155,7 @@ <%-- View mode settings --%> - diff --git a/source/web/jsp/login.jsp b/source/web/jsp/login.jsp index e5b1552ac5..c7f4e1209a 100644 --- a/source/web/jsp/login.jsp +++ b/source/web/jsp/login.jsp @@ -112,7 +112,7 @@ <%-- language selection drop-down --%> - +