You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org> on 2009/04/18 00:58:14 UTC

[jira] Closed: (TAP5-653) Appending a context to an URL of the Index page results in too many slashes

     [ https://issues.apache.org/jira/browse/TAP5-653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship closed TAP5-653.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 5.1.0.4

> Appending a context to an URL of the Index page results in too many slashes
> ---------------------------------------------------------------------------
>
>                 Key: TAP5-653
>                 URL: https://issues.apache.org/jira/browse/TAP5-653
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.1.0.3
>            Reporter: Igor Drobiazko
>            Assignee: Howard M. Lewis Ship
>            Priority: Critical
>             Fix For: 5.1.0.4
>
>
> When creating a page link to the Index page with a context, Tapestry creates a link with two slashes after the context path
> Example:  /app//123
> Because LinkImpl uses RequestPathOptimizer.optimizePath() inside the methode toUri() the url is optimized  to 123. So the link to the Index page will work.
> But when you write a test for a page Foo (which contains a link to Index page) with PageTester, the test will fail because RequestPathOptimizer does not cut the url. The optimizer skips the optimization because in tests you can not use SymbolConstants.FORCE_ABSOLUTE_URIS = false. PagesTestes throws an exception if a path does not start with context path.
> <t:pagelink page="Index" context="123">...</t:pagelink>
> To fix the problem we have to check inside ComponentEventLinkEncoderImpl.appendContext() if the url ends with a slash.
>     public void appendContext(EventContext context, StringBuilder builder)
>     {
>         String encoded = contextPathEncoder.encodeIntoPath(context);
>         if (encoded.length() > 0)
>         {
>             if(!encoded.endsWith(SLASH))
>             {
>                 builder.append(SLASH); 
>             }
>             builder.append(encoded);
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.