You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2011/07/19 23:15:11 UTC

Disappearance of LinkTool.setRelative

All,

As mentioned in a previous post, I'm upgrading Velocity from 1.4 -> 1.7
and also considering upgrading tools from 1.4 -> 2.0. I tried the naive
strategy of just upgrading everything, rebuilding and restarting. No
errors on startup, which was nice.

On the other hand, my uses of $link.setRelative are all broken, which I
used a lot to include static content. I can't seem to find in the svn
logs when the LinkTool.setRelative method went away. I can see in
StutsLinkTool the setAction and setForward methods are still there.

When did LinkTool.setRelative go away and why? Was this just a cleanup
of the API (the LinkTool.relative(String) method appears to be the same)?

Thanks,
-chris



Re: Disappearance of LinkTool.setRelative

Posted by Claude Brisson <cl...@renegat.net>.
On Wed, 20 Jul 2011 11:50:55 -0400
Christopher Schultz <ch...@christopherschultz.net> wrote:

> Nathan,
> 
> On 7/20/2011 11:45 AM, Nathan Bubna wrote:
> > On Wed, Jul 20, 2011 at 8:33 AM, Christopher Schultz
> > 
> >> Quick question: which file(s) should I be editing?
> >>
> >> $ find -name StrutsLinkTool.java
> >> ./src/main/java/org/apache/velocity/tools/struts/StrutsLinkTool.java

This path is obsolete and is a trace of the old directory structure,
which hasn't been removed by 'svn up' - you should do a clean
checkout...

  Claude

> >> ./velocity-tools-struts/src/main/java/org/apache/velocity/tools/struts/StrutsLinkTool.java
> > 
> > uh... we have multiple copies?  that shouldn't be.  i suppose both
> > for the moment, but we need to not have two copies of things.
> 
> Yeah, looks like velocity-tools-* has copies of code in other places
> with different version numbers. You tell me what makes the most sense
> to update (both if I don't hear from you).




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Disappearance of LinkTool.setRelative

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Nathan,

On 7/20/2011 11:45 AM, Nathan Bubna wrote:
> On Wed, Jul 20, 2011 at 8:33 AM, Christopher Schultz
> 
>> Quick question: which file(s) should I be editing?
>>
>> $ find -name StrutsLinkTool.java
>> ./src/main/java/org/apache/velocity/tools/struts/StrutsLinkTool.java
>> ./velocity-tools-struts/src/main/java/org/apache/velocity/tools/struts/StrutsLinkTool.java
> 
> uh... we have multiple copies?  that shouldn't be.  i suppose both for
> the moment, but we need to not have two copies of things.

Yeah, looks like velocity-tools-* has copies of code in other places
with different version numbers. You tell me what makes the most sense to
update (both if I don't hear from you).

Thanks,
-chris


Re: Disappearance of LinkTool.setRelative

Posted by Nathan Bubna <nb...@gmail.com>.
On Wed, Jul 20, 2011 at 8:33 AM, Christopher Schultz
<ch...@christopherschultz.net> wrote:
> Nathan,
>
> On 7/20/2011 11:28 AM, Nathan Bubna wrote:
>> Ah, yeah, i see the problem now.  StrutsLinkTool probably should have
>> extended the old LinkTool.  If you want to add the deprecated methods
>> back into StrutsLinkTool or change its parent class, i won't object.
>> I don't use the Struts support anymore anyway.
>
> I'm happy to do either -- let me know which you'd prefer. I suspect
> you'd rather re-add those methods instead of changing the inheritance
> chain (again).

actually, since the old LinkTool inherits the new one, it's not much
of a change. just inserting an intermediate.  either way, i trust your
judgment.

> Quick question: which file(s) should I be editing?
>
> $ find -name StrutsLinkTool.java
> ./src/main/java/org/apache/velocity/tools/struts/StrutsLinkTool.java
> ./velocity-tools-struts/src/main/java/org/apache/velocity/tools/struts/StrutsLinkTool.java

uh... we have multiple copies?  that shouldn't be.  i suppose both for
the moment, but we need to not have two copies of things.


>
> ??
>
> -chris
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Disappearance of LinkTool.setRelative

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Nathan,

On 7/20/2011 11:28 AM, Nathan Bubna wrote:
> Ah, yeah, i see the problem now.  StrutsLinkTool probably should have
> extended the old LinkTool.  If you want to add the deprecated methods
> back into StrutsLinkTool or change its parent class, i won't object.
> I don't use the Struts support anymore anyway.

I'm happy to do either -- let me know which you'd prefer. I suspect
you'd rather re-add those methods instead of changing the inheritance
chain (again).

Quick question: which file(s) should I be editing?

$ find -name StrutsLinkTool.java
./src/main/java/org/apache/velocity/tools/struts/StrutsLinkTool.java
./velocity-tools-struts/src/main/java/org/apache/velocity/tools/struts/StrutsLinkTool.java

??

-chris


Re: Disappearance of LinkTool.setRelative

Posted by Nathan Bubna <nb...@gmail.com>.
Ah, yeah, i see the problem now.  StrutsLinkTool probably should have
extended the old LinkTool.  If you want to add the deprecated methods
back into StrutsLinkTool or change its parent class, i won't object.
I don't use the Struts support anymore anyway.

On Wed, Jul 20, 2011 at 8:24 AM, Christopher Schultz
<ch...@christopherschultz.net> wrote:
> Nathan,
>
> On 7/19/2011 8:03 PM, Nathan Bubna wrote:
>> Oh, i forgot.  The old API is still there as a wrapper to the new one,
>> in the old package (for complete B.C.)
>>
>> You just need to use org.apache.velocity.tools.view.tools.LinkTool
>
> Aah, I see the problem. I use StrutsLinkTool, which has been re-written
> to use org.apache.velocity.tools.view.LinkTool, which has lost these
> methods.
>
> So, StrutsLinkTool isn't a drop-in replacement at this point.
>
> I agree that everyone had plenty of time to complain before the 2.0
> release :)
>
> The question is whether or not these methods should be re-introduced
> into StrutsLinkTool. I can certainly add them, but only if strict
> backward-compatibility is a significant goal. If I'm the only one
> complaining, then I can certainly write my own wrappers.
>
> Thanks,
> -chris
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Disappearance of LinkTool.setRelative

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Nathan,

On 7/19/2011 8:03 PM, Nathan Bubna wrote:
> Oh, i forgot.  The old API is still there as a wrapper to the new one,
> in the old package (for complete B.C.)
> 
> You just need to use org.apache.velocity.tools.view.tools.LinkTool

Aah, I see the problem. I use StrutsLinkTool, which has been re-written
to use org.apache.velocity.tools.view.LinkTool, which has lost these
methods.

So, StrutsLinkTool isn't a drop-in replacement at this point.

I agree that everyone had plenty of time to complain before the 2.0
release :)

The question is whether or not these methods should be re-introduced
into StrutsLinkTool. I can certainly add them, but only if strict
backward-compatibility is a significant goal. If I'm the only one
complaining, then I can certainly write my own wrappers.

Thanks,
-chris


Re: Disappearance of LinkTool.setRelative

Posted by Nathan Bubna <nb...@gmail.com>.
Oh, i forgot.  The old API is still there as a wrapper to the new one,
in the old package (for complete B.C.)

You just need to use org.apache.velocity.tools.view.tools.LinkTool

On Tue, Jul 19, 2011 at 4:55 PM, Nathan Bubna <nb...@gmail.com> wrote:
> I don't think there is any tool that was reworked as heavily as the
> LinkTool(s).  A common request and top priority for me in 2.0 was to
> create a generic (non-servlet) LinkTool and a cleaner API for it.  I
> think put 40-60 hours into that alone.  I'm not at all surprised that
> i dropped some of the old API in the process.  Sorry about that.
>
> On the other hand, i begged and nagged and sent plenty of guilt trip
> emails when pushing toward a 2.0 final, asking for people to report
> B.C. failures and oversights.  So, i can only feel so bad when some of
> those problems are discovered years later.
>
> In any case, the mapping to replacements should not be difficult.  No
> functionality should be lost, in fact, much was added.
>
> Problems with mailto: and $link.uri() should probably go into JIRA,
> those ought to work.
>
> On Tue, Jul 19, 2011 at 2:44 PM, Christopher Schultz
> <ch...@christopherschultz.net> wrote:
>> 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 find the old javadocs on the website for comparison (or
>> deprecation warnings). The upgrade page says everything was deprecated
>> but not removed, but these look like removals to me.
>>
>> -chris
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Disappearance of LinkTool.setRelative

Posted by Christopher Schultz <ch...@christopherschultz.net>.
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


Re: Disappearance of LinkTool.setRelative

Posted by Nathan Bubna <nb...@gmail.com>.
I don't think there is any tool that was reworked as heavily as the
LinkTool(s).  A common request and top priority for me in 2.0 was to
create a generic (non-servlet) LinkTool and a cleaner API for it.  I
think put 40-60 hours into that alone.  I'm not at all surprised that
i dropped some of the old API in the process.  Sorry about that.

