1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.struts.taglib.html;
19
20 import org.apache.struts.taglib.TagUtils;
21
22 import javax.servlet.jsp.JspException;
23
24 import java.net.MalformedURLException;
25
26 import java.util.Map;
27
28 /***
29 * Generate a URL-encoded URI as a string.
30 *
31 * @version $Rev: 421129 $ $Date: 2004-10-16 12:38:42 -0400 (Sat, 16 Oct 2004)
32 * $
33 */
34 public class RewriteTag extends LinkTag {
35
36
37 /***
38 * Render the appropriately encoded URI.
39 *
40 * @throws JspException if a JSP exception has occurred
41 */
42 public int doStartTag() throws JspException {
43
44 Map params =
45 TagUtils.getInstance().computeParameters(pageContext, paramId,
46 paramName, paramProperty, paramScope, name, property, scope,
47 transaction);
48
49 String url = null;
50
51 try {
52
53
54 url = TagUtils.getInstance().computeURLWithCharEncoding(pageContext,
55 forward, href, page, action, module, params, anchor, false,
56 this.isXhtml(), useLocalEncoding);
57 } catch (MalformedURLException e) {
58 TagUtils.getInstance().saveException(pageContext, e);
59 throw new JspException(messages.getMessage("rewrite.url",
60 e.toString()));
61 }
62
63 TagUtils.getInstance().write(pageContext, url);
64
65 return (SKIP_BODY);
66 }
67
68 /***
69 * Ignore the end of this tag.
70 *
71 * @throws JspException if a JSP exception has occurred
72 */
73 public int doEndTag() throws JspException {
74 return (EVAL_PAGE);
75 }
76 }