ScopedContext context;
switch (scope) {
case REQUEST:
context = (ScopedContext)req.getAttribute("juzu.request_scope");
if (context == null && create) {
req.setAttribute("juzu.request_scope", context = new ServletScopedContext(log));
}
break;
case FLASH:
PortletSession session = req.getPortletSession(create);
if (session != null) {
context = (ScopedContext)session.getAttribute("juzu.flash_scope");
if (context == null && create) {
session.setAttribute("juzu.flash_scope", context = new ServletScopedContext(log));
}
} else {
context = null;
}
break;
case SESSION:
session = req.getPortletSession(create);
if (session != null) {
context = (ScopedContext)session.getAttribute("juzu.session_scope");
if (context == null && create) {
session.setAttribute("juzu.session_scope", context = new ServletScopedContext(log));
}
} else {
context = null;
}
break;