01: package org.apache.turbine.services.jsp.util;
02:
03: /*
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "License"); you may not use this file except in compliance
10: * with the License. You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing,
15: * software distributed under the License is distributed on an
16: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17: * KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations
19: * under the License.
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 extends DynamicURI {
46: /**
47: * Constructor
48: *
49: * @param data A Rundata Object
50: */
51: public JspLink(RunData data) {
52: super (data);
53: }
54:
55: /**
56: * Returns the URI
57: * @return String the uri http://foo.com/...
58: */
59: public String toString() {
60: String output = super .toString();
61:
62: // This was added to allow multilple $link variables in one
63: // JSP template
64: removePathInfo();
65: removeQueryData();
66:
67: return output;
68: }
69:
70: /**
71: * Sets the template variable used by the WebMacroSite Service
72: * @param String the template name
73: * @return JspLink
74: */
75: public JspLink setPage(String t) {
76: return (JspLink) addPathInfo(URIConstants.CGI_TEMPLATE_PARAM, t);
77: }
78: }
|