Re: Calling static methods, revisited

2023-10-05 Thread Christopher Schultz
It looks like this is the same as https://issues.apache.org/jira/projects/VELOCITY/issues/VELOCITY-952 and is a much bigger issue. See also https://issues.apache.org/jira/projects/VELOCITY/issues/VELOCITY-968 On Wed, Sep 27, 2023 at 6:03 PM Christopher Schultz < ch...@christopherschultz.

Calling static methods, revisited

2023-09-27 Thread Christopher Schultz
All, (This is all in the context of Velocity 1.7, but I'm not sure anything has changed through 2.x.) Sometimes you want to call a static method. Past workarounds are ugly but get the job done. For example: #set($string = "") $string.format($locale, "format string", args) I have a case

Re: Apache Velocity : Verify if all substitutions are made

2023-06-13 Thread Christopher Schultz
Debraj, On 6/13/23 05:38, Debraj Manna wrote: Can someone let me know how I can verify a velocity context against a template? Basically, I want to throw some error if all variables are not substituted in the velocity template. For example, let's say I have a velocity template, card.vm card

Re: Can I get the name of the template from inside the template?

2023-05-03 Thread Christopher Schultz
ng to get the internal name, you'd probably be better off > injecting the name yourself. You normally have access to the name of the > template around the same time that you set up the context. > > >> On Wed, May 3, 2023 at 11:42 AM Christopher Schultz < >> ch...@chris

Can I get the name of the template from inside the template?

2023-05-03 Thread Christopher Schultz
All, I'd like too be able to get access to the name of the template currently being rendered. It looks like that information should be in the VelocityContext being used, but I'm having trouble getting a reference to that. This is in a webapp situation, and I'm using velocity-tools so I

Manually-configuring a WebappResourceLoader

2022-12-19 Thread Christopher Schultz
Hello, I need to be able to initialize and use a VelocityEngine from within a web application but without the benefit of using Velocity*Servlet, etc. in order to do the setup. I'm already using Velocity as the templating engine for this web application and I need to keep this usage

Re: Overriding a macro definition

2022-06-20 Thread Christopher Schultz
All, On 6/20/22 13:54, Christopher Schultz wrote: On 6/20/22 13:40, Christopher Schultz wrote: I have a process where I'd like to use a global macro library but also allow the individual templates to override the macros if necessary. My code looks something like this: // == One-time setup

Re: Overriding a macro definition

2022-06-20 Thread Christopher Schultz
All, On 6/20/22 13:40, Christopher Schultz wrote: I have a process where I'd like to use a global macro library but also allow the individual templates to override the macros if necessary. My code looks something like this: // == One-time setup Properties props = new Properties

Overriding a macro definition

2022-06-20 Thread Christopher Schultz
All, I have a process where I'd like to use a global macro library but also allow the individual templates to override the macros if necessary. My code looks something like this: // == One-time setup Properties props = new Properties(); properties.setProperty("velocimacro.inline.allow",

[tools] Using VelocityViewServlet with custom Properties

2022-06-10 Thread Christopher Schultz
All, I happen to be using tools-2.0 but it doesn't look like the code has changed much up through today. I have a subclass of VelocvityViewServlet I've been using for years that further customizes things for my environment. I'd now like to be able to provide a custom set of Ptoperties

Problems with newer Java versions and introspection

2021-11-02 Thread Christopher Schultz
All, Velocity v1.7 openjdk version "16.0.2" 2021-07-20 OpenJDK Runtime Environment (build 16.0.2+7-67) OpenJDK 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing) (Yes, I realize Velocity 1.7 is old but we haven't had time to evaluate 500+ templates for compatibility with later

Test variable for falsiness without generating a warning

2021-01-05 Thread Christopher Schultz
All, I've got a template where a variable may be either undefined or false (or other values) and I'm specifically trying to determine if it's *false*. My template code looks like this: #if($value && true == $value) do stuff #elseif(false == $value) do other stuff #end I don't seem to be

Re: Problems with commons-beanutils-1.9.4

2020-02-06 Thread Christopher Schultz
it) but I won't have anything to test it with other than the existing unit tests. - -chris > On Wed, Feb 5, 2020 at 9:55 AM Christopher Schultz < > ch...@christopherschultz.net> wrote: > > All, > > This may be an uncommon configuration, but I just upgraded from > veloc

Problems with commons-beanutils-1.9.4

2020-02-05 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 All, This may be an uncommon configuration, but I just upgraded from velocity-tools-2.0 with commons-beanutils-1.9.3 to commons-beanutils-1.9.4 and all my stuff broke. I spent a few hours tracking it down and I happened to have my toolbox

