I'm trying to handle multiple user login sessions by creating user specific sessions. Below is the code snippet of the same.
ResourceResolver resourceResolver = request.getResourceResolver();
Resource userResource = resourceResolver.getResource(config.getUserDataFolderPath() + '/' + userProfile.getUid());
LOGGER.info("User specific resource in resource format is {}", userResource);
assert userResource != null;
Session userSpecificSession = userResource.adaptTo(Session.class);
LOGGER.info("User specific session is {}", userSpecificSession);
The below line is returning null. Can someone please help me to understand why is this happening?
Session userSpecificSession = userResource.adaptTo(Session.class);
Solved! Go to Solution.
Views
Replies
Total Likes
For an object to be adapted as an object of another class, the class types should be compatible.
Resource can't be adapted to Session, but a ResourceResolver can be
Each object is an entity in itself. When we adapt, we are just trying to access that object in a different way. Thats why classes need to be compatible
For an object to be adapted as an object of another class, the class types should be compatible.
Resource can't be adapted to Session, but a ResourceResolver can be
Each object is an entity in itself. When we adapt, we are just trying to access that object in a different way. Thats why classes need to be compatible
Thank you.
Views
Likes
Replies
Views
Likes
Replies