Hello,

If I set a request attribute in processAction()  on ActionRequest which extends 
PortletRequest, I find that it is not available during render() on the 
RenderRequest which also extends PortletRequest.  I have reviewed the JSR spec 
and quoted relevant sections below.  From my review, it seems to me like there 
is some ambiguity.  In PLT.11.1.3, request attributes are intented "...to 
express information that otherwise could not be expressed via the API."  From 
PLT.11.4, it seems like there isn't necessarily a guarantee that the objects 
placed in request scope during processAction() are available in render().

If the attributes are not going to be preserved going from processAction() to 
render() for a single portlet, then what is the point of setting request 
attributes during processAction()?  Since you don't get a RenderRequest-view of 
the same PortletRequest later on in render(), who are you communicating with 
(from a portlet perspective)?  If the portlet API supports the concept of 
setting request attributes, I think it would be nice to be able to retrieve 
these same request attributes during the render() phase of a portal request.   
Ideally, the ActionRequest and the RenderRequest can be two different 'views' 
of a single PortletRequest during a request process.

I realize that I can use PortletSession to 'communicate' between 
processAction() and render() phases, but then I must also remember to remove my 
attributes from PortletSession if these attributes are really only valid for a 
single request.

Thoughts?

Thanks,
Brad Smith


>From JSR 168 Specification
anonymous wrote : 
  | PLT.11.1.3 Request Attributes
  | 
  | Request attributes are objects associated with a portlet during a single 
portlet request.  Request attributes may be set by the portlet or the portlet 
container to express information that otherwise could not be expressed via the 
API. Request attributes can be used to share information with a servlet or JSP 
being included via the PortletRequestDispatcher.  Attributes are set, obtained 
and removed using the following methods of the
  | 
  | PortletRequest interface:
  | ? getAttribute
  | ? getAttributeNames
  | ? setAttribute
  | ? removeAttribute
  | 
  | Only one attribute value may be associated with an attribute name.
  | Attribute names beginning with the ?javax.portlet.? prefix are reserved for 
definition by this specification. It is suggested that all attributes placed 
into the attribute set be named in accordance with the reverse domain name 
convention suggested by the Java Programming Language Specification 1 for 
package naming.
  | 
  | ....
  | 
  | PLT.11.2 ActionRequest Interface
  | 
  | The ActionRequest interface extends the PortletRequest interface and it is 
used in the processAction method of the Portlet interface. In addition to the 
functionality provided by the PortletRequest interface, the ActionRequest 
interface gives access to the input stream of the request.
  | 
  | PLT.11.3 RenderRequest Interface
  | 
  | The RenderRequest interface extends the PortletRequest interface and is 
used in the render method of the Portlet interface. Currently, the 
RenderRequest interface does not define any additional method.
  | 
  | PLT.11.4 Lifetime of the Request Objects
  | 
  | Each request object is valid only within the scope of a particular 
processAction or render method call. Containers commonly recycle request 
objects in order to avoid the performance overhead of request object creation. 
The developer must be aware that maintaining references to request objects 
outside the scope described above may lead to
  | non-deterministic behavior
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3900439#3900439

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3900439


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to