use of org.apache.tapestry5.services.Session in project tapestry-5 by apache.
the class DevTool method onActionFromKill.
Object onActionFromKill() {
if (!productionMode) {
Session session = request.getSession(false);
if (session == null) {
alertManager.info("No server-side session currently exist.");
} else {
session.invalidate();
alertManager.info("Server-side session invalidated.");
}
}
return devmodezone.getBody();
}
use of org.apache.tapestry5.services.Session in project tapestry-5 by apache.
the class FlashPersistentFieldStrategyTest method post_change_to_root_component.
@Test
public void post_change_to_root_component() {
Session session = mockSession();
Request request = mockRequest();
Object value = new Object();
train_getSession(request, true, session);
session.setAttribute("flash:foo.Bar::field", value);
replay();
PersistentFieldStrategy strategy = new FlashPersistentFieldStrategy(request);
strategy.postChange("foo.Bar", null, "field", value);
verify();
}
use of org.apache.tapestry5.services.Session in project tapestry5-hotel-booking by ccordenier.
the class BasicAuthenticator method logout.
public void logout() {
Session session = request.getSession(false);
if (session != null) {
session.setAttribute(AUTH_TOKEN, null);
session.invalidate();
}
}
use of org.apache.tapestry5.services.Session in project tapestry-5 by apache.
the class AbstractSessionPersistentFieldStrategy method discardChanges.
public void discardChanges(String pageName) {
Session session = request.getSession(false);
if (session == null)
return;
String fullPrefix = prefix + pageName + ":";
for (String name : session.getAttributeNames(fullPrefix)) {
session.setAttribute(name, null);
}
}
use of org.apache.tapestry5.services.Session in project tapestry-5 by apache.
the class AbstractSessionPersistentFieldStrategy method gatherFieldChanges.
public final Collection<PersistentFieldChange> gatherFieldChanges(String pageName) {
Session session = request.getSession(false);
if (session == null)
return Collections.emptyList();
List<PersistentFieldChange> result = newList();
String fullPrefix = prefix + pageName + ":";
for (String name : session.getAttributeNames(fullPrefix)) {
Object persistedValue = session.getAttribute(name);
Object applicationValue = persistedValue == null ? null : convertPersistedToApplicationValue(persistedValue);
PersistentFieldChange change = buildChange(name, applicationValue);
result.add(change);
didReadChange(session, name);
}
return result;
}
Aggregations