Literal tab characters in templates

2019-01-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 All, I know this has been asked before but I've never really found a satisfactory answer: what's the best way to put a literal tab into a VTL template? I don't want to use: context.put("tab", "\t"); And then use $tab in my template, because

Create an empty java.util.Set in VTL

2018-01-25 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 All, If I want to create a new empty array/collection, I can do something like this: #set($array = []) If I want to create a new Map, I can do this: #set($map = {}) Is there a way to create a new Set? I'd like to use a set because: 1. I want

Re: [tools 2.0] ValueParser.getStrings splits on comma?

2017-10-14 Thread Christopher Schultz
0) character? Or maybe RS (Record Separator) 0x1e? Does anyone have any preference? Also, what's the best way to make this backward-compatible? -chris > On Mon, Aug 21, 2017 at 6:00 PM, Christopher Schultz < > ch...@christopherschultz.net> wrote: > > All, > > I'm no

Re: Easy way to print hex rendering of byte[]

2017-10-14 Thread Christopher Schultz
added string-formatting :) Thanks, -chris > On 13/10/2017 23:39, Christopher Schultz wrote: >> All, >> >> Before I spend a whole lot of time on this, is there a dead-simple way >> in VTL + stock Velocity Tools to take a byte[] reference and print-out a >> hex-renderi

Easy way to print hex rendering of byte[]

2017-10-13 Thread Christopher Schultz
All, Before I spend a whole lot of time on this, is there a dead-simple way in VTL + stock Velocity Tools to take a byte[] reference and print-out a hex-rendering of it? Like: Java (roughly): byte[] bytes = new byte[] { 0xa, 0xb, 0x12 }; ctx.put("bytes", bytes); template.render(ctc); VTL: my

[tools 2.0] ValueParser.getStrings splits on comma?

2017-08-21 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 All, I'm not sure if I've used ValueParser.getStrings before (really, ParameterParser.getStrings, in this case), but I'm surprised by what is happening. Is this expected? Request POST parameters: foo=bar=This, is a comment. Velocity template

[Tools 2.0] Possible to change the default locale of DateTool after configure()

2017-03-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 All, I just spent an inordinate amount of time tracking-down a date-formatting problem in one of our applications. The real root cause of the problem was that some silly programmer did something like this: That looked perfectly fine to me, but

[Tools] Possible to check StrutsLinkTool for an existing "forward"

2017-01-30 Thread Christopher Schultz
All, I've been using StrutsLinkTool with Struts 1.x for a very long time, and I'm surprised this is the first time this has come up. I'd like to check for the existence of a forward definition and, if it exists, use it. Otherwise, I'd like to fall-back to a default. Basically, I'm taking a

[tools] Problems using struts.MessageTool

