return this.removeAttribute(name);
}
Session<LocalSessionContext> session = this.entry.getKey();
try (BatchContext context = this.manager.getSessionManager().getBatcher().resumeBatch(this.batch)) {
if (AUTHENTICATED_SESSION_ATTRIBUTE_NAME.equals(name)) {
AuthenticatedSession authSession = (AuthenticatedSession) value;
// If using FORM authentication, we store the corresponding Account in a session attribute
if (authSession.getMechanism().equals(HttpServletRequest.FORM_AUTH)) {
Account account = (Account) session.getAttributes().setAttribute(name, authSession.getAccount());
return (account != null) ? new AuthenticatedSession(account, HttpServletRequest.FORM_AUTH) : null;
}
// Otherwise we store the whole AuthenticatedSession in the local context
LocalSessionContext localContext = session.getLocalContext();
AuthenticatedSession old = localContext.getAuthenticatedSession();
localContext.setAuthenticatedSession(authSession);
return old;
}
if (!(value instanceof Serializable)) {
throw new IllegalArgumentException(new NotSerializableException(value.getClass().getName()));