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 9D01510494 for ; Tue, 23 Jul 2013 14:46:02 +0000 (UTC) Received: (qmail 57477 invoked by uid 500); 23 Jul 2013 14:46:02 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 57197 invoked by uid 500); 23 Jul 2013 14:46:01 -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 57182 invoked by uid 99); 23 Jul 2013 14:46:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Jul 2013 14:46:00 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,SPF_NEUTRAL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: encountered temporary error during SPF processing of domain of javamonkey79@gmail.com) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Jul 2013 14:45:54 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1V1dpy-0006Q0-BU for users@camel.apache.org; Tue, 23 Jul 2013 07:45:14 -0700 Date: Tue, 23 Jul 2013 07:45:14 -0700 (PDT) From: javamonkey79 To: users@camel.apache.org Message-ID: <1374590714347-5736136.post@n5.nabble.com> Subject: padded text and\or static classes in velocity template of velocity component MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I am trying to pad some text in a velocity template in the camel component. To do this, I'd like to use the StringUtils class of apache commons. Per suggestions from other sources, I've tried this: public class StringUtilsHelper { public void addStringUtilsToExchange( final Exchange exchange ) { exchange.setProperty( "StringUtils", new StringUtils() ); exchange.getIn().setHeader( "StringUtils", new StringUtils() ); } } and in my template: ${exchange.StringUtils.leftPad("foo", 10)} ${in.StringUtils.leftPad("foo", 10)} I've also tried: $exchange.StringUtils.leftPad("foo", 10) $in.StringUtils.leftPad("foo", 10) When I call this template by calling velocity without camel it works, something like this: Velocity.getTemplate( "string-padding-test.vm" ).merge( new VelocityContext() { { put( "StringUtils", StringUtils.class ); } }, stringWriter ); My route is pretty simple, and when I add: $body to the template the objects in the body do render, so I'm at a loss. ${body} I'm willing to use other things, but I'd prefer not to have to write extra macros in to my template for padding and other formatting, if it came to that I'd build a decorator class to wrap my objects to be rendered. Does anyone have any idea why this is not working? -- View this message in context: http://camel.465427.n5.nabble.com/padded-text-and-or-static-classes-in-velocity-template-of-velocity-component-tp5736136.html Sent from the Camel - Users mailing list archive at Nabble.com.