prefs for a non authenticated user cannot be persisted because the user does not have an id.
it could be possible to develop a preferences based on a cookie id that would be stored in the client though. It could even be possible to store the prefs in a client cookie, I have just thought about that now :-), but that would perhaps make a lot of payload in the http client request. If it would be persisted on the server side using an id stored in a client cookie then that would need to clean the db when a user has not come for a long time in order to avoid to have too much data (i.e kind of garbage collection based on a removal policy)
yes the prefs stuff is more or less pluggable but it could be better adressed in 2.2 imho, if you can have a look at the source code, it is not very hard to understand how it works, look at PreferencesInterceptor.java
Thanks a lot for the clear answer.
I am interested in finding a way to solve this problem. I couldn't find the PreferencesInterceptor.java class you mention in the 2.2.0 code - has this changed recently?
I would like to know what you suggest for solving this kind of issue. Basically we have our own authentication (not using JBoss Portal users) and we'd like to store some simple values for each of our users (what would normally go in a Cookie). So like you suggest, a Cookie based storage system for the preferences may be the most appropriate solution. If you can point me to general place(s) in the code I need to be aware of to do this that would be very useful!
Just to mention, that besides jaas or cookies, preferences are per user per portlet (or per user per portlet instance i don't know).
I needed per user preferences, so I had to write my own preferences and forget about the rest.
That's exactly what i need - a small set (couple of strings) of preferences per user, so I was thinking that a Cookie store would be acceptable.
Maybe I was not clear. My purpose was not to give advice on the two techniques to associate preferences to a user by using jaas authentication or by using cookies.
I was only drawing your attention that jboss portal provides preferences associated to a portlet (or instance of a portlet), so it won't work if preferences need to be shared between portlets. If you have one portlet only, then it is fine.
I hope it did not cnfuse you, some else will probably address your real need.