001: /**
002: * Copyright 2003 IBM Corporation and Sun Microsystems, Inc.
003: * All rights reserved.
004: * Use is subject to license terms.
005: */package javax.portlet;
006:
007: /**
008: * The <CODE>ActionResponse</CODE> interface represents the portlet
009: * response to an action request.
010: * It extends the <CODE>PortletResponse</CODE> interface to provide specific
011: * action response functionality to portlets.<br>
012: * The portlet container creates an <CODE>ActionResponse</CODE> object and
013: * passes it as argument to the portlet's <CODE>processAction</CODE> method.
014: *
015: * @see ActionRequest
016: * @see PortletResponse
017: */
018: public interface ActionResponse extends PortletResponse {
019:
020: /**
021: * Sets the window state of a portlet to the given window state.
022: * <p>
023: * Possible values are the standard window states and any custom
024: * window states supported by the portal and the portlet.
025: * Standard window states are:
026: * <ul>
027: * <li>MINIMIZED
028: * <li>NORMAL
029: * <li>MAXIMIZED
030: * </ul>
031: *
032: * @param windowState
033: * the new portlet window state
034: *
035: * @exception WindowStateException
036: * if the portlet cannot switch to the specified window state.
037: * To avoid this exception the portlet can check the allowed
038: * window states with <code>Request.isWindowStateAllowed()</code>.
039: * @exception java.lang.IllegalStateException
040: * if the method is invoked after <code>sendRedirect</code> has been called.
041: *
042: * @see WindowState
043: */
044:
045: public void setWindowState(WindowState windowState)
046: throws WindowStateException;
047:
048: /**
049: * Sets the portlet mode of a portlet to the given portlet mode.
050: * <p>
051: * Possible values are the standard portlet modes and any custom
052: * portlet modes supported by the portal and the portlet. Portlets
053: * must declare in the deployment descriptor the portlet modes they
054: * support for each markup type.
055: * Standard portlet modes are:
056: * <ul>
057: * <li>EDIT
058: * <li>HELP
059: * <li>VIEW
060: * </ul>
061: * <p>
062: * Note: The portlet may still be called in a different window
063: * state in the next render call, depending on the portlet container / portal.
064: *
065: * @param portletMode
066: * the new portlet mode
067: *
068: * @exception PortletModeException
069: * if the portlet cannot switch to this portlet mode,
070: * because the portlet or portal does not support it for this markup,
071: * or the current user is not allowed to switch to this portlet mode.
072: * To avoid this exception the portlet can check the allowed
073: * portlet modes with <code>Request.isPortletModeAllowed()</code>.
074: * @exception java.lang.IllegalStateException
075: * if the method is invoked after <code>sendRedirect</code> has been called.
076: */
077:
078: public void setPortletMode(PortletMode portletMode)
079: throws PortletModeException;
080:
081: /**
082: * Instructs the portlet container to send a redirect response
083: * to the client using the specified redirect location URL.
084: * <p>
085: * This method only accepts an absolute URL (e.g.
086: * <code>http://my.co/myportal/mywebap/myfolder/myresource.gif</code>)
087: * or a full path URI (e.g. <code>/myportal/mywebap/myfolder/myresource.gif</code>).
088: * If required,
089: * the portlet container may encode the given URL before the
090: * redirection is issued to the client.
091: * <p>
092: * The sendRedirect method can not be invoked after any of the
093: * following methods of the ActionResponse interface has been called:
094: * <ul>
095: * <li>setPortletMode
096: * <li>setWindowState
097: * <li>setRenderParameter
098: * <li>setRenderParameters
099: * </ul>
100: *
101: * @param location the redirect location URL
102: *
103: * @exception java.io.IOException
104: * if an input or output exception occurs.
105: * @exception java.lang.IllegalArgumentException
106: * if a relative path URL is given
107: * @exception java.lang.IllegalStateException
108: * if the method is invoked after any of above mentioned methods of
109: * the ActionResponse interface has been called.
110: */
111:
112: public void sendRedirect(String location)
113: throws java.io.IOException;
114:
115: /**
116: * Sets a parameter map for the render request.
117: * <p>
118: * All previously set render parameters are cleared.
119: * <p>
120: * These parameters will be accessible in all
121: * sub-sequent render calls via the
122: * <code>PortletRequest.getParameter</code> call until
123: * a new request is targeted to the portlet.
124: * <p>
125: * The given parameters do not need to be encoded
126: * prior to calling this method.
127: *
128: * @param parameters Map containing parameter names for
129: * the render phase as
130: * keys and parameter values as map
131: * values. The keys in the parameter
132: * map must be of type String. The values
133: * in the parameter map must be of type
134: * String array (<code>String[]</code>).
135: *
136: * @exception java.lang.IllegalArgumentException
137: * if parameters is <code>null</code>, if
138: * any of the key/values in the Map are <code>null</code>,
139: * if any of the keys is not a String, or if any of
140: * the values is not a String array.
141: * @exception java.lang.IllegalStateException
142: * if the method is invoked after <code>sendRedirect</code> has been called.
143: */
144:
145: public void setRenderParameters(java.util.Map parameters);
146:
147: /**
148: * Sets a String parameter for the render request.
149: * <p>
150: * These parameters will be accessible in all
151: * sub-sequent render calls via the
152: * <code>PortletRequest.getParameter</code> call until
153: * a request is targeted to the portlet.
154: * <p>
155: * This method replaces all parameters with the given key.
156: * <p>
157: * The given parameter do not need to be encoded
158: * prior to calling this method.
159: *
160: * @param key key of the render parameter
161: * @param value value of the render parameter
162: *
163: * @exception java.lang.IllegalArgumentException
164: * if key or value are <code>null</code>.
165: * @exception java.lang.IllegalStateException
166: * if the method is invoked after <code>sendRedirect</code> has been called.
167: */
168:
169: public void setRenderParameter(String key, String value);
170:
171: /**
172: * Sets a String array parameter for the render request.
173: * <p>
174: * These parameters will be accessible in all
175: * sub-sequent render calls via the
176: * <code>PortletRequest.getParameter</code> call until
177: * a request is targeted to the portlet.
178: * <p>
179: * This method replaces all parameters with the given key.
180: * <p>
181: * The given parameter do not need to be encoded
182: * prior to calling this method.
183: *
184: * @param key key of the render parameter
185: * @param values values of the render parameter
186: *
187: * @exception java.lang.IllegalArgumentException
188: * if key or value are <code>null</code>.
189: * @exception java.lang.IllegalStateException
190: * if the method is invoked after <code>sendRedirect</code> has been called.
191: */
192:
193: public void setRenderParameter(String key, String[] values);
194:
195: }
|