2016-01-27 Thread Christopher Schultz
All, Using Velocity-Tools 2.0. I've got a resource bundle with the following message in it: text.patient.questionnaires.available=There {0,choice,0#are no questionnaires|1#is one questionnaire|1'{0}'' questionnaires} ready to take (That's all on one single line, in case my emailer wraps it, or

Re: Loading template file

2015-09-02 Thread Christopher Schultz
Mike, On 9/1/15 8:51 AM, Mike Kienenberger wrote: > As far as I know, case sensitivity depends on your filesystem > (operating system) and not on Velocity. > > Windows and Mac OS X are case-insensitive. UNIX-based file systems > are generally case-sensitive, although not all. It's worth

Re: [tools, struts1] On an HTTPS page, link to HTTP URL includes port number :443

2014-12-09 Thread Christopher Schultz
. Thanks, -chris On Fri, Dec 5, 2014 at 8:20 PM, Christopher Schultz ch...@christopherschultz.net wrote: All, I'm using StrutsLinkTool and I have a forward defined in struts-config.xml that is a complete URL (like http://www.google.com/?q=foo;). In my page, I have this: a href=$link.forward

[tools, struts1] On an HTTPS page, link to HTTP URL includes port number :443

2014-12-05 Thread Christopher Schultz
All, I'm using StrutsLinkTool and I have a forward defined in struts-config.xml that is a complete URL (like http://www.google.com/?q=foo;). In my page, I have this: a href=$link.forward('my-link-name')link text/a The page this link is on is served via HTTPS with no port number, so of course

Re: [tools, struts1] On an HTTPS page, link to HTTP URL includes port number :443

2014-12-05 Thread Christopher Schultz
-config.xml and (b) point to resources external to our web application. Thanks, -chris On Fri, Dec 5, 2014 at 8:20 PM, Christopher Schultz ch...@christopherschultz.net wrote: All, I'm using StrutsLinkTool and I have a forward defined in struts-config.xml that is a complete URL (like http

[tools] Replacement for ListTool?

2014-06-26 Thread Christopher Schultz
All, ListTool is marked as deprecated because Velocity 1.6 and later treat arrays and lists as first-class collections and can perform appropriate operations on them. One thing it's not easy to do is determine if an object is an List or an Array. I have something hacked-together using ClassTool

Re: [tools] Replacement for ListTool?

2014-06-26 Thread Christopher Schultz
of course makes no sense). Any other suggestions? If not, I'll do what I have below plus checking against '['. Thanks, -chris On 06/26/2014 03:27 PM, Christopher Schultz wrote: All, ListTool is marked as deprecated because Velocity 1.6 and later treat arrays and lists as first-class

Re: Can't connect to JVM via jconsole, etc. when using VelocityViewServlet

2014-03-13 Thread Christopher Schultz
All, On 3/13/14, 5:55 PM, Christopher Schultz wrote: All, On 3/10/14, 2:15 PM, Christopher Schultz wrote: All, I've just discovered that I can't connect using jconsole, VisualVM, YourKit, etc. when VelocityViewServlet has been enabled. I never noticed this before because I haven't been

Re: [tools] Toolbox preventing session serialization

2014-03-11 Thread Christopher Schultz
Claude, On 3/11/14, 4:57 AM, Claude Brisson wrote: The session toolbox is always created by default, to let users access standard session tools. There is a create-session parameter you can use for this purpose, see: http://velocity.apache.org/tools/releases/2.0/config.xml.html Is it

Can't connect to JVM via jconsole, etc. when using VelocityViewServlet

2014-03-10 Thread Christopher Schultz
All, I've just discovered that I can't connect using jconsole, VisualVM, YourKit, etc. when VelocityViewServlet has been enabled. I never noticed this before because I haven't been using jconsole very much, and I don't think I've tried to profile recently. I have a quick summary of what's going

[tools] Using java.text.MessageFormat in templates

2014-02-21 Thread Christopher Schultz
All, I have a template where I'd like to take some text in a variable and do parametric-replacement like new MessageFormat(format).format(replacements) might do. I'm already using Velocity Tools/Struts to great effect with pre-defined messages in properties files, but this data needs to come

Re: [tools] Using java.text.MessageFormat in templates

2014-02-21 Thread Christopher Schultz
All, On 2/21/14, 12:48 PM, Christopher Schultz wrote: All, I have a template where I'd like to take some text in a variable and do parametric-replacement like new MessageFormat(format).format(replacements) might do. I'm already using Velocity Tools/Struts to great effect with pre-defined

Re: [tools] Using java.text.MessageFormat in templates

2014-02-21 Thread Christopher Schultz
Nathan, On 2/21/14, 1:42 PM, Nathan Bubna wrote: Yes, the conflict was intentional. The idea was that people using VelocityStruts would default to using Struts' message support, so we should default $text to use that. Whether that is still valid reasoning, i don't know. I haven't used Struts

Re: Warning about tools.xml

2014-02-14 Thread Christopher Schultz
Bump. Anyone? On 1/30/14, 8:30 PM, Christopher Schultz wrote: All, I just noticed this warning in my startup logs: Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log INFO: Velocity [trace] Searching for configuration at: /WEB-INF/tools.xml Jan 30, 2014 8:21:33 PM

DateTool and locale setting

2014-02-11 Thread Christopher Schultz
All, Umm... I probably should have noticed this long before today, but I just observed a problem with my configuration and I wanted to make sure that my (new) understanding of the DateTool is correct. So, I had DateTool configured to be an application level tool. That appears to have been a

Warning about tools.xml

2014-01-30 Thread Christopher Schultz
All, I just noticed this warning in my startup logs: Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log INFO: Velocity [trace] Searching for configuration at: /WEB-INF/tools.xml Jan 30, 2014 8:21:33 PM org.apache.catalina.core.ApplicationContext log INFO: Velocity

Re: Unexpected template parsing issue

2013-08-29 Thread Christopher Schultz
comment things so that we can document which else/end goes with which if/else. Odd that sometimes we are getting those extra # or ## at the end of lines in the output. Any ideas are appreciated. Thanks, -chris On 8/29/13 1:55 PM, Christopher Schultz wrote: All, Velocity 1.7, Oracle JDK 1.7.0_25

While-like structure in Velocity?

2013-05-15 Thread Christopher Schultz
All, I've searched the archives for while capabilities in Velocity, and mostly the answers have been things like that's beyond the scope of Velocity... you want a real programming language for that. I'd like to do something that naturally would use a while loop, but perhaps someone can offer an

runtime.parser.Parser maintains multiple VelocityCharStreams?

2013-04-12 Thread Christopher Schultz
All, I've been doing some profiling looking for wasted memory in my webapp and I've discovered that org.apache.velocity.runtime.parser.Parser contains a few members that appear to be (essentially) duplicates. First, there is the velocharstream member which is a VelocityCharStream. Then, there is

Re: runtime.parser.Parser maintains multiple VelocityCharStreams?

2013-04-12 Thread Christopher Schultz
On Fri, Apr 12, 2013 at 10:41 AM, Christopher Schultz ch...@christopherschultz.net wrote: All, I've been doing some profiling looking for wasted memory in my webapp and I've discovered that org.apache.velocity.runtime.parser.Parser contains a few members that appear to be (essentially) duplicates

Re: Making Velocity truly concurent

2012-09-28 Thread Christopher Schultz
Jan, On 9/21/12 2:45 AM, Jan Algermissen wrote: looking at the code yesterday, I saw that Velocity uses a number of Serialized classes (e.g. the SerializedMap in ResourceCache). I would like to replace all relevant classes to avoid serialization completely. Do you mean avoid all

Re: How do I set a TimeZone for VelocityTools DateTool?

2012-09-12 Thread Christopher Schultz
Doug, On 9/12/12 5:22 PM, Doug Breaux wrote: On 9/12/2012 2:10 PM, Christopher Schultz wrote: Doug, On 8/14/12 5:20 PM, Doug Breaux wrote: Both the VelocityTools Tools Usage Summary and the DateTool Javadoc seem to indicate a configuration mechanism for setting a TimeZone, but I simply

Re: Odd observation during debugging

2012-07-16 Thread Christopher Schultz
Nathan, On 7/11/12 1:35 PM, Nathan Bubna wrote: On Wed, Jul 11, 2012 at 9:58 AM, Christopher Schultz ch...@christopherschultz.net wrote: Nathan, ... See VELOCITY-731 and VELOCITY-692 and others... Those were good to read: 1.6 introduced more consistent (if slower) treatment of references

Odd observation during debugging

2012-07-11 Thread Christopher Schultz
All, I recently started getting intermittent OOMEs in my webapp that seem to be completely recoverable. The stack traces look like this: java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2882) at

