1 package org.apache.turbine.services.jsp.util;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.turbine.util.DynamicURI;
23 import org.apache.turbine.util.RunData;
24 import org.apache.turbine.util.uri.URIConstants;
25
26 /***
27 * A customized version of the DynamicURI to be used in JSP templates.
28 * This is automatically inserted into the request so page authors
29 * can create links in templates.
30 * Here's an example of its use:<br>
31 * <code>
32 * <jsp:useBean id="link" class="JspLink" scope="request"/%>
33 * <%= link.setPage("index.jsp").setPathInfo("key", "value") %>
34 * This would return:
35 * http://foo.com/myapp/servlet/Turbine/key/value/template/index.jsp
36 * </code>
37 *
38 * @author <a href="john.mcnally@clearink.com">John McNally</a>
39 * @author <a href="mbryson@mont.mindspring.com">Dave Bryson</a>
40 * @author Jon S. Stevens <a href="mailto:jon@latchkey.com">jon@latchkey.com</a>
41 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
42 * @version $Id: JspLink.java 534872 2007-05-03 14:07:18Z tv $
43 * @deprecated Use {@org.apache.turbine.services.pull.tools.TemplateLink} instead.
44 */
45 public class JspLink
46 extends DynamicURI
47 {
48 /***
49 * Constructor
50 *
51 * @param data A Rundata Object
52 */
53 public JspLink(RunData data)
54 {
55 super(data);
56 }
57
58 /***
59 * Returns the URI
60 * @return String the uri http://foo.com/...
61 */
62 public String toString()
63 {
64 String output = super.toString();
65
66
67
68 removePathInfo();
69 removeQueryData();
70
71 return output;
72 }
73
74 /***
75 * Sets the template variable used by the WebMacroSite Service
76 * @param String the template name
77 * @return JspLink
78 */
79 public JspLink setPage(String t)
80 {
81 return (JspLink) addPathInfo(URIConstants.CGI_TEMPLATE_PARAM, t);
82 }
83 }