Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A906818EDC for ; Thu, 25 Feb 2016 00:21:18 +0000 (UTC) Received: (qmail 68777 invoked by uid 500); 25 Feb 2016 00:21:18 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 68736 invoked by uid 500); 25 Feb 2016 00:21:18 -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 68719 invoked by uid 99); 25 Feb 2016 00:21:18 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Feb 2016 00:21:18 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 25EA92C14F8 for ; Thu, 25 Feb 2016 00:21:18 +0000 (UTC) Date: Thu, 25 Feb 2016 00:21:18 +0000 (UTC) From: "Jay mann (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (CAMEL-9642) restlet consumer request not propagating headers 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/CAMEL-9642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15166400#comment-15166400 ] Jay mann edited comment on CAMEL-9642 at 2/25/16 12:21 AM: ----------------------------------------------------------- For some reason this is having the ill effect of setting multiple content-types and Accept-types. But the other headers are coming in now. I'm guess restlet merges the org.restlet.http.headers with the known headers. was (Author: jmandawg): For some reason this is having the ill effect of setting multiple content-types and Accept-types. But the other headers are coming in now. > restlet consumer request not propagating headers > ------------------------------------------------ > > Key: CAMEL-9642 > URL: https://issues.apache.org/jira/browse/CAMEL-9642 > Project: Camel > Issue Type: Bug > Components: camel-restlet > Affects Versions: 2.16.2 > Reporter: Jay mann > > Headers are not getting propagating from restlet consumers. The code is setting them incorrectly inside DefaultRestletBinding.java -> populateRestletRequestFromExchange > This is the code that works (based on latest from github): > {code} > for (Map.Entry entry : exchange.getIn().getHeaders().entrySet()) { > String key = entry.getKey(); > Object value = entry.getValue(); > if (!headerFilterStrategy.applyFilterToCamelHeaders(key, value, exchange)) { > // put the org.restlet headers in attributes > if (key.startsWith("org.restlet.")) { > if(key.equals("org.restlet.http.headers")){ > //Check if existing headers already exist we don't want to wipe the headers that are already in there. > Series
headers = (Series)request.getAttributes().get("org.restlet.http.headers"); > if(headers != null){ //If headers exists add them to the existing ones > Series
newHeaders = (Series)value; > for(Header h: newHeaders){ > headers.set(key, value.toString()); > } > } > else{ > request.getAttributes().put(key, value); > } > } > else{ > request.getAttributes().put(key, value); > } > > } > // Use forms only for PUT, POST and x-www-form-urlencoded > else if (form != null) { > // put the user stuff in the form > if (value instanceof Collection) { > for (Object v : (Collection) value) { > form.add(key, v.toString()); > } > } else { > form.add(key, value.toString()); > } > }else { > // For non-form put all the headers in attributes header > Series
headers = (Series)request.getAttributes().get("org.restlet.http.headers"); > if(headers == null){ > headers = new Series
(Header.class); > request.getAttributes().put("org.restlet.http.headers", headers); > } > headers.set(key, value.toString()); > } > LOG.debug("Populate Restlet request from exchange header: {} value: {}", key, value); > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)