Re: Odd observation during debugging

2012-07-11 Thread Christopher Schultz
Nathan, On 7/11/12 12:28 PM, Nathan Bubna wrote: Just set: directive.if.tostring.nullcheck = false As always, thanks for the quick, response. I had gotten this far in my code reading: ASTReference.evaluate(): public boolean evaluate(InternalContextAdapter context) throws

Re: Odd observation during debugging

2012-07-11 Thread Christopher Schultz
Nathan, On 7/11/12 1:35 PM, Nathan Bubna wrote: Actually, i still consider [the toString behavior] correct for a template language (which is not the same as a scripting language) to treat render-as-empty as false in an #if. So, my hope for 2.0 was to not to remove that behavior, but to

Re: Configuring number of parsers and buffer sizes

2012-04-30 Thread Christopher Schultz
Nathan, On 4/26/12 11:58 PM, Nathan Bubna wrote: parser.pool.size I'll check that out. is this in 1.7? Yes. Velocity 1.7 and Velocity Tools 2.0.0 (with a few unrelated patches). i thought we trimmed a lot of the excess between 1.5 and 1.6, but if we can trim more, that'd be swell. I'll

Re: Minimum version for Velocity and Velocity Tools?

2012-03-08 Thread Christopher Schultz
Nathan, On 3/7/12 12:37 PM, Nathan Bubna wrote: At last decision, we set the current development versions for both at JDK 1.5+. But considering their languorous pace, if you wanted to make a strong case for 1.6+, it would probably not be resisted. Nah... just wanted to use CharSequence

Re: [tools] Generating XHTML-compliant Javascript with ValidatorTool

2012-03-06 Thread Christopher Schultz
Nathan, On 3/6/12 9:46 AM, Nathan Bubna wrote: Not to pick at semantics, but the xhtml feature came after the ValidatorTool, so i'd call it an oversight that the ValidatorTool was not changed to respect it. Okay, not a problem... I can fix it :) What do you think the best fix would be? It

Re: [tools] Generating XHTML-compliant Javascript with ValidatorTool

2012-03-06 Thread Christopher Schultz
All, On 3/6/12 9:46 AM, Nathan Bubna wrote: Not to pick at semantics, but the xhtml feature came after the ValidatorTool, so i'd call it an oversight that the ValidatorTool was not changed to respect it. https://issues.apache.org/jira/browse/VELTOOLS-152 -chris signature.asc Description:

