return null;
}
String soneId = (String) session.getAttribute("Sone.CurrentSone");
- for (Sone sone : webInterface.core().localSones()) {
+ for (Sone sone : webInterface.core().getSones()) {
if (sone.getId().equals(soneId)) {
return sone;
}
*/
protected void setCurrentSone(ToadletContext toadletContext, Sone sone) {
Session session = getCurrentSession(toadletContext);
- session.setAttribute("Sone.CurrentSone", sone.getId());
+ if (sone == null) {
+ session.removeAttribute("Sone.CurrentSone");
+ } else {
+ session.setAttribute("Sone.CurrentSone", sone.getId());
+ }
}
//
* {@inheritDoc}
*/
@Override
+ protected void processTemplate(Request request, Template template) throws RedirectException {
+ super.processTemplate(request, template);
+ template.set("currentSone", getCurrentSone(request.getToadletContext()));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected String getRedirectTarget(Page.Request request) {
if (requiresLogin() && (getCurrentSone(request.getToadletContext()) == null)) {
return "login.html";