mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Webscript JSR-168 Portlet runtime fixes for webscript url generation client-side function and url argument decoding.
JSR-168 portlet webscripts now use different service url - /168service/... UI improvements to pop-up dialogs in portlets - now draggable and position now relative. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5912 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
package org.alfresco.web.scripts.portlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.portlet.ActionRequest;
|
||||
@@ -39,6 +41,7 @@ import javax.portlet.RenderRequest;
|
||||
import javax.portlet.RenderResponse;
|
||||
import javax.portlet.WindowState;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.web.scripts.DeclarativeWebScriptRegistry;
|
||||
@@ -154,7 +157,7 @@ public class WebScriptPortlet implements Portlet
|
||||
if (scriptUrl != null)
|
||||
{
|
||||
// build web script url from render request
|
||||
String scriptUrlArgs = "";
|
||||
StringBuilder scriptUrlArgs = new StringBuilder(128);
|
||||
Map<String, String[]> params = req.getParameterMap();
|
||||
for (Map.Entry<String, String[]> param : params.entrySet())
|
||||
{
|
||||
@@ -164,12 +167,22 @@ public class WebScriptPortlet implements Portlet
|
||||
String argName = name.substring("arg.".length());
|
||||
for (String argValue : param.getValue())
|
||||
{
|
||||
scriptUrlArgs += (scriptUrlArgs.length() == 0) ? "" : "&";
|
||||
scriptUrlArgs += argName + "=" + argValue;
|
||||
scriptUrlArgs.append((scriptUrlArgs.length() == 0) ? "" : "&");
|
||||
// decode url arg (as it would be if this was a servlet)
|
||||
try
|
||||
{
|
||||
scriptUrlArgs.append(argName).append("=")
|
||||
.append(URLDecoder.decode(argValue, "UTF-8"));
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Unable to decode UTF-8 url!", e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
scriptUrl += "?" + scriptUrlArgs;
|
||||
scriptUrl += (scriptUrlArgs.length() != 0 ? ("?" + scriptUrlArgs.toString()) : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -154,7 +154,7 @@ public class WebScriptPortletResponse implements WebScriptResponse
|
||||
" var args = url.substring(argsIndex + 1).split(\"&\");" +
|
||||
" for (var i=0; i<args.length; i++)" +
|
||||
" {" +
|
||||
" out += \"arg.\" + args[i];" +
|
||||
" out += \"&arg.\" + args[i];" +
|
||||
" }" +
|
||||
" }" +
|
||||
" return out; } }";
|
||||
|
Reference in New Issue
Block a user