1 /**
2 * Copyright 2003 IBM Corporation and Sun Microsystems, Inc.
3 * All rights reserved.
4 * Use is subject to license terms.
5 */
6
7 package javax.portlet;
8
9
10 /**
11 * The <CODE>ActionResponse</CODE> interface represents the portlet
12 * response to an action request.
13 * It extends the <CODE>PortletResponse</CODE> interface to provide specific
14 * action response functionality to portlets.<br>
15 * The portlet container creates an <CODE>ActionResponse</CODE> object and
16 * passes it as argument to the portlet's <CODE>processAction</CODE> method.
17 *
18 * @see ActionRequest
19 * @see PortletResponse
20 */
21 public interface ActionResponse extends PortletResponse {
22
23 /**
24 * Sets the window state of a portlet to the given window state.
25 * <p/>
26 * Possible values are the standard window states and any custom
27 * window states supported by the portal and the portlet.
28 * Standard window states are:
29 * <ul>
30 * <li>MINIMIZED
31 * <li>NORMAL
32 * <li>MAXIMIZED
33 * </ul>
34 *
35 * @param windowState the new portlet window state
36 * @throws WindowStateException if the portlet cannot switch to the specified window state.
37 * To avoid this exception the portlet can check the allowed
38 * window states with <code>Request.isWindowStateAllowed()</code>.
39 * @throws java.lang.IllegalStateException
40 * if the method is invoked after <code>sendRedirect</code> has been called.
41 * @see WindowState
42 */
43
44 public void setWindowState(WindowState windowState)
45 throws WindowStateException;
46
47
48 /**
49 * Sets the portlet mode of a portlet to the given portlet mode.
50 * <p/>
51 * Possible values are the standard portlet modes and any custom
52 * portlet modes supported by the portal and the portlet. Portlets
53 * must declare in the deployment descriptor the portlet modes they
54 * support for each markup type.
55 * Standard portlet modes are:
56 * <ul>
57 * <li>EDIT
58 * <li>HELP
59 * <li>VIEW
60 * </ul>
61 * <p/>
62 * Note: The portlet may still be called in a different window
63 * state in the next render call, depending on the portlet container / portal.
64 *
65 * @param portletMode the new portlet mode
66 * @throws PortletModeException if the portlet cannot switch to this portlet mode,
67 * because the portlet or portal does not support it for this markup,
68 * or the current user is not allowed to switch to this portlet mode.
69 * To avoid this exception the portlet can check the allowed
70 * portlet modes with <code>Request.isPortletModeAllowed()</code>.
71 * @throws java.lang.IllegalStateException
72 * if the method is invoked after <code>sendRedirect</code> has been called.
73 */
74
75 public void setPortletMode(PortletMode portletMode)
76 throws PortletModeException;
77
78
79 /**
80 * Instructs the portlet container to send a redirect response
81 * to the client using the specified redirect location URL.
82 * <p/>
83 * This method only accepts an absolute URL (e.g.
84 * <code>http://my.co/myportal/mywebap/myfolder/myresource.gif</code>)
85 * or a full path URI (e.g. <code>/myportal/mywebap/myfolder/myresource.gif</code>).
86 * If required,
87 * the portlet container may encode the given URL before the
88 * redirection is issued to the client.
89 * <p/>
90 * The sendRedirect method can not be invoked after any of the
91 * following methods of the ActionResponse interface has been called:
92 * <ul>
93 * <li>setPortletMode
94 * <li>setWindowState
95 * <li>setRenderParameter
96 * <li>setRenderParameters
97 * </ul>
98 *
99 * @throws java.lang.IllegalStateException
100 * if the method is invoked after any of above mentioned methods of
101 * the ActionResponse interface has been called.
102 * @param location the redirect location URL
103 * @exception java.io.IOException if an input or output exception occurs.
104 * @exception java.lang.IllegalArgumentException if a relative path URL is given
105 */
106
107 public void sendRedirect(String location)
108 throws java.io.IOException;
109
110
111 /**
112 * Sets a parameter map for the render request.
113 * <p/>
114 * All previously set render parameters are cleared.
115 * <p/>
116 * These parameters will be accessible in all
117 * sub-sequent render calls via the
118 * <code>PortletRequest.getParameter</code> call until
119 * a new request is targeted to the portlet.
120 * <p/>
121 * The given parameters do not need to be encoded
122 * prior to calling this method.
123 *
124 * @param parameters Map containing parameter names for
125 * the render phase as
126 * keys and parameter values as map
127 * values. The keys in the parameter
128 * map must be of type String. The values
129 * in the parameter map must be of type
130 * String array (<code>String[]</code>).
131 * @throws java.lang.IllegalStateException
132 * if the method is invoked after <code>sendRedirect</code> has been called.
133 * @exception java.lang.IllegalArgumentException if parameters is <code>null</code>, if
134 * any of the key/values in the Map are <code>null</code>,
135 * if any of the keys is not a String, or if any of
136 * the values is not a String array.
137 */
138
139 public void setRenderParameters(java.util.Map parameters);
140
141
142 /**
143 * Sets a String parameter for the render request.
144 * <p/>
145 * These parameters will be accessible in all
146 * sub-sequent render calls via the
147 * <code>PortletRequest.getParameter</code> call until
148 * a request is targeted to the portlet.
149 * <p/>
150 * This method replaces all parameters with the given key.
151 * <p/>
152 * The given parameter do not need to be encoded
153 * prior to calling this method.
154 *
155 * @param key key of the render parameter
156 * @param value value of the render parameter
157 * @throws java.lang.IllegalStateException
158 * if the method is invoked after <code>sendRedirect</code> has been called.
159 * @exception java.lang.IllegalArgumentException if key or value are <code>null</code>.
160 */
161
162 public void setRenderParameter(String key, String value);
163
164
165 /**
166 * Sets a String array parameter for the render request.
167 * <p/>
168 * These parameters will be accessible in all
169 * sub-sequent render calls via the
170 * <code>PortletRequest.getParameter</code> call until
171 * a request is targeted to the portlet.
172 * <p/>
173 * This method replaces all parameters with the given key.
174 * <p/>
175 * The given parameter do not need to be encoded
176 * prior to calling this method.
177 *
178 * @param key key of the render parameter
179 * @param values values of the render parameter
180 * @throws java.lang.IllegalStateException
181 * if the method is invoked after <code>sendRedirect</code> has been called.
182 * @exception java.lang.IllegalArgumentException if key or value are <code>null</code>.
183 */
184
185 public void setRenderParameter(String key, String[] values);
186
187
188 }
189
190