Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C700010A53 for ; Thu, 1 Aug 2013 01:26:04 +0000 (UTC) Received: (qmail 63662 invoked by uid 500); 1 Aug 2013 01:26:04 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 63636 invoked by uid 500); 1 Aug 2013 01:26:04 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 63628 invoked by uid 99); 1 Aug 2013 01:26:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Aug 2013 01:26:04 +0000 X-ASF-Spam-Status: No, hits=2.3 required=5.0 tests=FORGED_YAHOO_RCVD,URI_HEX X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: local policy) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Aug 2013 01:25:58 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1V4hdl-0000sp-DJ for users@camel.apache.org; Wed, 31 Jul 2013 18:25:17 -0700 Date: Wed, 31 Jul 2013 18:25:17 -0700 (PDT) From: ramrubio To: users@camel.apache.org Message-ID: <1375320317405-5736608.post@n5.nabble.com> Subject: stream caching to HTTP end point MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Attempting to implement a proxy service to route requests dynamically using DynamicRouter pattern suggested by http://camel.apache.org/dynamic-router.html. I'm unsuccessful though in getting streamcaching to work. I've enabled streamcaching on the CamelContext but when the proxysvc forwards the POST request to my endpoint the body is always empty. Below is my code that perform the slip functionality. public void configure() throws Exception { Processor processor = new MyProcessor(); this.from("servlet:///?matchOnUriPrefix=true") .removeHeader(Exchange.HTTP_PATH) .dynamicRouter(method(CamelRoute.class, "slip")); } public static String slip(String body_p, @Properties Map propertiesMap_p, @Headers MapheadersMap_p) { String serviceEndPoint = null; String publicUri = (String)headersMap_p.get(Exchange.HTTP_URI); //byte []bodyByteArray = body_p.getBytes(); if(publicUri != null) { // get the state from the exchange properties and keep track how many times // we have been invoked int invoked = 0; Object current = propertiesMap_p.get("invoked"); if (current != null) { invoked = Integer.valueOf(current.toString()); } invoked++; // and store the state back on the properties propertiesMap_p.put("invoked", invoked); if(invoked == 1) { serviceEndPoint = CamelRoute.constructUri(); } } return serviceEndPoint; } private static String constructUri() { String serviceEndPoint = null; String server = "http://localhost:8080"; serviceEndPoint = server +"/sample.restsvc/rest/testresource" +"?bridgeEndpoint=true&throwExceptionOnFailure=false"; return serviceEndPoint; } The Request is forwarded to my http end point but the body is always empty. Can someone provide information as to whether streamCache works for http end point? If i add a processor to route that sets body as string in request this code works but this work around loads the entire body to memory which causes issues for large requests. /Ramon -- View this message in context: http://camel.465427.n5.nabble.com/stream-caching-to-HTTP-end-point-tp5736608.html Sent from the Camel - Users mailing list archive at Nabble.com.