velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: [tools] StrutsLinkTool's setForward method has different behavior
Date Wed, 27 Jul 2011 19:31:48 GMT

On 7/27/2011 10:55 AM, Nathan Bubna wrote:
> On Wed, Jul 27, 2011 at 7:32 AM,  <> wrote:
>> Nathan Bubna wrote:
>>> This probably will require a setFromURI(url, withoutOverriding)
>>> adapted from what absolute($url) does for actual absolute URIs.
>> So "withoutOverriding" really means "don't escape"?
> no, it means that after you turn the url into a (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 are absent in the URI.  If the
> URI has no scheme, don't set the LinkTool to have a null scheme, and
> so on.


>>> In the meantime, try this:
>>> context.put(, "url");
>>> $url.decode($link.setForward('some-reference'))
>> That's not going to work because we also add more query string data to the
>> link after the setForward() call. (I simplified my original example).
> As long as your query string data doesn't have anything encoded that
> you don't want decoded, then add the params before decoding and don't
> worry about it.

So... it happens that I do have some items that need to be escaped --
like "next step" URLs and the like.

>> LinkTool would be most flexible if it would parse any existing query string
>> into it's own parameter table OR be sensitive about an existing query string
>> and add anything to is as appropriate (this would probably be best, unless
>> there are methods in LinkTool that expect to be able to /replace/
>> previously-set query string parameters).
> The method of upgrading relative(url) and absolute(url) that i
> describe above will parse and add params to the internal map, because
> yes, there are methods that expect to be able to replace parameters.

Okay, great. I'll be happy to immediately try any patch you have.

>>> Or extend StrutsLinkTool to do that for you.
>> I think I'll try to hack SLT to work for me temporarily with an eye towards
>> a longer-term solution that actually gets committed to VELTOOLS. I need to
>> get this working so I can continue to use VELTOOLS-2.0... otherwise I'll
>> have to roll-back to 1.4.
> Please don't. :)

Definitely not a preferred course of action.


View raw message