Bug 34109

Summary: <c:url> doesn't merge slashes at the boundary of "context" and "value"
Product: Taglibs Reporter: Jirka Hanika <geo>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 1.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Test JSP
Patch to fix this issue
Unit test for 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.