}
// Register the context's session
if (engine.getSessionMode() == SessionMode.AUTO)
{
SessionRegistry sessionRegistry = engine.getSessionRegistry();
if (sessionRegistry != null)
{
if (sessionTimeout == -1L)
{
sessionTimeout = SettingUtil.getIntSetting(ServerConstants.SYSPROP_SERVERSESSION_TIMEOUT, 0);
}
sessionRegistry.registerSession(context.getId(), context, sessionTimeout);
}
}
TokenContextService contextService = engine.getTokenContextService();
contextService.saveContext(context);