*/
public void initializeSessionContext(HttpSession session, String userId, String layoutId, Document userLayout) {
final String sessionId = session.getId();
final JndiTemplate jndiTemplate = this.getJndiTemplate();
// bind userId to /sessions context
try {
final Context sessionsContext = (Context) jndiTemplate.lookup("/sessions", Context.class);
try {
sessionsContext.bind(sessionId, userId);
}
catch (NameAlreadyBoundException nabe) {
sessionsContext.rebind(sessionId, userId);
}
}
catch (NamingException ne) {
this.logger.warn("Unable to obtain /sessions context, no session data will be available in the context for sessionId='" + sessionId + "', userId='" + userId + "', and layoutId='" + layoutId + "'", ne);
}
final Context usersContext;
try {
// get /users context
usersContext = (Context) jndiTemplate.lookup("/users", Context.class);
}
catch (NamingException ne) {
final PortalException portalException = new PortalException("Could not find /users context", ne);
this.logger.error(portalException.getMessage(), ne);
throw portalException;