%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.turbine.services.jsp.util.JspLink |
|
|
1 | package org.apache.turbine.services.jsp.util; |
|
2 | ||
3 | /* |
|
4 | * Copyright 2001-2005 The Apache Software Foundation. |
|
5 | * |
|
6 | * Licensed under the Apache License, Version 2.0 (the "License") |
|
7 | * you may not use this file except in compliance with the License. |
|
8 | * You may obtain a copy of the License at |
|
9 | * |
|
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | * |
|
12 | * Unless required by applicable law or agreed to in writing, software |
|
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | * See the License for the specific language governing permissions and |
|
16 | * limitations under the License. |
|
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 | 0 | super(data); |
53 | 0 | } |
54 | ||
55 | /** |
|
56 | * Returns the URI |
|
57 | * @return String the uri http://foo.com/... |
|
58 | */ |
|
59 | public String toString() |
|
60 | { |
|
61 | 0 | String output = super.toString(); |
62 | ||
63 | // This was added to allow multilple $link variables in one |
|
64 | // JSP template |
|
65 | 0 | removePathInfo(); |
66 | 0 | removeQueryData(); |
67 | ||
68 | 0 | 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 | 0 | return (JspLink) addPathInfo(URIConstants.CGI_TEMPLATE_PARAM, t); |
79 | } |
|
80 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |