Brian Lawler <[EMAIL PROTECTED]> writes:

>Hey guys-

>We found a bug today in the new TemplateLink code in on the 2.3 branch  
>where the reference is not cleared out when rendering the link in a  
>template.  This result is that a call to setReference will be rendered  
>in each subsequent call to $link.  Here is a patch that fixes our  
>problem.  It may be more wise to add a removeReference() method on  
>templateURI - if you would rather go that direction let me know and I  
>will whip it together - just touches more code.

Hi Brian

(bet you didn't think that you would get an answer. ;-) )

I was thinking about this when I approved your message to the list. 

No, this is not a bug. So I vote -1 on your patch.

However, I always thought of the reference being part of the URI
(without any parameters) and the getRelativeLink/getAbsoluteLink
return an URI with parameters and then clear the parameter parts of an
URI (which are pathInfo and the Query String). These methods don't
touch any part of the URI itself.

So IMHO, the current behaviour is sensible and I will not change it.

If you really need this, you should either use

$link.setReference("") in your template or, even better, do the
following thing:

--- cut ---
package com.mycorp.link;

public class BrianTemplateLink extends TemplateLink
{
    public String getAbsoluteLink()
    {
        String output = super.getAbsoluteLink();
        setReference("");
        return output;
    }

    public String getRelativeLink()
    {
        String output = super.getRelativeLink();
        setReference("");
        return output;
    }
}
--- cut ---

and then use 

tool.request.link = com.mycorp.link.BrianTemplateLink

in your turbine.properties

There is IMHO no need to patch the core code to get this behaviour.

        Regards
                Henning



>-Brian

>Index: src/java/org/apache/turbine/services/pull/tools/TemplateLink.java
>===================================================================
>RCS file:  
>/home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/services/ 
>pull/tools/TemplateLink.java,v
>retrieving revision 1.8.2.1
>diff -u -r1.8.2.1 TemplateLink.java
>--- src/java/org/apache/turbine/services/pull/tools/TemplateLink.java    
>27 Feb 2004 05:59:18 -0000      1.8.2.1
>+++ src/java/org/apache/turbine/services/pull/tools/TemplateLink.java    
>7 Apr 2004 18:49:29 -0000
>@@ -487,6 +487,7 @@
>          // over with a fresh set of data every time.
>          templateURI.removePathInfo();
>          templateURI.removeQueryData();
>+        templateURI.setReference("");

>          return output;
>      }
>@@ -525,6 +526,7 @@
>          // over with a fresh set of data every time.
>          templateURI.removePathInfo();
>          templateURI.removeQueryData();
>+        templateURI.setReference("");

>          return output;
>      }


>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
[EMAIL PROTECTED]        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

"Au�erdem k�nnen in Deutschland alle Englisch. [...] so entf�llt die
Notwendigkeit [...] Deutsch zu lernen." 
            -- Johan Micoud auf die Frage warum er kein Deutsch spricht.
                   (http://www.spiegel.de/spiegel/0,1518,273205,00.html)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to