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