1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 package org.apache.pluto.tags;
27
28 import javax.portlet.PortletMode;
29 import javax.portlet.PortletModeException;
30 import javax.portlet.PortletSecurityException;
31 import javax.portlet.RenderResponse;
32 import javax.portlet.WindowState;
33 import javax.portlet.WindowStateException;
34 import javax.servlet.jsp.JspException;
35 import javax.servlet.jsp.PageContext;
36
37 /***
38 ** Supporting class for the <CODE>renderURL</CODE> tag.
39 ** Creates a url that points to the current Portlet and triggers an render request
40 ** with the supplied parameters.
41 **
42 **/
43 public class RenderURLTag extends BasicURLTag
44 {
45
46
47
48
49
50 public int doStartTag() throws JspException {
51 if (var != null)
52 {
53 pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
54 }
55 RenderResponse renderResponse = (RenderResponse)pageContext.getRequest().getAttribute("javax.portlet.response");
56
57 if (renderResponse != null)
58 {
59 setUrl(renderResponse.createRenderURL());
60 if (portletMode != null)
61 {
62 try
63 {
64 url.setPortletMode((PortletMode)TEI.portletModes.get(portletMode.toUpperCase()));
65 }
66 catch (PortletModeException e)
67 {
68 throw new JspException(e);
69 }
70 }
71 if (windowState != null)
72 {
73 try
74 {
75 url.setWindowState((WindowState)TEI.definedWindowStates.get(windowState.toUpperCase()));
76 }
77 catch (WindowStateException e)
78 {
79 throw new JspException(e);
80 }
81 }
82 if (secure != null)
83 {
84 try
85 {
86 url.setSecure(getSecureBoolean());
87 }
88 catch (PortletSecurityException e)
89 {
90 throw new JspException(e);
91 }
92 }
93 }
94 return EVAL_PAGE;
95 }
96 }
97