You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2007/10/25 22:27:35 UTC
svn commit: r588339 [1/2] -
/myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/
Author: mmarinschek
Date: Thu Oct 25 13:27:34 2007
New Revision: 588339
URL: http://svn.apache.org/viewvc?rev=588339&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-1664 (MYFACES-1664): JSR-301 Implementation, initial commit
Modified:
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/ActionRequestDecorator.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/ActionResponseDecorator.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/BridgeRenderRequestWrapper.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/PortletRequestDecorator.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/PortletResponseDecorator.java
myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/RenderRequestDecorator.java
Modified: myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/ActionRequestDecorator.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/ActionRequestDecorator.java?rev=588339&r1=588338&r2=588339&view=diff
==============================================================================
--- myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/ActionRequestDecorator.java (original)
+++ myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/ActionRequestDecorator.java Thu Oct 25 13:27:34 2007
@@ -22,163 +22,127 @@
import javax.portlet.ActionRequest;
import javax.portlet.PortletRequest;
-
-public class ActionRequestDecorator
- extends PortletRequestDecorator
- implements ActionRequest
+public class ActionRequestDecorator extends PortletRequestDecorator implements ActionRequest
{
- private PortletRequest mRequest = null;
+ private PortletRequest mRequest = null;
+
+ public ActionRequestDecorator(ActionRequest request) throws IllegalArgumentException
+ {
- public ActionRequestDecorator(ActionRequest request)
- throws IllegalArgumentException
- {
-
- super(request);
- }
-
- /**
- * Retrieves the body of the HTTP request from client to
- * portal as binary data using
- * an <CODE>InputStream</CODE>. Either this method or
- * {@link #getReader} may be called to read the body, but not both.
- * <p>
- * For HTTP POST data of type application/x-www-form-urlencoded
- * this method throws an <code>IllegalStateException</code>
- * as this data has been already processed by the
- * portal/portlet-container and is available as request parameters.
- *
- * @return an input stream containing the body of the request
- *
- * @exception java.lang.IllegalStateException
- * if getReader was already called, or it is a
- * HTTP POST data of type application/x-www-form-urlencoded
- * @exception java.io.IOException
- * if an input or output exception occurred
- */
- public java.io.InputStream getPortletInputStream()
- throws java.io.IOException
- {
- // mRequest is a protected member of PortletRequestDecorator
- return ((ActionRequest) mRequest).getPortletInputStream();
- }
-
-
- /**
- * Overrides the name of the character encoding used in the body of this
- * request. This method must be called prior to reading input
- * using {@link #getReader} or {@link #getPortletInputStream}.
- * <p>
- * This method only sets the character set for the Reader that the
- * {@link #getReader} method returns.
- *
- * @param enc a <code>String</code> containing the name of
- * the chararacter encoding.
- *
- * @exception java.io.UnsupportedEncodingException if this is not a valid encoding
- * @exception java.lang.IllegalStateException if this method is called after
- * reading request parameters or reading input using
- * <code>getReader()</code>
- */
- public
-
- void setCharacterEncoding(String enc)
- throws java.io.UnsupportedEncodingException
- {
- // mRequest is a protected member of PortletRequestDecorator
- ((ActionRequest) mRequest).setCharacterEncoding(enc);
- }
-
-
- /**
- * Retrieves the body of the HTTP request from the client to the portal
- * as character data using
- * a <code>BufferedReader</code>. The reader translates the character
- * data according to the character encoding used on the body.
- * Either this method or {@link #getPortletInputStream} may be called to read the
- * body, not both.
- * <p>
- * For HTTP POST data of type application/x-www-form-urlencoded
- * this method throws an <code>IllegalStateException</code>
- * as this data has been already processed by the
- * portal/portlet-container and is available as request parameters.
- *
- * @return a <code>BufferedReader</code>
- * containing the body of the request
- *
- * @exception java.io.UnsupportedEncodingException
- * if the character set encoding used is
- * not supported and the text cannot be decoded
- * @exception java.lang.IllegalStateException
- * if {@link #getPortletInputStream} method
- * has been called on this request, it is a
- * HTTP POST data of type application/x-www-form-urlencoded.
- * @exception java.io.IOException
- * if an input or output exception occurred
- *
- * @see #getPortletInputStream
- */
- public
-
- java.io.BufferedReader getReader()
- throws java.io.UnsupportedEncodingException, java.io.IOException
- {
- // mRequest is a protected member of PortletRequestDecorator
- return ((ActionRequest) mRequest).getReader();
- }
-
-
- /**
- * Returns the name of the character encoding used in the body of this request.
- * This method returns <code>null</code> if the request
- * does not specify a character encoding.
- *
- * @return a <code>String</code> containing the name of
- * the chararacter encoding, or <code>null</code>
- * if the request does not specify a character encoding.
- */
- public
-
- java.lang.String getCharacterEncoding()
- {
- // mRequest is a protected member of PortletRequestDecorator
- return ((ActionRequest) mRequest).getCharacterEncoding();
- }
-
-
- /**
- * Returns the MIME type of the body of the request,
- * or null if the type is not known.
- *
- * @return a <code>String</code> containing the name
- * of the MIME type of the request, or null
- * if the type is not known.
- */
- public
-
- java.lang.String getContentType()
- {
- // mRequest is a protected member of PortletRequestDecorator
- return ((ActionRequest) mRequest).getContentType();
- }
-
-
- /**
- * Returns the length, in bytes, of the request body
- * which is made available by the input stream, or -1 if the
- * length is not known.
- *
- *
- * @return an integer containing the length of the
- * request body or -1 if the length is not known
- *
- */
- public
-
- int getContentLength()
- {
- // mRequest is a protected member of PortletRequestDecorator
- return ((ActionRequest) mRequest).getContentLength();
- }
+ super(request);
+ }
+ /**
+ * Retrieves the body of the HTTP request from client to portal as binary data using an
+ * <CODE>InputStream</CODE>. Either this method or {@link #getReader} may be called to read the
+ * body, but not both.
+ * <p>
+ * For HTTP POST data of type application/x-www-form-urlencoded this method throws an
+ * <code>IllegalStateException</code> as this data has been already processed by the
+ * portal/portlet-container and is available as request parameters.
+ *
+ * @return an input stream containing the body of the request
+ *
+ * @exception java.lang.IllegalStateException
+ * if getReader was already called, or it is a HTTP POST data of type
+ * application/x-www-form-urlencoded
+ * @exception java.io.IOException
+ * if an input or output exception occurred
+ */
+ public java.io.InputStream getPortletInputStream() throws java.io.IOException
+ {
+ // mRequest is a protected member of PortletRequestDecorator
+ return ((ActionRequest) mRequest).getPortletInputStream();
+ }
+
+ /**
+ * Overrides the name of the character encoding used in the body of this request. This method must
+ * be called prior to reading input using {@link #getReader} or {@link #getPortletInputStream}.
+ * <p>
+ * This method only sets the character set for the Reader that the {@link #getReader} method
+ * returns.
+ *
+ * @param enc
+ * a <code>String</code> containing the name of the chararacter encoding.
+ *
+ * @exception java.io.UnsupportedEncodingException
+ * if this is not a valid encoding
+ * @exception java.lang.IllegalStateException
+ * if this method is called after reading request parameters or reading input using
+ * <code>getReader()</code>
+ */
+ public void setCharacterEncoding(String enc) throws java.io.UnsupportedEncodingException
+ {
+ // mRequest is a protected member of PortletRequestDecorator
+ ((ActionRequest) mRequest).setCharacterEncoding(enc);
+ }
+
+ /**
+ * Retrieves the body of the HTTP request from the client to the portal as character data using a
+ * <code>BufferedReader</code>. The reader translates the character data according to the
+ * character encoding used on the body. Either this method or {@link #getPortletInputStream} may
+ * be called to read the body, not both.
+ * <p>
+ * For HTTP POST data of type application/x-www-form-urlencoded this method throws an
+ * <code>IllegalStateException</code> as this data has been already processed by the
+ * portal/portlet-container and is available as request parameters.
+ *
+ * @return a <code>BufferedReader</code> containing the body of the request
+ *
+ * @exception java.io.UnsupportedEncodingException
+ * if the character set encoding used is not supported and the text cannot be decoded
+ * @exception java.lang.IllegalStateException
+ * if {@link #getPortletInputStream} method has been called on this request, it is a
+ * HTTP POST data of type application/x-www-form-urlencoded.
+ * @exception java.io.IOException
+ * if an input or output exception occurred
+ *
+ * @see #getPortletInputStream
+ */
+ public java.io.BufferedReader getReader() throws java.io.UnsupportedEncodingException,
+ java.io.IOException
+ {
+ // mRequest is a protected member of PortletRequestDecorator
+ return ((ActionRequest) mRequest).getReader();
+ }
+
+ /**
+ * Returns the name of the character encoding used in the body of this request. This method
+ * returns <code>null</code> if the request does not specify a character encoding.
+ *
+ * @return a <code>String</code> containing the name of the chararacter encoding, or
+ * <code>null</code> if the request does not specify a character encoding.
+ */
+ public java.lang.String getCharacterEncoding()
+ {
+ // mRequest is a protected member of PortletRequestDecorator
+ return ((ActionRequest) mRequest).getCharacterEncoding();
+ }
+
+ /**
+ * Returns the MIME type of the body of the request, or null if the type is not known.
+ *
+ * @return a <code>String</code> containing the name of the MIME type of the request, or null if
+ * the type is not known.
+ */
+ public java.lang.String getContentType()
+ {
+ // mRequest is a protected member of PortletRequestDecorator
+ return ((ActionRequest) mRequest).getContentType();
+ }
+
+ /**
+ * Returns the length, in bytes, of the request body which is made available by the input stream,
+ * or -1 if the length is not known.
+ *
+ *
+ * @return an integer containing the length of the request body or -1 if the length is not known
+ *
+ */
+ public int getContentLength()
+ {
+ // mRequest is a protected member of PortletRequestDecorator
+ return ((ActionRequest) mRequest).getContentLength();
+ }
}
Modified: myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/ActionResponseDecorator.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/ActionResponseDecorator.java?rev=588339&r1=588338&r2=588339&view=diff
==============================================================================
--- myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/ActionResponseDecorator.java (original)
+++ myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/ActionResponseDecorator.java Thu Oct 25 13:27:34 2007
@@ -25,238 +25,201 @@
import javax.portlet.WindowState;
import javax.portlet.WindowStateException;
-
-public class ActionResponseDecorator
- extends PortletResponseDecorator
- implements ActionResponse
+public class ActionResponseDecorator extends PortletResponseDecorator implements ActionResponse
{
- public ActionResponseDecorator(ActionResponse response)
- throws IllegalArgumentException
- {
-
- super(response);
- }
-
- public ActionResponse getParent()
- {
- return (ActionResponse) super.getParent();
- }
-
- public ActionResponse getRoot()
- {
- return (ActionResponse) super.getRoot();
- }
-
- /**
- * Sets the window state of a portlet to the given window state.
- * <p>
- * Possible values are the standard window states and any custom
- * window states supported by the portal and the portlet.
- * Standard window states are:
- * <ul>
- * <li>MINIMIZED
- * <li>NORMAL
- * <li>MAXIMIZED
- * </ul>
- *
- * @param windowState
- * the new portlet window state
- *
- * @exception WindowStateException
- * if the portlet cannot switch to the specified window state.
- * To avoid this exception the portlet can check the allowed
- * window states with <code>Request.isWindowStateAllowed()</code>.
- * @exception java.lang.IllegalStateException
- * if the method is invoked after <code>sendRedirect</code> has been called.
- *
- * @see WindowState
- */
- public
-
- void setWindowState(WindowState windowState)
- throws WindowStateException
- {
- // mResponse is a protected memeber of PortletResponseDecorator
- ((ActionResponse) mResponse).setWindowState(windowState);
- }
-
-
- /**
- * Sets the portlet mode of a portlet to the given portlet mode.
- * <p>
- * Possible values are the standard portlet modes and any custom
- * portlet modes supported by the portal and the portlet. Portlets
- * must declare in the deployment descriptor the portlet modes they
- * support for each markup type.
- * Standard portlet modes are:
- * <ul>
- * <li>EDIT
- * <li>HELP
- * <li>VIEW
- * </ul>
- * <p>
- * Note: The portlet may still be called in a different window
- * state in the next render call, depending on the portlet container / portal.
- *
- * @param portletMode
- * the new portlet mode
- *
- * @exception PortletModeException
- * if the portlet cannot switch to this portlet mode,
- * because the portlet or portal does not support it for this markup,
- * or the current user is not allowed to switch to this portlet mode.
- * To avoid this exception the portlet can check the allowed
- * portlet modes with <code>Request.isPortletModeAllowed()</code>.
- * @exception java.lang.IllegalStateException
- * if the method is invoked after <code>sendRedirect</code> has been called.
- */
- public
-
- void setPortletMode(PortletMode portletMode)
- throws PortletModeException
- {
- // mResponse is a protected memeber of PortletResponseDecorator
- ((ActionResponse) mResponse).setPortletMode(portletMode);
- }
-
-
- /**
- * Instructs the portlet container to send a redirect response
- * to the client using the specified redirect location URL.
- * <p>
- * This method only accepts an absolute URL (e.g.
- * <code>http://my.co/myportal/mywebap/myfolder/myresource.gif</code>)
- * or a full path URI (e.g. <code>/myportal/mywebap/myfolder/myresource.gif</code>).
- * If required,
- * the portlet container may encode the given URL before the
- * redirection is issued to the client.
- * <p>
- * The sendRedirect method can not be invoked after any of the
- * following methods of the ActionResponse interface has been called:
- * <ul>
- * <li>setPortletMode
- * <li>setWindowState
- * <li>setRenderParameter
- * <li>setRenderParameters
- * </ul>
- *
- * @param location the redirect location URL
- *
- * @exception java.io.IOException
- * if an input or output exception occurs.
- * @exception java.lang.IllegalArgumentException
- * if a relative path URL is given
- * @exception java.lang.IllegalStateException
- * if the method is invoked after any of above mentioned methods of
- * the ActionResponse interface has been called.
- */
- public
-
- void sendRedirect(String location)
- throws java.io.IOException
- {
- // mResponse is a protected memeber of PortletResponseDecorator
- ((ActionResponse) mResponse).sendRedirect(location);
- }
-
-
- /**
- * Sets a parameter map for the render request.
- * <p>
- * All previously set render parameters are cleared.
- * <p>
- * These parameters will be accessible in all
- * sub-sequent render calls via the
- * <code>PortletRequest.getParameter</code> call until
- * a new request is targeted to the portlet.
- * <p>
- * The given parameters do not need to be encoded
- * prior to calling this method.
- *
- * @param parameters Map containing parameter names for
- * the render phase as
- * keys and parameter values as map
- * values. The keys in the parameter
- * map must be of type String. The values
- * in the parameter map must be of type
- * String array (<code>String[]</code>).
- *
- * @exception java.lang.IllegalArgumentException
- * if parameters is <code>null</code>, if
- * any of the key/values in the Map are <code>null</code>,
- * if any of the keys is not a String, or if any of
- * the values is not a String array.
- * @exception java.lang.IllegalStateException
- * if the method is invoked after <code>sendRedirect</code> has been called.
- */
- public
-
- void setRenderParameters(java.util.Map parameters)
- {
- // mResponse is a protected memeber of PortletResponseDecorator
- ((ActionResponse) mResponse).setRenderParameters(parameters);
- }
-
-
- /**
- * Sets a String parameter for the render request.
- * <p>
- * These parameters will be accessible in all
- * sub-sequent render calls via the
- * <code>PortletRequest.getParameter</code> call until
- * a request is targeted to the portlet.
- * <p>
- * This method replaces all parameters with the given key.
- * <p>
- * The given parameter do not need to be encoded
- * prior to calling this method.
- *
- * @param key key of the render parameter
- * @param value value of the render parameter
- *
- * @exception java.lang.IllegalArgumentException
- * if key or value are <code>null</code>.
- * @exception java.lang.IllegalStateException
- * if the method is invoked after <code>sendRedirect</code> has been called.
- */
- public
-
- void setRenderParameter(String key, String value)
- {
- // mResponse is a protected memeber of PortletResponseDecorator
- ((ActionResponse) mResponse).setRenderParameter(key, value);
- }
-
-
- /**
- * Sets a String array parameter for the render request.
- * <p>
- * These parameters will be accessible in all
- * sub-sequent render calls via the
- * <code>PortletRequest.getParameter</code> call until
- * a request is targeted to the portlet.
- * <p>
- * This method replaces all parameters with the given key.
- * <p>
- * The given parameter do not need to be encoded
- * prior to calling this method.
- *
- * @param key key of the render parameter
- * @param values values of the render parameter
- *
- * @exception java.lang.IllegalArgumentException
- * if key or value are <code>null</code>.
- * @exception java.lang.IllegalStateException
- * if the method is invoked after <code>sendRedirect</code> has been called.
- */
- public
-
- void setRenderParameter(String key, String[] values)
- {
- // mResponse is a protected memeber of PortletResponseDecorator
- ((ActionResponse) mResponse).setRenderParameter(key, values);
- }
+ public ActionResponseDecorator(ActionResponse response) throws IllegalArgumentException
+ {
+
+ super(response);
+ }
+ @Override
+ public ActionResponse getParent()
+ {
+ return (ActionResponse) super.getParent();
+ }
+
+ @Override
+ public ActionResponse getRoot()
+ {
+ return (ActionResponse) super.getRoot();
+ }
+
+ /**
+ * Sets the window state of a portlet to the given window state.
+ * <p>
+ * Possible values are the standard window states and any custom window states supported by the
+ * portal and the portlet. Standard window states are:
+ * <ul>
+ * <li>MINIMIZED
+ * <li>NORMAL
+ * <li>MAXIMIZED
+ * </ul>
+ *
+ * @param windowState
+ * the new portlet window state
+ *
+ * @exception WindowStateException
+ * if the portlet cannot switch to the specified window state. To avoid this
+ * exception the portlet can check the allowed window states with
+ * <code>Request.isWindowStateAllowed()</code>.
+ * @exception java.lang.IllegalStateException
+ * if the method is invoked after <code>sendRedirect</code> has been called.
+ *
+ * @see WindowState
+ */
+ public void setWindowState(WindowState windowState) throws WindowStateException
+ {
+ // mResponse is a protected memeber of PortletResponseDecorator
+ ((ActionResponse) mResponse).setWindowState(windowState);
+ }
+
+ /**
+ * Sets the portlet mode of a portlet to the given portlet mode.
+ * <p>
+ * Possible values are the standard portlet modes and any custom portlet modes supported by the
+ * portal and the portlet. Portlets must declare in the deployment descriptor the portlet modes
+ * they support for each markup type. Standard portlet modes are:
+ * <ul>
+ * <li>EDIT
+ * <li>HELP
+ * <li>VIEW
+ * </ul>
+ * <p>
+ * Note: The portlet may still be called in a different window state in the next render call,
+ * depending on the portlet container / portal.
+ *
+ * @param portletMode
+ * the new portlet mode
+ *
+ * @exception PortletModeException
+ * if the portlet cannot switch to this portlet mode, because the portlet or portal
+ * does not support it for this markup, or the current user is not allowed to switch
+ * to this portlet mode. To avoid this exception the portlet can check the allowed
+ * portlet modes with <code>Request.isPortletModeAllowed()</code>.
+ * @exception java.lang.IllegalStateException
+ * if the method is invoked after <code>sendRedirect</code> has been called.
+ */
+ public void setPortletMode(PortletMode portletMode) throws PortletModeException
+ {
+ // mResponse is a protected memeber of PortletResponseDecorator
+ ((ActionResponse) mResponse).setPortletMode(portletMode);
+ }
+
+ /**
+ * Instructs the portlet container to send a redirect response to the client using the specified
+ * redirect location URL.
+ * <p>
+ * This method only accepts an absolute URL (e.g.
+ * <code>http://my.co/myportal/mywebap/myfolder/myresource.gif</code>) or a full path URI (e.g.
+ * <code>/myportal/mywebap/myfolder/myresource.gif</code>). If required, the portlet container
+ * may encode the given URL before the redirection is issued to the client.
+ * <p>
+ * The sendRedirect method can not be invoked after any of the following methods of the
+ * ActionResponse interface has been called:
+ * <ul>
+ * <li>setPortletMode
+ * <li>setWindowState
+ * <li>setRenderParameter
+ * <li>setRenderParameters
+ * </ul>
+ *
+ * @param location
+ * the redirect location URL
+ *
+ * @exception java.io.IOException
+ * if an input or output exception occurs.
+ * @exception java.lang.IllegalArgumentException
+ * if a relative path URL is given
+ * @exception java.lang.IllegalStateException
+ * if the method is invoked after any of above mentioned methods of the
+ * ActionResponse interface has been called.
+ */
+ public void sendRedirect(String location) throws java.io.IOException
+ {
+ // mResponse is a protected memeber of PortletResponseDecorator
+ ((ActionResponse) mResponse).sendRedirect(location);
+ }
+
+ /**
+ * Sets a parameter map for the render request.
+ * <p>
+ * All previously set render parameters are cleared.
+ * <p>
+ * These parameters will be accessible in all sub-sequent render calls via the
+ * <code>PortletRequest.getParameter</code> call until a new request is targeted to the portlet.
+ * <p>
+ * The given parameters do not need to be encoded prior to calling this method.
+ *
+ * @param parameters
+ * Map containing parameter names for the render phase as keys and parameter values as
+ * map values. The keys in the parameter map must be of type String. The values in the
+ * parameter map must be of type String array (<code>String[]</code>).
+ *
+ * @exception java.lang.IllegalArgumentException
+ * if parameters is <code>null</code>, if any of the key/values in the Map are
+ * <code>null</code>, if any of the keys is not a String, or if any of the values
+ * is not a String array.
+ * @exception java.lang.IllegalStateException
+ * if the method is invoked after <code>sendRedirect</code> has been called.
+ */
+ public void setRenderParameters(java.util.Map parameters)
+ {
+ // mResponse is a protected memeber of PortletResponseDecorator
+ ((ActionResponse) mResponse).setRenderParameters(parameters);
+ }
+
+ /**
+ * Sets a String parameter for the render request.
+ * <p>
+ * These parameters will be accessible in all sub-sequent render calls via the
+ * <code>PortletRequest.getParameter</code> call until a request is targeted to the portlet.
+ * <p>
+ * This method replaces all parameters with the given key.
+ * <p>
+ * The given parameter do not need to be encoded prior to calling this method.
+ *
+ * @param key
+ * key of the render parameter
+ * @param value
+ * value of the render parameter
+ *
+ * @exception java.lang.IllegalArgumentException
+ * if key or value are <code>null</code>.
+ * @exception java.lang.IllegalStateException
+ * if the method is invoked after <code>sendRedirect</code> has been called.
+ */
+ public void setRenderParameter(String key, String value)
+ {
+ // mResponse is a protected memeber of PortletResponseDecorator
+ ((ActionResponse) mResponse).setRenderParameter(key, value);
+ }
+
+ /**
+ * Sets a String array parameter for the render request.
+ * <p>
+ * These parameters will be accessible in all sub-sequent render calls via the
+ * <code>PortletRequest.getParameter</code> call until a request is targeted to the portlet.
+ * <p>
+ * This method replaces all parameters with the given key.
+ * <p>
+ * The given parameter do not need to be encoded prior to calling this method.
+ *
+ * @param key
+ * key of the render parameter
+ * @param values
+ * values of the render parameter
+ *
+ * @exception java.lang.IllegalArgumentException
+ * if key or value are <code>null</code>.
+ * @exception java.lang.IllegalStateException
+ * if the method is invoked after <code>sendRedirect</code> has been called.
+ */
+ public void setRenderParameter(String key, String[] values)
+ {
+ // mResponse is a protected memeber of PortletResponseDecorator
+ ((ActionResponse) mResponse).setRenderParameter(key, values);
+ }
}
Modified: myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/BridgeRenderRequestWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/BridgeRenderRequestWrapper.java?rev=588339&r1=588338&r2=588339&view=diff
==============================================================================
--- myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/BridgeRenderRequestWrapper.java (original)
+++ myfaces/portlet-bridge/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/wrapper/BridgeRenderRequestWrapper.java Thu Oct 25 13:27:34 2007
@@ -26,185 +26,173 @@
import java.util.Map;
import java.util.Set;
-import org.apache.myfaces.portlet.faces.bridge.wrapper.RenderRequestDecorator;
-
import javax.portlet.RenderRequest;
-
-public class BridgeRenderRequestWrapper
- extends RenderRequestDecorator
+public class BridgeRenderRequestWrapper extends RenderRequestDecorator
{
- private Map mActionParams = null;
- private Map mCombinedParamMap = null;
+ private Map mActionParams = null;
+ private Map mCombinedParamMap = null;
- public BridgeRenderRequestWrapper(RenderRequest request, Map actionParams)
- throws IllegalArgumentException
+ public BridgeRenderRequestWrapper(RenderRequest request, Map actionParams)
+ throws IllegalArgumentException
+ {
+ super(request);
+
+ mActionParams = actionParams;
+ }
+
+ /**
+ * Returns the value of a request parameter as a <code>String</code>, or <code>null</code> if
+ * the parameter does not exist. Request parameters are extra information sent with the request.
+ * The returned parameter are "x-www-form-urlencoded" decoded.
+ * <p>
+ * Only parameters targeted to the current portlet are accessible.
+ * <p>
+ * This method should only be used if the parameter has only one value. If the parameter might
+ * have more than one value, use {@link #getParameterValues}.
+ * <p>
+ * If this method is used with a multivalued parameter, the value returned is equal to the first
+ * value in the array returned by <code>getParameterValues</code>.
+ *
+ *
+ *
+ * @param name
+ * a <code>String</code> specifying the name of the parameter
+ *
+ * @return a <code>String</code> representing the single value of the parameter
+ *
+ * @see #getParameterValues
+ *
+ * @exception java.lang.IllegalArgumentException
+ * if name is <code>null</code>.
+ *
+ */
+ @Override
+ public String getParameter(String name)
+ {
+ String[] params = getParameterValues(name);
+ if (params != null && params.length > 0)
{
- super(request);
-
- mActionParams = actionParams;
+ return params[0];
}
-
- /**
- * Returns the value of a request parameter as a <code>String</code>,
- * or <code>null</code> if the parameter does not exist. Request parameters
- * are extra information sent with the request. The returned parameter
- * are "x-www-form-urlencoded" decoded.
- * <p>
- * Only parameters targeted to the current portlet are accessible.
- * <p>
- * This method should only be used if the
- * parameter has only one value. If the parameter might have
- * more than one value, use {@link #getParameterValues}.
- * <p>
- * If this method is used with a multivalued
- * parameter, the value returned is equal to the first value
- * in the array returned by <code>getParameterValues</code>.
- *
- *
- *
- * @param name a <code>String</code> specifying the
- * name of the parameter
- *
- * @return a <code>String</code> representing the
- * single value of the parameter
- *
- * @see #getParameterValues
- *
- * @exception java.lang.IllegalArgumentException
- * if name is <code>null</code>.
- *
- */
- public String getParameter(String name)
+ else
{
- String[] params = getParameterValues(name);
- if (params != null && params.length > 0)
- return params[0];
- else
- return null;
+ return null;
}
+ }
-
- /**
- *
- * Returns an <code>Enumeration</code> of <code>String</code>
- * objects containing the names of the parameters contained
- * in this request. If the request has
- * no parameters, the method returns an
- * empty <code>Enumeration</code>.
- * <p>
- * Only parameters targeted to the current portlet are returned.
- *
- *
- * @return an <code>Enumeration</code> of <code>String</code>
- * objects, each <code>String</code> containing
- * the name of a request parameter; or an
- * empty <code>Enumeration</code> if the
- * request has no parameters.
- */
- public Enumeration getParameterNames()
+ /**
+ *
+ * Returns an <code>Enumeration</code> of <code>String</code> objects containing the names of
+ * the parameters contained in this request. If the request has no parameters, the method returns
+ * an empty <code>Enumeration</code>.
+ * <p>
+ * Only parameters targeted to the current portlet are returned.
+ *
+ *
+ * @return an <code>Enumeration</code> of <code>String</code> objects, each
+ * <code>String</code> containing the name of a request parameter; or an empty
+ * <code>Enumeration</code> if the request has no parameters.
+ */
+ @Override
+ public Enumeration getParameterNames()
+ {
+ final Enumeration e = Collections.enumeration(getParameterMap().entrySet());
+ Enumeration en = new Enumeration() {
+ public boolean hasMoreElements()
+ {
+ return e.hasMoreElements();
+ }
+
+ public Object nextElement()
+ {
+ Map.Entry entry = (Map.Entry) e.nextElement();
+ return entry.getKey();
+ }
+ };
+
+ return en;
+ }
+
+ /**
+ * Returns an array of <code>String</code> objects containing all of the values the given
+ * request parameter has, or <code>null</code> if the parameter does not exist. The returned
+ * parameters are "x-www-form-urlencoded" decoded.
+ * <p>
+ * If the parameter has a single value, the array has a length of 1.
+ *
+ *
+ * @param name
+ * a <code>String</code> containing the name of the parameter the value of which is
+ * requested
+ *
+ * @return an array of <code>String</code> objects containing the parameter values.
+ *
+ * @see #getParameter
+ *
+ * @exception java.lang.IllegalArgumentException
+ * if name is <code>null</code>.
+ *
+ */
+ @Override
+ public String[] getParameterValues(String name)
+ {
+ if (name == null)
{
- final Enumeration e = Collections.enumeration(getParameterMap().entrySet());
- Enumeration en = new Enumeration()
- {
- public boolean hasMoreElements()
- {
- return e.hasMoreElements();
- }
-
- public Object nextElement()
- {
- Map.Entry entry = (Map.Entry) e.nextElement();
- return entry.getKey();
- }
- };
-
- return en;
+ throw new IllegalArgumentException();
}
+ return (String[]) getParameterMap().get(name);
- /**
- * Returns an array of <code>String</code> objects containing
- * all of the values the given request parameter has, or
- * <code>null</code> if the parameter does not exist.
- * The returned parameters are "x-www-form-urlencoded" decoded.
- * <p>
- * If the parameter has a single value, the array has a length
- * of 1.
- *
- *
- * @param name a <code>String</code> containing the name of
- * the parameter the value of which is requested
- *
- * @return an array of <code>String</code> objects
- * containing the parameter values.
- *
- * @see #getParameter
- *
- * @exception java.lang.IllegalArgumentException
- * if name is <code>null</code>.
- *
- */
- public String[] getParameterValues(String name)
- {
- if (name == null)
- throw new IllegalArgumentException();
-
- return (String[]) getParameterMap().get(name);
-
- }
-
+ }
- /**
- * Returns a <code>Map</code> of the parameters of this request.
- * Request parameters are extra information sent with the request.
- * The returned parameters are "x-www-form-urlencoded" decoded.
- * <p>
- * The values in the returned <code>Map</code> are from type
- * String array (<code>String[]</code>).
- * <p>
- * If no parameters exist this method returns an empty <code>Map</code>.
- *
- * @return an immutable <code>Map</code> containing parameter names as
- * keys and parameter values as map values, or an empty <code>Map</code>
- * if no parameters exist. The keys in the parameter
- * map are of type String. The values in the parameter map are of type
- * String array (<code>String[]</code>).
- */
- public java.util.Map getParameterMap()
+ /**
+ * Returns a <code>Map</code> of the parameters of this request. Request parameters are extra
+ * information sent with the request. The returned parameters are "x-www-form-urlencoded" decoded.
+ * <p>
+ * The values in the returned <code>Map</code> are from type String array (<code>String[]</code>).
+ * <p>
+ * If no parameters exist this method returns an empty <code>Map</code>.
+ *
+ * @return an immutable <code>Map</code> containing parameter names as keys and parameter values
+ * as map values, or an empty <code>Map</code> if no parameters exist. The keys in the
+ * parameter map are of type String. The values in the parameter map are of type String
+ * array (<code>String[]</code>).
+ */
+ @Override
+ public java.util.Map getParameterMap()
+ {
+ if (mActionParams != null && !mActionParams.isEmpty())
{
- if (mActionParams != null && !mActionParams.isEmpty())
+ if (mCombinedParamMap == null)
+ {
+ mCombinedParamMap = new LinkedHashMap(getParent().getParameterMap());
+
+ // now walk through the actionParams adding those that aren't
+ // already in the ParameterMap
+ Set s = mActionParams.entrySet();
+ if (s != null)
{
- if (mCombinedParamMap == null)
+ Iterator entries = s.iterator();
+ while (entries != null && entries.hasNext())
+ {
+ Map.Entry entry = (Map.Entry) entries.next();
+ String key = (String) entry.getKey();
+ if (!mCombinedParamMap.containsKey(key))
{
- mCombinedParamMap = new LinkedHashMap(this.getParent().getParameterMap());
-
- // now walk through the actionParams adding those that aren't
- // already in the ParameterMap
- Set s = mActionParams.entrySet();
- if (s != null)
- {
- Iterator entries = s.iterator();
- while (entries != null && entries.hasNext())
- {
- Map.Entry entry = (Map.Entry) entries.next();
- String key = (String) entry.getKey();
- if (!mCombinedParamMap.containsKey(key))
- {
- mCombinedParamMap.put(key, entry.getValue());
- }
- }
- // now make this an immutable Map
- mCombinedParamMap = Collections.unmodifiableMap(mCombinedParamMap);
- }
+ mCombinedParamMap.put(key, entry.getValue());
}
- return mCombinedParamMap;
- }
- else
- {
- return null;
+ }
+ // now make this an immutable Map
+ mCombinedParamMap = Collections.unmodifiableMap(mCombinedParamMap);
}
+ }
+ return mCombinedParamMap;
}
-
+ else
+ {
+ return null;
+ }
+ }
}