Re: [TOOLS] Trouble building 2.0.x

2012-02-01 Thread Christopher Schultz
Antonio, On 2/1/12 3:36 AM, Antonio Petrelli wrote: 2012/2/1 Christopher Schultz ch...@christopherschultz.net Antonio, On 1/31/12 6:11 PM, Christopher Schultz wrote: No problem: just check it out from svn (done) and build: I forgot to mention that I downloaded the Velocity 1.7 tag. I

[TOOLS] Trouble building 2.0.x

2012-01-31 Thread Christopher Schultz
All, I'm having trouble building with the new Maven build system. $ svn info Path: . URL: https://svn.apache.org/repos/asf/velocity/tools/branches/2.0.x Repository Root: https://svn.apache.org/repos/asf Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68 Revision: 1238670 Node Kind: directory

Re: Velocity template Evaluation

2012-01-31 Thread Christopher Schultz
Abc, On 1/24/12 1:42 PM, abc12345 wrote: Thanks for the Quick reply, Any Idea when 2.x is scheduled for release. Are you waiting for a specific feature? Or, are you suffering from version-itis? -chris signature.asc Description: OpenPGP digital signature

Re: [TOOLS] Trouble building 2.0.x

2012-01-31 Thread Christopher Schultz
Johannes, On 1/31/12 10:48 AM, Johannes Homuth wrote: Sorry but than you will have to learn it. So bothered it may be, but you will have to understand maven if you have to work with it. *sigh* Would you care to point me in the right direction, or did you just want to troll me? Thanks, -chris

Re: [TOOLS] Trouble building 2.0.x

2012-01-31 Thread Christopher Schultz
Johannes, On 1/31/12 10:54 AM, Johannes Homuth wrote: Maybe a little hint, you should deal with Resource-Filtering I was thinking that maybe whoever built the testing goal would have thought of that. I'm not trying to configure Maven to build velocity-tools. I'm just trying to use what's in SVN

Re: Can clients really specify 'layout' parameter in the URL?

2012-01-18 Thread Christopher Schultz
Nathan, On 1/9/12 11:30 PM, Nathan Bubna wrote: i'm just trying to figure out what your tools.view.servlet.layout.directory setting is. It's the default, which is /layout relative to the web app root. Perhaps this is only a problem if the webapp.resource.loader.path=/, but I believe that is

Re: Avoiding whitespace

2011-11-02 Thread Christopher Schultz
Nathan, On 10/31/11 11:45 AM, Nathan Bubna wrote: In that case, the documentation is wrong. Leading whitespace is only trimmed from in front of a #set directive that has nothing after it. I'm not aware of any other case where leading whitespace is trimmed. Is this something that could be

Avoiding whitespace

2011-10-31 Thread Christopher Schultz
All, The User Guide says that Velocity's behavior is to gobble-up excess whitespace and offers this example: Velocity's behaviour is to gobble up excess whitespace. The preceding directive can be written as: Send me #set( $foo = [$10 and ,a pie] ) #foreach( $a in $foo ) $a #end please. or as

Re: [tools] StrutsLinkTool's setForward method has different behavior

2011-07-28 Thread Christopher Schultz
Nathan, On 7/27/2011 10:55 AM, Nathan Bubna wrote: [I]t means that after you turn the url into a java.net.URI (which does the parsing for you) and you are copying out the sections of the URI into the current LinkTool instance, you don't want to override things in the currents LinkTool that

LinkTool.addRequestParams is difficult to use due to varargs/String[] parameter

2011-07-27 Thread Christopher Schultz
All, I've been trying to switch my templates from using LinkTool.addIgnore()addAllParameters() to use LinkTool.addRequestParamsExcept(String... allButThese) but I'm having a bit of difficulty with it. If I call addRequestParams() with no argument, things work as expect. On the other hand,

Re: LinkTool.addRequestParams is difficult to use due to varargs/String[] parameter

2011-07-27 Thread Christopher Schultz
Nathan, On 7/27/2011 4:40 PM, Nathan Bubna wrote: On Wed, Jul 27, 2011 at 11:59 AM, Christopher Schultz ch...@christopherschultz.net wrote: All, I've been trying to switch my templates from using LinkTool.addIgnore()addAllParameters() to use LinkTool.addRequestParamsExcept(String

Re: [tools] LinkTool.addAllParameters is not behaving as before

2011-07-27 Thread Christopher Schultz
All, On 7/27/2011 4:06 PM, Christopher Schultz wrote: I do see /a/ bug in addAllParameters, but it doesn't account for the problem I'm seeing. Okay, I was wrong, the ignores list *is* being updated by addQueryData (indirectly through view.tools.LinkTool.setParam). What I'm seeing

