Details
-
Improvement
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
None
-
Quasar
-
Puma Sprint 231
Description
There are now two places that have something like:
Object token = request.getAttribute(PREVIEW_ACCESS_TOKEN_REQUEST_ATTRIBUTE); if (token == null) { final HttpSession session = request.getSession(false); if (session == null) { return null; } return CmsSessionContext.getContext(session); } else { // token based rendering for preview if (token instanceof AccessToken) { return ((AccessToken) token).getCmsSessionContext(); } else { throw new IllegalStateException(String.format("For attribute '%s' only an object of type '%s' " + "is allowed", PREVIEW_ACCESS_TOKEN_REQUEST_ATTRIBUTE, AccessToken.class.getName())); } }
However, downstream projects will require similar checks to get hold of the session context. Hence we should create a static helper utility method for it