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