LinkTool.relative(url) and LinkTool.absolute(url) improperly handle URLs with 
query strings or anchors
------------------------------------------------------------------------------------------------------

                 Key: VELTOOLS-146
                 URL: https://issues.apache.org/jira/browse/VELTOOLS-146
             Project: Velocity Tools
          Issue Type: Bug
          Components: GenericTools
    Affects Versions: 2.0
            Reporter: Nathan Bubna
            Priority: Minor
             Fix For: 2.1


On Tue, Jul 26, 2011 at 2:27 PM, Christopher Schultz 
<[email protected]> wrote:
...
> 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:
>
> <forward name="some-reference" path="/path/to/resource?foo=bar" />
>
> Then, in the markup:
>
> <a href="$link.setForward('some-reference')">link text</a>
>
> It appears that somewhere in the modifications, the URL ha sbeen
> sanitized and now "/path/to/resource?foo=bar" has been helpfully
> replaced by "/path/to/resource%3Ffoo=bar".
>
> Was this intentional? Is there a way to get the old behavior back?

It was unintentionally changed, in part because i wasn't aware that forwards 
could/would contain query strings.  Basically, setForward passes the url to 
absolute(url) which would correctly handle absolute urls with query strings but 
treats relative urls as merely paths, without parsing out anchors or query 
strings. 

I think we should adapt both $link.relative($url) and $link.absolute($url) to 
accept paths with query strings and anchors.  This probably will require a 
setFromURI(url, withoutOverriding) adapted from what absolute($url) does for 
actual absolute URIs.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to