Revision: 1105
          http://stripes.svn.sourceforge.net/stripes/?rev=1105&view=rev
Author:   bengunter
Date:     2009-03-05 14:45:38 +0000 (Thu, 05 Mar 2009)

Log Message:
-----------
Applied fix for STS-523 from trunk.

Modified Paths:
--------------
    branches/1.5.x/stripes/resources/stripes.tld
    branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/LinkTagSupport.java

Modified: branches/1.5.x/stripes/resources/stripes.tld
===================================================================
--- branches/1.5.x/stripes/resources/stripes.tld        2009-03-05 14:43:40 UTC 
(rev 1104)
+++ branches/1.5.x/stripes/resources/stripes.tld        2009-03-05 14:45:38 UTC 
(rev 1105)
@@ -804,6 +804,7 @@
                 the generated URL.
             </description>
             
<name>prependContext</name><required>false</required><rtexprvalue>true</rtexprvalue>
+            <type>java.lang.Boolean</type>
         </attribute>
         <attribute>
             <description>
@@ -1925,6 +1926,7 @@
                 the generated URL.
             </description>
             
<name>prependContext</name><required>false</required><rtexprvalue>true</rtexprvalue>
+            <type>java.lang.Boolean</type>
         </attribute>
         <attribute>
             <description>

Modified: 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/LinkTagSupport.java
===================================================================
--- branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/LinkTagSupport.java  
2009-03-05 14:43:40 UTC (rev 1104)
+++ branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/LinkTagSupport.java  
2009-03-05 14:45:38 UTC (rev 1105)
@@ -42,7 +42,7 @@
     private String url;
     private String anchor;
     private boolean addSourcePage = false;
-    private boolean prependContext = true;
+    private Boolean prependContext;
 
     /**
      * Gets the URL that is supplied by the user/developer on the page. This 
is the basis
@@ -141,10 +141,10 @@
     public void setAddSourcePage(boolean addSourcePage) { this.addSourcePage = 
addSourcePage; }
 
     /** Get the flag that indicates if the application context should be 
included in the URL. */
-    public boolean isPrependContext() { return prependContext; }
+    public Boolean isPrependContext() { return prependContext; }
 
     /** Set the flag that indicates if the application context should be 
included in the URL. */
-    public void setPrependContext(boolean prependContext) { 
this.prependContext = prependContext; }
+    public void setPrependContext(Boolean prependContext) { 
this.prependContext = prependContext; }
 
     /**
      * Returns the base URL that should be used for building the link. This is 
derived from
@@ -204,12 +204,14 @@
 
         // Prepend the context path, but only if the user didn't already
         String url = builder.toString();
-        if (prependContext) {
-            String contextPath = request.getContextPath();
-            if (contextPath.length() > 1 && !url.startsWith(contextPath + '/'))
-                url = contextPath + url;
-        }
+        String contextPath = request.getContextPath();
+        boolean prepend = prependContext != null && prependContext
+                || prependContext == null && beanclass != null
+                || prependContext == null && contextPath.length() > 1 && 
!url.startsWith(contextPath);
 
+        if (prepend && contextPath.length() > 1)
+            url = contextPath + url;
+
         return response.encodeURL(url);
     }
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to