Return-Path: X-Original-To: apmail-incubator-ace-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-ace-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F0AC673F9 for ; Thu, 28 Jul 2011 23:12:32 +0000 (UTC) Received: (qmail 30158 invoked by uid 500); 28 Jul 2011 23:12:32 -0000 Delivered-To: apmail-incubator-ace-dev-archive@incubator.apache.org Received: (qmail 30134 invoked by uid 500); 28 Jul 2011 23:12:32 -0000 Mailing-List: contact ace-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ace-dev@incubator.apache.org Delivered-To: mailing list ace-dev@incubator.apache.org Received: (qmail 30126 invoked by uid 99); 28 Jul 2011 23:12:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jul 2011 23:12:32 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jul 2011 23:12:30 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 436189042E for ; Thu, 28 Jul 2011 23:12:10 +0000 (UTC) Date: Thu, 28 Jul 2011 23:12:10 +0000 (UTC) From: "Marcel Offermans (JIRA)" To: ace-dev@incubator.apache.org Message-ID: <1186462825.17014.1311894730272.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <169583399.16756.1311890289893.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (ACE-160) REST client interface URI encoding problem with spaces MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/ACE-160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13072592#comment-13072592 ] Marcel Offermans commented on ACE-160: -------------------------------------- The methods "buildPathFromElements" and "getPathElements" should remain symmetrical, so I'm going to apply this patch plus some more, and I'll add a test to validate this behaviour. > REST client interface URI encoding problem with spaces > ------------------------------------------------------- > > Key: ACE-160 > URL: https://issues.apache.org/jira/browse/ACE-160 > Project: Ace > Issue Type: Bug > Affects Versions: 0.8.0 > Reporter: Bram de Kruijff > Assignee: Marcel Offermans > > RESTClientServlet uses URLEncoder.encode(..) on resource identifiers. This is ok most of the time, but breaks a client when there is a space in the association filter used used as part the identifier. Eg. Features and distributions use the name attribute in the association filter, so when one creates a feature with a space in the name "My Feature" the filter be something like (&(name=My Feature)). > The problem... > URLEncoder.encode(...) encodes into application/x-www-form-urlencoded which is ok for a querystring, not for a URI. > What happens... > 1. URLEncoder.encode(..) will translated "My Feature" into "My+Feature" > 2. When a client (eg perl) uir_decodes this the result will still be "My+Feature" > 3. Using this as identifier in for example an association will fail. > My workaround... > Index: ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java > =================================================================== > --- ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java (revision 1150996) > +++ ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java (working copy) > @@ -295,7 +295,8 @@ > result.append('/'); > } > try { > - result.append(URLEncoder.encode(element, "UTF-8")); > + //URL Encode is not for path > + result.append(URLEncoder.encode(element, "UTF-8").replaceAll("\\+", "%20")); > } > catch (UnsupportedEncodingException e) {} // ignored on purpose, any JVM must support UTF-8 -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira