use of org.granite.context.GraniteContext in project collect by openforis.
the class SessionManager method invalidateSession.
public void invalidateSession() {
try {
releaseRecord();
} catch (RecordUnlockedException e) {
// do nothing
}
GraniteContext graniteContext = GraniteContext.getCurrentInstance();
if (graniteContext != null && graniteContext instanceof HttpGraniteContext) {
HttpGraniteContext httpGraniteContext = (HttpGraniteContext) graniteContext;
HttpServletRequest request = httpGraniteContext.getRequest();
HttpSession session = request.getSession();
session.invalidate();
}
}
use of org.granite.context.GraniteContext in project collect by openforis.
the class SessionManager method getSessionAttribute.
private Object getSessionAttribute(String attributeName) {
Object result = null;
// try to get session attribute from GraniteDS context
GraniteContext graniteContext = GraniteContext.getCurrentInstance();
if (graniteContext != null) {
result = graniteContext.getSessionMap().get(attributeName);
} else {
// try to get session attribute from current request context holder session
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (requestAttributes != null) {
HttpSession session = requestAttributes.getRequest().getSession();
result = session.getAttribute(attributeName);
}
}
return result;
}
Aggregations