The cookies emitted when the user selects one of the ui customization selectors expire
when the browser is closed. That means that when the user logs back into the app in
another session the preferences are lost.
The problem is this code in the XXXSelector
public void select()
{
Contexts.removeFromAllContexts( Seam.getComponentName(Theme.class) );
FacesContext facesContext = FacesContext.getCurrentInstance();
String viewId = facesContext.getViewRoot().getViewId();
UIViewRoot viewRoot =
facesContext.getApplication().getViewHandler().createView(facesContext, viewId);
facesContext.setViewRoot(viewRoot);
if (cookieEnabled)
{
HttpServletResponse response = (HttpServletResponse)
facesContext.getExternalContext().getResponse();
response.addCookie( new Cookie("org.jboss.seam.core.Theme", theme) );
}
}
I modded it to :
public void select()
{
Contexts.removeFromAllContexts( Seam.getComponentName(Theme.class) );
FacesContext facesContext = FacesContext.getCurrentInstance();
String viewId = facesContext.getViewRoot().getViewId();
UIViewRoot viewRoot =
facesContext.getApplication().getViewHandler().createView(facesContext, viewId);
facesContext.setViewRoot(viewRoot);
if (cookieEnabled)
{
HttpServletResponse response = (HttpServletResponse)
facesContext.getExternalContext().getResponse();
Cookie cookie = new Cookie("org.jboss.seam.core.Theme", theme);
cookie.setMaxAge ( 31536000 );
response.addCookie( cookie );
}
}
Now when I go into a new session the cookie is picked up and used and all my settings are
okay.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988539#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...