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>actionURL</CODE> tag.
39 * Creates a url that points to the current Portlet and triggers an action request
40 * with the supplied parameters.
41 *
42 */
43 public class ActionURLTag extends BasicURLTag
44 {
45
46
47
48
49 public int doStartTag() throws JspException {
50 if (var != null)
51 {
52 pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
53 }
54 RenderResponse renderResponse = (RenderResponse)pageContext.getRequest().getAttribute("javax.portlet.response");
55
56 if (renderResponse != null)
57 {
58 setUrl(renderResponse.createActionURL());
59 if (portletMode != null)
60 {
61 try
62 {
63 url.setPortletMode((PortletMode)TEI.portletModes.get(portletMode.toUpperCase()));
64 }
65 catch (PortletModeException e)
66 {
67 throw new JspException(e);
68 }
69 }
70 if (windowState != null)
71 {
72 try
73 {
74 url.setWindowState((WindowState)TEI.definedWindowStates.get(windowState.toUpperCase()));
75 }
76 catch (WindowStateException e)
77 {
78 throw new JspException(e);
79 }
80 }
81 if (secure != null)
82 {
83 try
84 {
85 url.setSecure(getSecureBoolean());
86 }
87 catch (PortletSecurityException e)
88 {
89 throw new JspException(e);
90 }
91 }
92 }
93 return EVAL_PAGE;
94 }
95 }
96