Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A2F8D2009D9 for ; Wed, 18 May 2016 02:24:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A1804160A1F; Wed, 18 May 2016 00:24:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E94A21609F5 for ; Wed, 18 May 2016 02:24:13 +0200 (CEST) Received: (qmail 13343 invoked by uid 500); 18 May 2016 00:24:13 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 13329 invoked by uid 99); 18 May 2016 00:24:13 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 May 2016 00:24:13 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id DADBE2C1F5C for ; Wed, 18 May 2016 00:24:12 +0000 (UTC) Date: Wed, 18 May 2016 00:24:12 +0000 (UTC) From: "Jay mann (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-9968) camel restlet not populating body form parameters correctly for x-www-form-urlencoded MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 18 May 2016 00:24:14 -0000 [ https://issues.apache.org/jira/browse/CAMEL-9968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15287950#comment-15287950 ] Jay mann commented on CAMEL-9968: --------------------------------- PR #985 submitted. > camel restlet not populating body form parameters correctly for x-www-form-urlencoded > ------------------------------------------------------------------------------------- > > Key: CAMEL-9968 > URL: https://issues.apache.org/jira/browse/CAMEL-9968 > Project: Camel > Issue Type: Bug > Components: camel-restlet > Affects Versions: 2.17.1 > Reporter: Jay mann > Priority: Minor > Fix For: 2.17.2, 2.18.0 > > > Currently for x-www-form-urlencoded post request camel puts the body into a form key with a null value: > {code} > if ((Method.PUT == method || Method.POST == method) && MediaType.APPLICATION_WWW_FORM.equals(mediaType, true)) { > form = new Form(); > // must use string based for forms > String body = exchange.getIn().getBody(String.class); > if (body != null) { > form.add(body, null); > } > } > {code} > Which results in a body like this: > name=jay&password=secret > ending up with a form parameter looking like this: > name%3Djay%26password%3Dsecret=null > I think something like this should be used to correctly set the key values. > {code} > if ((Method.PUT == method || Method.POST == method) && MediaType.APPLICATION_WWW_FORM.equals(mediaType, true)) { > form = new Form(); > // must use string based for forms > String body = exchange.getIn().getBody(String.class); > if (body != null) { > List pairs = URLEncodedUtils.parse(body, Charset.forName("UTF-8")); > for(NameValuePair p : pairs){ > form.add(p.getName(), p.getValue()); > } > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)