Merged V2.1 to HEAD

6386: Fix for AR-1649
   6387: Fix for AR-1645
   6388: Updated Polish messages
   6389: Updated security providers
   6392: Add support to log in as guest with any password (if guest is allowed)
   6393: AR-1562 : Cannot directly exit/disable Alfresco JavaScript Debugger window
   6394: Allow creation of PropertyValue persisted properties without knowing the type QName
   6397: Log Serializable properties don't cause infinte waits
   6398: Build fix and tidy up for authentication chaining
            Resolved conflicted state of 'root\projects\repository\source\java\org\alfresco\repo\security\authentication\AuthenticationUtil.java'
   6402: AR-1643 Web Script args object does not handle multi-value arguments
   6407: Removed use of QName "{}silly" as a data type definition.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6728 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-10 15:41:43 +00:00
parent af8a90ab45
commit 4196f83edb
5 changed files with 131 additions and 9 deletions

View File

@@ -24,7 +24,9 @@
*/
package org.alfresco.web.scripts;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -43,6 +45,7 @@ public abstract class WebScriptURLRequest extends WebScriptRequestImpl
protected String pathInfo;
protected String queryString;
protected Map<String, String> queryArgs;
protected Map<String, List<String>> queryArgsMulti;
/** Service bound to this request */
protected WebScriptMatch serviceMatch;
@@ -111,14 +114,27 @@ public abstract class WebScriptURLRequest extends WebScriptRequestImpl
this.pathInfo = scriptUrlParts[2];
this.queryString = scriptUrlParts[3];
this.queryArgs = new HashMap<String, String>();
this.queryArgsMulti = new HashMap<String, List<String>>();
if (this.queryString != null)
{
String[] args = this.queryString.split("&");
for (String arg : args)
{
String[] parts = arg.split("=");
// TODO: Handle multi-value parameters
this.queryArgs.put(parts[0], parts.length == 2 ? parts[1] : "");
if (this.queryArgs.containsKey(parts[0]))
{
List<String> values = this.queryArgsMulti.get(parts[0]);
if (values == null)
{
values = new ArrayList<String>();
this.queryArgsMulti.put(parts[0], values);
}
values.add(parts.length == 2 ? parts[1] : "");
}
else
{
this.queryArgs.put(parts[0], parts.length == 2 ? parts[1] : "");
}
}
}
this.serviceMatch = serviceMatch;
@@ -198,4 +214,28 @@ public abstract class WebScriptURLRequest extends WebScriptRequestImpl
{
return queryArgs.get(name);
}
/* (non-Javadoc)
* @see org.alfresco.web.scripts.WebScriptRequest#getArrayParameter(java.lang.String)
*/
public String[] getParameterValues(String name)
{
List<String> values = queryArgsMulti.get(name);
if (values != null)
{
String[] array = new String[values.size()];
values.toArray(array);
return array;
}
else
{
String value = queryArgs.get(name);
if (value != null)
{
return new String[]{value};
}
}
return null;
}
}