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 the new portlet window state
033: * @throws WindowStateException if the portlet cannot switch to the specified window state.
034: * To avoid this exception the portlet can check the allowed
035: * window states with <code>Request.isWindowStateAllowed()</code>.
036: * @throws java.lang.IllegalStateException
037: * if the method is invoked after <code>sendRedirect</code> has been called.
038: * @see WindowState
039: */
040:
041: public void setWindowState(WindowState windowState)
042: throws WindowStateException;
043:
044: /**
045: * Sets the portlet mode of a portlet to the given portlet mode.
046: * <p/>
047: * Possible values are the standard portlet modes and any custom
048: * portlet modes supported by the portal and the portlet. Portlets
049: * must declare in the deployment descriptor the portlet modes they
050: * support for each markup type.
051: * Standard portlet modes are:
052: * <ul>
053: * <li>EDIT
054: * <li>HELP
055: * <li>VIEW
056: * </ul>
057: * <p/>
058: * Note: The portlet may still be called in a different window
059: * state in the next render call, depending on the portlet container / portal.
060: *
061: * @param portletMode the new portlet mode
062: * @throws PortletModeException if the portlet cannot switch to this portlet mode,
063: * because the portlet or portal does not support it for this markup,
064: * or the current user is not allowed to switch to this portlet mode.
065: * To avoid this exception the portlet can check the allowed
066: * portlet modes with <code>Request.isPortletModeAllowed()</code>.
067: * @throws java.lang.IllegalStateException
068: * if the method is invoked after <code>sendRedirect</code> has been called.
069: */
070:
071: public void setPortletMode(PortletMode portletMode)
072: throws PortletModeException;
073:
074: /**
075: * Instructs the portlet container to send a redirect response
076: * to the client using the specified redirect location URL.
077: * <p/>
078: * This method only accepts an absolute URL (e.g.
079: * <code>http://my.co/myportal/mywebap/myfolder/myresource.gif</code>)
080: * or a full path URI (e.g. <code>/myportal/mywebap/myfolder/myresource.gif</code>).
081: * If required,
082: * the portlet container may encode the given URL before the
083: * redirection is issued to the client.
084: * <p/>
085: * The sendRedirect method can not be invoked after any of the
086: * following methods of the ActionResponse interface has been called:
087: * <ul>
088: * <li>setPortletMode
089: * <li>setWindowState
090: * <li>setRenderParameter
091: * <li>setRenderParameters
092: * </ul>
093: *
094: * @throws java.lang.IllegalStateException
095: * if the method is invoked after any of above mentioned methods of
096: * the ActionResponse interface has been called.
097: * @param location the redirect location URL
098: * @exception java.io.IOException if an input or output exception occurs.
099: * @exception java.lang.IllegalArgumentException if a relative path URL is given
100: */
101:
102: public void sendRedirect(String location)
103: throws java.io.IOException;
104:
105: /**
106: * Sets a parameter map for the render request.
107: * <p/>
108: * All previously set render parameters are cleared.
109: * <p/>
110: * These parameters will be accessible in all
111: * sub-sequent render calls via the
112: * <code>PortletRequest.getParameter</code> call until
113: * a new request is targeted to the portlet.
114: * <p/>
115: * The given parameters do not need to be encoded
116: * prior to calling this method.
117: *
118: * @param parameters Map containing parameter names for
119: * the render phase as
120: * keys and parameter values as map
121: * values. The keys in the parameter
122: * map must be of type String. The values
123: * in the parameter map must be of type
124: * String array (<code>String[]</code>).
125: * @throws java.lang.IllegalStateException
126: * if the method is invoked after <code>sendRedirect</code> has been called.
127: * @exception java.lang.IllegalArgumentException if parameters is <code>null</code>, if
128: * any of the key/values in the Map are <code>null</code>,
129: * if any of the keys is not a String, or if any of
130: * the values is not a String array.
131: */
132:
133: public void setRenderParameters(java.util.Map parameters);
134:
135: /**
136: * Sets a String parameter for the render request.
137: * <p/>
138: * These parameters will be accessible in all
139: * sub-sequent render calls via the
140: * <code>PortletRequest.getParameter</code> call until
141: * a request is targeted to the portlet.
142: * <p/>
143: * This method replaces all parameters with the given key.
144: * <p/>
145: * The given parameter do not need to be encoded
146: * prior to calling this method.
147: *
148: * @param key key of the render parameter
149: * @param value value of the render parameter
150: * @throws java.lang.IllegalStateException
151: * if the method is invoked after <code>sendRedirect</code> has been called.
152: * @exception java.lang.IllegalArgumentException if key or value are <code>null</code>.
153: */
154:
155: public void setRenderParameter(String key, String value);
156:
157: /**
158: * Sets a String array parameter for the render request.
159: * <p/>
160: * These parameters will be accessible in all
161: * sub-sequent render calls via the
162: * <code>PortletRequest.getParameter</code> call until
163: * a request is targeted to the portlet.
164: * <p/>
165: * This method replaces all parameters with the given key.
166: * <p/>
167: * The given parameter do not need to be encoded
168: * prior to calling this method.
169: *
170: * @param key key of the render parameter
171: * @param values values of the render parameter
172: * @throws java.lang.IllegalStateException
173: * if the method is invoked after <code>sendRedirect</code> has been called.
174: * @exception java.lang.IllegalArgumentException if key or value are <code>null</code>.
175: */
176:
177: public void setRenderParameter(String key, String[] values);
178:
179: }
|