Is there any interface or class provided by the JSR286 specification to store configuration parameters for a portlet?
The PortletPreferences
interface allows me to store preferences but these are user-specific as far as I know. I also read you could store things in a PortletSession
, but the scope of it is also user-specific (and I don't think it's persistent).
Another thing I read is the PortletContext
which is available in an application wide scope. I read there is a property called setAttribute
, but I don't know if these attributes are persistent or not. If I restart the portal server, I have no clue if these settings are still there. Also, if I have multiple instances of the portlet, I would like to make these settings differently for each instance.
So my question is; Is there any interface/class in the portlet 2.0 API (JSR286) to store data at portlet instance scope persistently?
I just found the solutions to my own problem. It seems IBM doesn't completely follow the JSR286 specification (in my advantage) and determines the scope of the PortletPreferences
based upon the portlet mode the user is in.
If the user is in the VIEW, EDIT or HELP mode (defaults in JSR286 specification), then the preferences are stored like defined in the JSR286 specification. They are user- and portlet instance dependant, useful for personalisation.
If the user is in the EDIT_DEFAULTS mode (custom mode), then the preferences are stored globally for ONE portlet instance. This means that if the portlet is used on multiple pages, then the configuration only applies to one of these instances.
Lastly, if the user is in the CONFIG mode (custom mode), then the preferences are stored globally for a portlet. This means that all users of all portlet instances will use the same configuration.