chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Müller (JIRA) <j...@apache.org>
Subject [jira] [Commented] (CMIS-844) POSTHttpServletRequestWrapper should accommodate prior consumption of request body by a filter
Date Sat, 20 Sep 2014 22:35:33 GMT

    [ https://issues.apache.org/jira/browse/CMIS-844?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14142220#comment-14142220
] 

Florian Müller commented on CMIS-844:
-------------------------------------

This has been changed for a reason. Most servlet engines use ISO-8859-1 to decode the values.
Newer RFCs recommend UTF-8 and that makes a lot of sense for CMIS. For example, creating a
folder with a Chinese name requires a charset that has Chinese characters. ISO-8859-1 is too
limited. That’s why OpenCMIS does all the decoding and doesn't leave it to the servlet engine.

If you use request.getParameterMap() in filter, you are back to ISO-8859-1. The code change
that you have proposed would give you inconsistent results – depending on whether you have
called request.getParameterMap() in filter or not.

I’ll look into it, but I’m not sure that there is a good solution.

> POSTHttpServletRequestWrapper should accommodate prior consumption of request body by
a filter
> ----------------------------------------------------------------------------------------------
>
>                 Key: CMIS-844
>                 URL: https://issues.apache.org/jira/browse/CMIS-844
>             Project: Chemistry
>          Issue Type: Bug
>          Components: opencmis-server
>    Affects Versions: OpenCMIS 0.12.0
>            Reporter: Ron Gavlin
>            Assignee: Florian Müller
>
> POSTHttpServletRequestWrapper should accommodate prior consumption of the request body
by a filter.
> The 0.7.0 release provided this accommodation. This appears to have been broken by the
major post-0.7.0 refactoring.
> The following POSTHttpServletRequestWrapper constructor modification fixes the problem:
> {code}
> ...
>         if (isMultipart) {
> ...
>         } else {
>             // form data processing
>             StringBuilder sb = new StringBuilder();
>             InputStreamReader sr = new InputStreamReader(request.getInputStream(), IOUtils.UTF8);
>             char[] buffer = new char[4096];
>             int c = 0;
>             while ((c = sr.read(buffer)) > -1) {
>                 sb.append(buffer, 0, c);
>             }
>             if (sb.length() < 3) {
>                 @SuppressWarnings("unchecked")
>                 Map<String, String[]> parameterMap = request.getParameterMap();
>                 getParameterMap().putAll(parameterMap);
>             } else {
>                 parseFormData(sb.toString());
>             }
>         }
> ...
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message