Re: [tools] LinkTool.addAllParameters is not behaving as before [fixed]

2011-07-27 Thread Christopher Schultz
Fixed in 2.0.x branch. On 7/27/2011 4:53 PM, Christopher Schultz wrote: All, On 7/27/2011 4:06 PM, Christopher Schultz wrote: I do see /a/ bug in addAllParameters, but it doesn't account for the problem I'm seeing. Okay, I was wrong, the ignores list *is* being updated by addQueryData

Re: LinkTool.addRequestParams is difficult to use due to varargs/String[] parameter [fixed]

2011-07-27 Thread Christopher Schultz
Fixed in 2.0.x branch. On 7/27/2011 4:49 PM, Christopher Schultz wrote: Nathan, On 7/27/2011 4:40 PM, Nathan Bubna wrote: On Wed, Jul 27, 2011 at 11:59 AM, Christopher Schultz ch...@christopherschultz.net wrote: All, I've been trying to switch my templates from using LinkTool.addIgnore

[tools] LinkTool.addAllParameters is not behaving as before

2011-07-26 Thread Christopher Schultz
All, As I get further into the testing of Velocity Tools 2.0, I'm finding that the addAllParameters method isn't working as it used to. The use case here is something like this: $forward = $link.setRelative('foo').addIgnore('xyz') a href=$forward.addQueryData('x', 'y').addAllParameters()link

[tools] StrutsLinkTool's setForward method has different behavior

2011-07-26 Thread Christopher Schultz
All, We use StrutsLinkTool pretty much everywhere and had been relying on the previous behavior (tools 1.4) of StrutsLinkTool.setForward(String) which takes a reference to a Struts-defined forward which is basically just a URL. In the past, we were able to define a URL in Struts like this:

Re: [tools] LinkTool.addAllParameters is not behaving as before

2011-07-26 Thread Christopher Schultz
All, On 7/26/2011 5:23 PM, Christopher Schultz wrote: As I get further into the testing of Velocity Tools 2.0, I'm finding that the addAllParameters method isn't working as it used to. I forgot to say what is happening. It appears that the addAllParameters call isn't actually accomplishing

Re: [tools] LinkTool.addAllParameters is not behaving as before

2011-07-26 Thread Christopher Schultz
All, On 7/26/2011 5:23 PM, Christopher Schultz wrote: As I get further into the testing of Velocity Tools 2.0, I'm finding that the addAllParameters method isn't working as it used to. Something very subtle is happening, here. The following all work as I expect them to: p \$link.setRelative

Velocity Tools 2.0 README has incorrect build instructions

2011-07-21 Thread Christopher Schultz
All, Velocity Tools trunk README.txt file says that building is easy using ant: just type ant. Unfortunately, there is no build script, etc. so ant fails of course. I'd like to submit a patch but I need to build and test before I do that. I don't know a thing about Maven. :) How does one build

Re: Velocity Tools 2.0 README has incorrect build instructions

2011-07-21 Thread Christopher Schultz
Claude, On 7/21/2011 12:21 PM, Claude Brisson wrote: tools/trunk (future 2.1) now depends on velocity-2.0.0-SNAPSHOT and is built with maven Aah, I didn't realize that. Good to know. tools/branches/2.0.x still depends on velocity-1.x and is built with ant I'll switch to the branch, since I

Re: Velocity Tools 2.0 README has incorrect build instructions

2011-07-21 Thread Christopher Schultz
Claude, On 7/21/2011 12:21 PM, Claude Brisson wrote: trunk now uses maven Could you update the README.txt file to indicate the new build process? If it's just install maven; type 'mvn' then that's fine, too :) Thanks, -chris signature.asc Description: OpenPGP digital signature

Re: Velocity Tools 2.0 README has incorrect build instructions

2011-07-21 Thread Christopher Schultz
Nathan, On 7/21/2011 1:06 PM, Christopher Schultz wrote: I'll go ahead and commit everywhere. Hmm... I'm having trouble building trunk. That could be due to a number of environmental factors including wrong maven version (I grabbed 3.0.3), wrong maven use (I tried mvn compile), or missing local

Re: Trouble finding velocity.properties in a jar

2011-07-21 Thread Christopher Schultz
Dave, On 7/21/2011 12:37 PM, laredotornado wrote: final InputStream resourceStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(velocity.properties); Should that have a leading / in the path? The above dies because the resourceStream is null. Any ideas

Re: Trouble finding velocity.properties in a jar