On the other hand, i begged and nagged and sent plenty of guilt trip
emails when pushing toward a 2.0 final, asking for people to report
B.C. failures and oversights.  So, i can only feel so bad when some of
those problems are discovered years later.

In any case, the mapping to replacements should not be difficult.  No
functionality should be lost, in fact, much was added.

Problems with mailto: and $link.uri() should probably go into JIRA,
those ought to work.

On Tue, Jul 19, 2011 at 2:44 PM, Christopher Schultz
<ch...@christopherschultz.net> wrote:
> 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 find the old javadocs on the website for comparison (or
> deprecation warnings). The upgrade page says everything was deprecated
> but not removed, but these look like removals to me.
>
> -chris
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Disappearance of LinkTool.setRelative

Posted by Christopher Schultz <ch...@christopherschultz.net>.
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 find the old javadocs on the website for comparison (or
deprecation warnings). The upgrade page says everything was deprecated
but not removed, but these look like removals to me.

-chris


Re: Incompatibilities in VELTOOLS from 1.4 -> 2.0 (was: Disappearance of LinkTool.setRelative)

Posted by Nathan Bubna <nb...@gmail.com>.
the createURI method ignores query params for opaque URIs, that's the
only explanation that seems possible to me with what i know of your
code.  it's been years since i wrote all this, so i don't recall all
the vagaries of the URI class and opaque URI handling.  but it
definitely seems wrong to not allow params on a mailto link.  i'd say
that needs to be fixed.  i've no idea when i'd be able to get to that.

On Tue, Jul 19, 2011 at 3:07 PM, Christopher Schultz
<ch...@christopherschultz.net> wrote:
> All,
>
> On 7/19/2011 5:39 PM, Christopher Schultz wrote:
>> I'm getting a syntax error for a "mailto" link which I'll have to
>> investigate.
>
> I fixed one problem (URI class was objecting to spaces I had in the
> "opaque" portion of the URI - something like "Chris Schultz
> <ch...@christopherschultz.net>" as the URI) but it appears that LinkTool
> will no longer allow me to add query parameters to mailto links.
>
> Something like this doesn't work:
>
>  $link.uri("mailto:foo").param('foo', 'bar')
>
> Result:   mailto:foo
> Expected: mailto:foo?foo=bar
>
> I've had a quick look at the code and I can't understand why it won't
> allow that. Any ideas?
>
> Thanks,
> -chris
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Incompatibilities in VELTOOLS from 1.4 -> 2.0 (was: Disappearance of LinkTool.setRelative)

Posted by Christopher Schultz <ch...@christopherschultz.net>.
All,

On 7/19/2011 5:39 PM, Christopher Schultz wrote:
> I'm getting a syntax error for a "mailto" link which I'll have to
> investigate.

I fixed one problem (URI class was objecting to spaces I had in the
"opaque" portion of the URI - something like "Chris Schultz
<ch...@christopherschultz.net>" as the URI) but it appears that LinkTool
will no longer allow me to add query parameters to mailto links.

Something like this doesn't work:

 $link.uri("mailto:foo").param('foo', 'bar')

Result:   mailto:foo
Expected: mailto:foo?foo=bar

I've had a quick look at the code and I can't understand why it won't
allow that. Any ideas?

Thanks,
-chris


Re: Disappearance of LinkTool.setRelative

Posted by Christopher Schultz <ch...@christopherschultz.net>.
All,

In addition to LinkTool.setRelative, LinkTool.setURI was also removed.

I have way too much template code that uses these so I wrote a wrapper
class to bring them back. It appears that LinkTool.uri(String) is not as
permissive as it used to be: I'm getting a syntax error for a "mailto"
link 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,
> 
> As mentioned in a previous post, I'm upgrading Velocity from 1.4 -> 1.7
> and also considering upgrading tools from 1.4 -> 2.0. I tried the naive
> strategy of just upgrading everything, rebuilding and restarting. No
> errors on startup, which was nice.
> 
> On the other hand, my uses of $link.setRelative are all broken, which I
> used a lot to include static content. I can't seem to find in the svn
> logs when the LinkTool.setRelative method went away. I can see in
> StutsLinkTool the setAction and setForward methods are still there.
> 
> When did LinkTool.setRelative go away and why? Was this just a cleanup
> of the API (the LinkTool.relative(String) method appears to be the same)?
> 
> Thanks,
> -chris
> 
>