multibyte content fixes for forms ui.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5084 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2007-02-08 23:06:25 +00:00
parent 328f998c6c
commit b3569e440a
5 changed files with 78 additions and 60 deletions

View File

@@ -42,32 +42,34 @@ public class AjaxServlet extends BaseServlet
/**
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
protected void service(HttpServletRequest request, HttpServletResponse response)
protected void service(final HttpServletRequest request,
final HttpServletResponse response)
throws ServletException, IOException
{
request.setCharacterEncoding("utf-8");
long startTime = 0;
String uri = request.getRequestURI();
if (logger.isDebugEnabled())
{
final String queryString = request.getQueryString();
logger.debug("Processing URL: " + uri +
((queryString != null && queryString.length() > 0) ? ("?" + queryString) : ""));
}
// dump the request headers
if (headersLogger.isDebugEnabled())
{
final Enumeration headers = request.getHeaderNames();
while (headers.hasMoreElements())
{
final String name = (String)headers.nextElement();
headersLogger.debug(name + ": " + request.getHeader(name));
}
}
try
{
String uri = request.getRequestURI();
if (logger.isDebugEnabled())
{
String queryString = request.getQueryString();
logger.debug("Processing URL: " + uri +
((queryString != null && queryString.length() > 0) ? ("?" + queryString) : ""));
}
// dump the request headers
if (headersLogger.isDebugEnabled())
{
Enumeration headers = request.getHeaderNames();
while (headers.hasMoreElements())
{
String name = (String)headers.nextElement();
headersLogger.debug(name + ": " + request.getHeader(name));
}
}
// Make sure the user is authenticated, if not throw an error to return the
// 500 Internal Server Error code back to the client
@@ -86,12 +88,12 @@ public class AjaxServlet extends BaseServlet
throw new AlfrescoRuntimeException("Servlet URL did not contain all required args: " + uri);
}
// retrieve the command from the URL
String commandName = tokens[1];
final String commandName = tokens[1];
// retrieve the binding expression from the URL
String expression = tokens[2];
final String expression = tokens[2];
// setup the faces context
FacesContext facesContext = FacesHelper.getFacesContext(request, response, getServletContext());
final FacesContext facesContext = FacesHelper.getFacesContext(request, response, getServletContext());
// start a timer
if (perfLogger.isDebugEnabled())
@@ -124,8 +126,7 @@ public class AjaxServlet extends BaseServlet
// measure the time taken
if (perfLogger.isDebugEnabled())
{
long endTime = System.currentTimeMillis();
perfLogger.debug("Time to execute command: " + (endTime - startTime) + "ms");
perfLogger.debug("Time to execute command: " + (System.currentTimeMillis() - startTime) + "ms");
}
}
}

View File

@@ -467,7 +467,7 @@ public class CreateWebContentWizard extends BaseContentWizard
// put the content of the file into the AVM store
avmService.createFile(path,
fileName,
new ByteArrayInputStream((this.content == null ? "" : this.content).getBytes()));
new ByteArrayInputStream((this.content == null ? "" : this.content).getBytes("UTF-8")));
// remember the created path
this.createdPath = AVMNodeConverter.ExtendAVMPath(path, fileName);

View File

@@ -116,7 +116,7 @@ public class XMLUtil
throws SAXException,
IOException
{
return XMLUtil.parse(new ByteArrayInputStream(source.getBytes()));
return XMLUtil.parse(new ByteArrayInputStream(source.getBytes("UTF-8")));
}
/** utility function for parsing xml */
@@ -214,4 +214,4 @@ public class XMLUtil
}
};
}
}
}

View File

@@ -315,7 +315,7 @@ public class XFormsBean
final ChibaBean chibaBean = this.xformsSession.chibaBean;
if (chibaBean.getContainer().lookup(id) instanceof Upload)
{
chibaBean.updateControlValue(id, null, value, value.getBytes());
chibaBean.updateControlValue(id, null, value, value.getBytes("UTF-8"));
}
else
{