1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.struts2.portlet.dispatcher;
22
23 import com.opensymphony.xwork2.Action;
24
25 import java.io.Serializable;
26
27 /***
28 * When a portlet is targetted for an <code>event</code>, the portlet will receive two
29 * portlet requests, one for the <code>event</code> phase, and then followed by a <code>render</code>
30 * operation. When in the <code>event</code> phase, the action that is executed can't render
31 * any output. This means that if an action in the XWork configuration is executed in the event
32 * phase, and the action is set up with a result that should render something, the result can't
33 * immediately be executed. The portlet needs to "wait" to the render phase to do the
34 * rendering.
35 * <p/>
36 * When the {@link org.apache.struts2.portlet.result.PortletResult} detects such a
37 * scenario, instead of executing the actual view, it prepares a couple of render parameters
38 * specifying this action and the location of the view, which then will be executed in the
39 * following render request.
40 */
41 public class DirectRenderFromEventAction implements Action, Serializable {
42
43 private static final long serialVersionUID = -1814807772308405785L;
44
45 private String location = null;
46
47 /***
48 * Get the location of the view.
49 *
50 * @return Returns the location.
51 */
52 public String getLocation() {
53 return location;
54 }
55
56 /***
57 * Set the location of the view.
58 *
59 * @param location The location to set.
60 */
61 public void setLocation(String location) {
62 this.location = location;
63 }
64
65 /***
66 * Always return success.
67 *
68 * @return SUCCESS
69 */
70 public String execute() throws Exception {
71 return SUCCESS;
72 }
73 }