Return-Path: X-Original-To: apmail-chemistry-dev-archive@www.apache.org Delivered-To: apmail-chemistry-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E6FF5113E2 for ; Sun, 21 Sep 2014 20:39:33 +0000 (UTC) Received: (qmail 23927 invoked by uid 500); 21 Sep 2014 20:39:33 -0000 Delivered-To: apmail-chemistry-dev-archive@chemistry.apache.org Received: (qmail 23860 invoked by uid 500); 21 Sep 2014 20:39:33 -0000 Mailing-List: contact dev-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list dev@chemistry.apache.org Received: (qmail 23849 invoked by uid 99); 21 Sep 2014 20:39:33 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Sep 2014 20:39:33 +0000 Date: Sun, 21 Sep 2014 20:39:33 +0000 (UTC) From: "Ron Gavlin (JIRA)" To: dev@chemistry.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CMIS-844) POSTHttpServletRequestWrapper should accommodate prior consumption of request body by a filter MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CMIS-844?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D141426= 83#comment-14142683 ]=20 Ron Gavlin commented on CMIS-844: --------------------------------- My patch only addresses the case where the POST request inputStream has alr= eady been consumed by a prior filter. In this case, its the prior filter's = responsibility to decode the inputStream values correctly using UTF-8 and p= opulate the parameterMap accordingly. This is outside the scope of the POST= HttpServletRequestWrapper. My patch proposes that the POSTHttpServletRequestWrapper accommodate correc= tly behaving filters. I think my patch does no harm when the inputStream ha= s not already been consumed and delivers useful functionality when the inpu= tStream has been consumed. Specifically, it provides useful backwards compa= tibility with the prior 0.7.0 release. Thoughts? > POSTHttpServletRequestWrapper should accommodate prior consumption of req= uest 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=C3=BCller > > 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 fixe= s the problem: > {code} > ... > if (isMultipart) { > ... > } else { > // form data processing > StringBuilder sb =3D new StringBuilder(); > InputStreamReader sr =3D new InputStreamReader(request.getInp= utStream(), IOUtils.UTF8); > char[] buffer =3D new char[4096]; > int c =3D 0; > while ((c =3D sr.read(buffer)) > -1) { > sb.append(buffer, 0, c); > } > if (sb.length() < 3) { > @SuppressWarnings("unchecked") > Map parameterMap =3D request.getParamet= erMap(); > getParameterMap().putAll(parameterMap); > } else { > parseFormData(sb.toString()); > } > } > ... > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)