2011-07-21 Thread Christopher Schultz
Nathan, On 7/21/2011 1:36 PM, Nathan Bubna wrote: On Thu, Jul 21, 2011 at 10:31 AM, Christopher Schultz ch...@christopherschultz.net wrote: Dave, On 7/21/2011 12:37 PM, laredotornado wrote: final InputStream resourceStream = Thread.currentThread().getContextClassLoader

Expression okay in 14. but not parsable in 1.7

2011-07-20 Thread Christopher Schultz
All, I've found an expression that parser in Velocity 1.4 but does not in Velocity 1.7: #set($linkedExpression = $linkedExpression.replaceAll('(?:fact|response|freeResponse)\(\s*([0-9]+)\s*[^)]*\)', a href=\$link.setForward('clinician-edit-question')?id=${dollar}1\${dollar}0/a)) (That should be

Re: Disappearance of LinkTool.setRelative

2011-07-20 Thread Christopher Schultz
Nathan, On 7/19/2011 7:55 PM, Nathan Bubna wrote: Problems with mailto: and $link.uri() should probably go into JIRA, those ought to work. https://issues.apache.org/jira/browse/VELTOOLS-143 -chris signature.asc Description: OpenPGP digital signature

Re: Expression okay in 14. but not parsable in 1.7

2011-07-20 Thread Christopher Schultz
Nathan, On 7/20/2011 12:06 PM, Nathan Bubna wrote: there is a 1.x branch, but it is unlikely to have future releases (at least, i'm not going to work on them). make sure it is fixed in the trunk. if you feel like being thorough, backport to the 1.x branch. What about getting it published to

Re: VelocityViewServlet and purging the template cache

2011-07-19 Thread Christopher Schultz
Nathan, On 7/1/2011 11:27 AM, Nathan Bubna wrote: As far as i know, that's all uncharted territory. But you're not the first to ask about ways to programmatically clear the cache. I just don't think anyone has ever worked on support for this. Okay. Now that I'm serious about upgrading to

Re: Disappearance of LinkTool.setRelative

2011-07-19 Thread Christopher Schultz
which I'll have to investigate. I'm reporting these because the Velocity Tools upgrade page basically says drop-in the new JAR and report any problems to the users list. The current release build is not drop-in replaceable. :( Thanks, -chris On 7/19/2011 5:15 PM, Christopher Schultz wrote: All

Re: Disappearance of LinkTool.setRelative

2011-07-19 Thread Christopher Schultz
All, On 7/19/2011 5:39 PM, Christopher Schultz wrote: In addition to LinkTool.setRelative, LinkTool.setURI was also removed. Also LinkTool.addQueryData, used dozens of times in all my templates. Sheesh, what happened? Looks like LinkTool.param(String,Object) is what I'm looking for. I can't

Re: Calling #set on a macro argument with 1.7

2011-06-07 Thread Christopher Schultz
Nathan, On 6/2/2011 4:17 PM, Nathan Bubna wrote: 2011/6/2 Șergiu Dumitriu ser...@xwiki.com: On 06/02/2011 05:55 PM, Nathan Bubna wrote: Hi Andreas, Sorry to have inconvenienced you with this change. The old behavior was causing problems and had some notable flaws (see my discussion of

String duplication

2011-05-11 Thread Christopher Schultz
All, So, two things before I get started: 1. I know I have access to the source. I know I'm a committer. 2. I'm using Velocity 1.4 I've recently been doing a lot of memory profiling of my webapp and it looks like Velocity is responsible for a lot of stuff hanging around in memory. Of course,

Re: [Object] duplication

2011-05-11 Thread Christopher Schultz
a bit of memory there as well. Sorry for the laundry list. I've just buried in the profiler right now and I can see all of it. ;) Thanks, -chris On 5/11/2011 4:48 PM, Christopher Schultz wrote: All, So, two things before I get started: 1. I know I have access to the source. I know I'm

Re: String duplication

2011-05-11 Thread Christopher Schultz
All, Ha ha, just saw bug VELOCITY-801. I'll comment on that bug, too. -chris signature.asc Description: OpenPGP digital signature

Re: String duplication

2011-05-11 Thread Christopher Schultz
Nathan, On 5/11/2011 5:15 PM, Nathan Bubna wrote: A lot of this work was done already between 1.5 and 1.6, as i recall. I could have sworn you participated in some of those discussion too. Maybe... I'll have to look at the mailing list archives. :) I know a lot of work was done in 1.6 on

Re: Non-resetable iterator warning

2011-02-18 Thread Christopher Schultz
Nathan, On 2/16/2011 5:47 PM, Nathan Bubna wrote: all relevant things were fixes for these problems in subsequent versions. seriously, i can't remember anything related to this except the fixes. tally one for reasons to upgrade. Gotcha. please, if i were omnipotent, i would strike all

Non-resetable iterator warning

2011-02-16 Thread Christopher Schultz
All, I'm using Velocity 1.4 (yeah, I know) and I'm getting these warnings: INFO: Velocity [warn] Warning! The iterative is an Iterator in the #foreach() loop at [0,0] in template [my template]. Because it's not resetable, if used in more than once, this may lead to unexpected results.

[tools] Using LinkTool for mailto: links

2011-01-07 Thread Christopher Schultz
All, I'm trying (for the first time!) to create a mailto: link in my webapp and I decided to see what would happen if I used the LinkTool (really StrutsLinkTool) to generate it. Something like this (newlines added for readability): a href=$link.setURI(mailto:f...@bar.com;)

Re: [tools] Using LinkTool for mailto: links

2011-01-07 Thread Christopher Schultz
Nathan, On 1/7/2011 12:52 PM, Nathan Bubna wrote: looks like 1.4 code. have you checked on how Tools 2 encodes links? Forgot to mention that I'm on velocity-1.4 and velocity-tools-1.4 (plus a few of my own old patches). I should try to upgrade to velocity-tools-2.0 since it does not

Creating maps on the fly

2010-12-22 Thread Christopher Schultz
All, Using Velocity 1.4, I'm trying to create an in-page hash for quick lookups. I have the following syntax: #set($hash = { }) This is causing an error: org.apache.velocity.exception.ParseErrorException: Lexical error: org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 6,

Re: Mutating a collection

2010-11-17 Thread Christopher Schultz
Jian, On 11/17/2010 4:19 PM, jian chen wrote: It seems to me that in java, Iterator can not be modified during the iteration loop. It is not particular to Velocity though. http://download.oracle.com/javase/6/docs/api/java/util/Iterator.html#remove() You may need to update your interview

Re: Mutating a collection

2010-11-17 Thread Christopher Schultz
Nathan, On 11/17/2010 4:44 PM, Nathan Bubna wrote: On Wed, Nov 17, 2010 at 1:15 PM, Christopher Schultz ch...@christopherschultz.net wrote: All, I'd like to mutate a collection during template evaluation -- essentially, I'd like to call Iterator.remove() during a loop. Is that possible

Re: Velocity class thread-safety problems

2010-09-10 Thread Christopher Schultz
Nathan, On 9/7/2010 11:23 AM, Nathan Bubna wrote: inline, local macros. only those macros have threadsafety issues. and even then, only when they are being repeatedly parsed under load (i.e. template caching off or repeated use of evaluate with the same log tag). so i mostly recommend that

Re: [tools] Absolute URLs from LinkTool

2010-09-10 Thread Christopher Schultz
Nathan, On 9/7/2010 11:36 AM, Nathan Bubna wrote: according to both the code and javadocs, that's what it is supposed to do when you pass a relative url into that method. there isn't really a method in Tools 1.4's LinkTool that does what you want. all setAbsolute can do in 1.4 is:

Re: Velocity class thread-safety problems

2010-09-07 Thread Christopher Schultz
Antonio, On 9/2/2010 10:02 PM, Kitching, Simon wrote: On Wed, 2010-09-01 at 07:14 -0700, Nathan Bubna wrote: On Tue, Aug 31, 2010 at 10:02 PM, Kitching, Simon simon.kitch...@airnz.co.nz wrote: Hi All, I've got some code using Velocity which failed under load. Can you confirm that the

[tools] Absolute URLs from LinkTool

2010-09-07 Thread Christopher Schultz
All, I'm having a problem using LinkTool (StrutsLinkTool, actually) in Velocity Tools 1.4. What I want is a fully-qualified URL without the current webapp's context path in the URL. Something like this: http://host/path/to/resource What I'm getting from LinkTool.setAbsolute('/foo/bar') is this:

Re: String to int.

2008-11-19 Thread Christopher Schultz
Ryan, This is more of a user question than a dev question, but I'll answer it, anyway (and cross-post to the user list). ryan19 wrote: Does anyone know can you convert a String to int in velocity code? Velocity does not support this directly, but Velocity-Tools does (it's a small but

Re: String to int.

2008-11-19 Thread Christopher Schultz
John, I'm answering your question back on the list so other folks can see it. [EMAIL PROTECTED] wrote: Sorry Christopher, quick question. How do you reference the velocity tool? Like to you put some import in the .vm file? This apache velocity stuff is all new to me. That depends on how you

  1   2   >