final PersistContext pc = (PersistContext) sc.getAttribute(PersistContext.KEY);
if(pc == null) {
throw new ServletException("Unable to obtain the persist context");
}
final IUserService userService = pc.getEntityServiceFactory().instance(IUserService.class);
final User user = (User) userService.loadUserByUsername(appContext.getDfltUserEmail());
log.debug("Creating mock admin context from default user email specified in config..");
final AdminContext ac = new AdminContext();
ac.setUser(user);
session.setAttribute(AdminContext.KEY, ac);
log.info("Server-side admin context created and stored in the servlet context");