Return-Path: X-Original-To: apmail-ace-commits-archive@www.apache.org Delivered-To: apmail-ace-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E94BADC3F for ; Tue, 14 Aug 2012 08:53:41 +0000 (UTC) Received: (qmail 85662 invoked by uid 500); 14 Aug 2012 08:53:40 -0000 Delivered-To: apmail-ace-commits-archive@ace.apache.org Received: (qmail 85514 invoked by uid 500); 14 Aug 2012 08:53:39 -0000 Mailing-List: contact commits-help@ace.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ace.apache.org Delivered-To: mailing list commits@ace.apache.org Received: (qmail 85449 invoked by uid 99); 14 Aug 2012 08:53:38 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Aug 2012 08:53:38 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 20ACA2C5ACB for ; Tue, 14 Aug 2012 08:53:38 +0000 (UTC) Date: Tue, 14 Aug 2012 19:53:38 +1100 (NCT) From: "J.W. Janssen (JIRA)" To: commits@ace.apache.org Message-ID: <97737560.6792.1344934418134.JavaMail.jiratomcat@arcas> Subject: [jira] [Closed] (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:all-tabpanel ] J.W. Janssen closed ACE-160. ---------------------------- Assignee: (was: Marcel Offermans) > 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 > > 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. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira