henning 2003/08/10 09:11:19
Modified: src/java/org/apache/turbine/services/pull/tools
TemplateLink.java
Log:
Add a getLink() method which is similar to getURI but resets the query
parameters. So we now get
getURI/getAbsoluteURI/getRelativeURI - Return the link as absolute/relative
link and keep the query params.
getLink/getAbsoluteLink/getRelativeLink - Return the link as absolute/relative
link and reset the query params.
toString() now simply calls getLink() (just as it called
getAbsoluteLink before the tool was configureable to return relative
or absolute links as a default.
Cleaned up some of the comments.
Revision Changes Path
1.8 +30 -5
jakarta-turbine-2/src/java/org/apache/turbine/services/pull/tools/TemplateLink.java
Index: TemplateLink.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/pull/tools/TemplateLink.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TemplateLink.java 4 Aug 2003 13:49:31 -0000 1.7
+++ TemplateLink.java 10 Aug 2003 16:11:19 -0000 1.8
@@ -573,13 +573,12 @@
/**
* Returns the URI. After rendering the URI, it clears the
- * pathInfo and QueryString portions of the TemplateURI. Equivalent
- * to the getAbsoluteLink() method of this class.
+ * pathInfo and QueryString portions of the TemplateURI.
*
* @return A String with the URI in the form
* http://foo.com/Turbine/template/index.wm/hello/world
*/
- public String toString()
+ public String getLink()
{
return wantRelative ?
getRelativeLink() : getAbsoluteLink();
@@ -588,7 +587,7 @@
/**
* Returns the relative URI leaving the source intact. Use this
* if you need the path_info and query data multiple times.
- * This is equivalent to $link.AbsoluteLink or just $link,
+ * This is equivalent to $link.Link or just $link,
* but does not reset the path_info and query data.
*
* @return A String with the URI in the form
@@ -596,6 +595,21 @@
*/
public String getURI()
{
+ return wantRelative ?
+ templateURI.getRelativeLink() : templateURI.getAbsoluteLink();
+ }
+
+ /**
+ * Returns the absolute URI leaving the source intact. Use this
+ * if you need the path_info and query data multiple times.
+ * This is equivalent to $link.AbsoluteLink but does not reset
+ * the path_info and query data.
+ *
+ * @return A String with the URI in the form
+ * http://foo.com/Turbine/template/index.wm/hello/world
+ */
+ public String getAbsoluteURI()
+ {
return templateURI.getAbsoluteLink();
}
@@ -611,5 +625,16 @@
public String getRelativeURI()
{
return templateURI.getRelativeLink();
+ }
+
+ /**
+ * Same as getLink().
+ *
+ * @return A String with the URI represented by this object.
+ *
+ */
+ public String toString()
+ {
+ return getLink();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]