I found the answer. Yes, portletentityregistry.xml will have the stored preferences. There is one caveat. In order for the store to work, you must get the preferences during an action request. The spec says you have to store during an action request but not that you must GET the preferences during an action request. In Pluto, the preferences are instantiated when you get them from the PortletRequest. When the preferences are instantiated, the request type is passed in. Here's the code from RenderRequestImpl.getPreferences().

       if (portletPreferences == null) {
           portletPreferences = PortletObjectAccess.getPortletPreferences(
               org.apache.pluto.Constants.METHOD_RENDER,
               super.getInternalPortletWindow().getPortletEntity()
           );
       }
PortletObjectAccess uses a factory to instantiate the preferences. The bottom line is this, when you get the preferences, the request type (render or action) is always associated with that instance of the preferences. The implication is that you can not get the preferences in a session context, keep them around, change them and then store them during an action request. The workaround, of course, is to get the preferences from the action request just before you store.

This implementation seems cumbersome for frameworks such as JSF or Struts. If you look at JSR-168 on this topic, however, you can see why the implementor(s) chose this design. Here's the paragraph:

PLT 14.1 "Portlets have access to their preferences attributes through the PortletPreferences interface. Portlets have access to the associated PortletPreferences object while they are processing requests. Portlets may only modify preferences attributes during a processAction invocation."

For more information, please see my blog at http://blogs.sun.com/david.

Thanks!
-David

David Botterill wrote:

I've read through the old mail archives and found a thread that said preferences were persisted in portletentityregistry.xml. Is this really true? When I store the preferences then check this file, I don't see the preferences. I'd like to be able to verify that the preferences are actually being persisted when I "store" them. Can anyone tell me how to do that? Also, does Pluto read the persisted preferences when the portlet is loaded?

Thanks!
-David

Reply via email to