Bug 34109 - <c:url> doesn't merge slashes at the boundary of "context" and "value"
Summary: <c:url> doesn't merge slashes at the boundary of "context" and "value"
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: 1.1
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2005-03-21 17:26 UTC by Jirka Hanika
Modified: 2007-01-10 12:54 UTC (History)
0 users

Test JSP (183 bytes, text/plain)
2006-12-13 14:41 UTC, Henri Yandell
Patch to fix this issue (1023 bytes, patch)
2006-12-13 14:41 UTC, Henri Yandell
Details | Diff
Unit test for this bug. (2.61 KB, patch)
2007-01-03 17:14 UTC, Bjorn Townsend
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jirka Hanika 2005-03-21 17:26:40 UTC
Suppose a JSP contains an element like this:
<c:url context="/some/context/" value="/path/resource.do"/>

the generated URL will contain two consecutive slashes, where they're not
allowed:    "...some/context//path/resource.do".

Arguably such JSP is valid, as the context may end in '/', and the spec
clearly mandates the leading slash of the value.  The bug is non-trivial
to work around (by omitting the first one of the two slashes from the JSP)
in some cases, because with context="/" the trailing slash is mandatory, and the
context may be introduced as a parameter so as to be both used in c:url
in some places and directly concatenated with other path components in others.

Part of this behavior has already been fixed as a result of bug report 22860.
Comment 1 Henri Yandell 2006-12-13 14:41:27 UTC
Created attachment 19261 [details]
Test JSP
Comment 2 Henri Yandell 2006-12-13 14:41:40 UTC
Created attachment 19262 [details]
Patch to fix this issue
Comment 3 Bjorn Townsend 2007-01-03 17:14:26 UTC
Created attachment 19351 [details]
Unit test for this bug.

Here's a patch containing a unit test for this issue.
Comment 4 Henri Yandell 2007-01-10 12:54:17 UTC
svn ci -m "Adding test from Bjorn Townsend and fix for #34109 - <c:url> doesn't
merge slashes at the boundary of 'context' and 'value'"

Sending        src/org/apache/taglibs/standard/tag/common/core/UrlSupport.java
Adding         test/org/apache/taglibs/standard/tag/url
Adding         test/org/apache/taglibs/standard/tag/url/core
Adding         test/org/apache/taglibs/standard/tag/url/core/Test34109.java
Adding         test/web/org/apache/taglibs/standard/tag/url
Adding         test/web/org/apache/taglibs/standard/tag/url/core
Adding         test/web/org/apache/taglibs/standard/tag/url/core/Test34109.jsp
Transmitting file data ...
Committed revision 494974.