Revision: 1103
http://stripes.svn.sourceforge.net/stripes/?rev=1103&view=rev
Author: bengunter
Date: 2009-03-05 14:41:09 +0000 (Thu, 05 Mar 2009)
Log Message:
-----------
Fixed STS-523. The prependContext field is now Boolean. If it is set true then
the context will always be prepended; if it is false then it will never be
prepended. If it is null and the context is not the root context, then it will
be prepended if the URL does not already start with the context path or if the
beanclass attribute is not null (because the ActionBean URL binding is always
context-relative).
Modified Paths:
--------------
trunk/stripes/resources/stripes.tld
trunk/stripes/src/net/sourceforge/stripes/tag/LinkTagSupport.java
Modified: trunk/stripes/resources/stripes.tld
===================================================================
--- trunk/stripes/resources/stripes.tld 2009-03-04 19:43:46 UTC (rev 1102)
+++ trunk/stripes/resources/stripes.tld 2009-03-05 14:41:09 UTC (rev 1103)
@@ -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: trunk/stripes/src/net/sourceforge/stripes/tag/LinkTagSupport.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/tag/LinkTagSupport.java
2009-03-04 19:43:46 UTC (rev 1102)
+++ trunk/stripes/src/net/sourceforge/stripes/tag/LinkTagSupport.java
2009-03-05 14:41:09 UTC (rev 1103)
@@ -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