mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.2 to HEAD
7290: Merged V2.1 to V2.2 7252: Fix for AR-1829 7269: Fix for reopened bug AR-1829 - this time handles the fact that request character set is not set when non-JSF authenticator is used git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7292 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -26,6 +26,7 @@ package org.alfresco.web.scripts;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -33,6 +34,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.repo.jscript.Scopeable;
|
import org.alfresco.repo.jscript.Scopeable;
|
||||||
import org.alfresco.repo.jscript.ScriptNode;
|
import org.alfresco.repo.jscript.ScriptNode;
|
||||||
import org.alfresco.repo.jscript.ScriptNode.ScriptContent;
|
import org.alfresco.repo.jscript.ScriptNode.ScriptContent;
|
||||||
@@ -60,6 +62,8 @@ public class FormData implements Serializable, Scopeable
|
|||||||
private Map<String, FormField> fields = null;
|
private Map<String, FormField> fields = null;
|
||||||
private Map<String, String> parameters = null;
|
private Map<String, String> parameters = null;
|
||||||
private Map<String, ScriptContent> files = null;
|
private Map<String, ScriptContent> files = null;
|
||||||
|
private List<FileItem> files = null;
|
||||||
|
private String encoding = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct
|
* Construct
|
||||||
@@ -146,6 +150,8 @@ public class FormData implements Serializable, Scopeable
|
|||||||
{
|
{
|
||||||
FileItemFactory factory = new DiskFileItemFactory();
|
FileItemFactory factory = new DiskFileItemFactory();
|
||||||
upload = new ServletFileUpload(factory);
|
upload = new ServletFileUpload(factory);
|
||||||
|
encoding = req.getCharacterEncoding();
|
||||||
|
upload.setHeaderEncoding(encoding);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<FileItem> fileItems = upload.parseRequest(req);
|
List<FileItem> fileItems = upload.parseRequest(req);
|
||||||
@@ -262,7 +268,14 @@ public class FormData implements Serializable, Scopeable
|
|||||||
*/
|
*/
|
||||||
public String getValue()
|
public String getValue()
|
||||||
{
|
{
|
||||||
return file.getString();
|
try
|
||||||
|
{
|
||||||
|
return (file.isFormField() && encoding != null) ? file.getString(encoding) : file.getString();
|
||||||
|
}
|
||||||
|
catch (UnsupportedEncodingException e)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Unable to decode form field", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String jsGet_value()
|
public String jsGet_value()
|
||||||
|
@@ -104,7 +104,10 @@ public class WebScriptServlet extends HttpServlet
|
|||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("Processing request (" + req.getMethod() + ") " + req.getRequestURL() + (req.getQueryString() != null ? "?" + req.getQueryString() : ""));
|
logger.debug("Processing request (" + req.getMethod() + ") " + req.getRequestURL() + (req.getQueryString() != null ? "?" + req.getQueryString() : ""));
|
||||||
|
if (req.getCharacterEncoding() == null)
|
||||||
|
{
|
||||||
|
req.setCharacterEncoding("UTF-8");
|
||||||
|
}
|
||||||
WebScriptRuntime runtime = new WebScriptServletRuntime(registry, serviceRegistry, authenticator, req, res, serverConfig);
|
WebScriptRuntime runtime = new WebScriptServletRuntime(registry, serviceRegistry, authenticator, req, res, serverConfig);
|
||||||
runtime.executeScript();
|
runtime.executeScript();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user