As we know that we usually get the session object with the help of systemuser .
but in a servlet we can get session object without creating system user because in servlet we will have request and response object .with the help of these objecyts we can get the session object without creating system user .
whats the difference between both and in which scenerio we will use which one ?
creating system user and then getting session object through resourceresolver is preferrable way , whats the reason behind it ?
Are these answers useful? Help other community members by marking useful answers as accepted.
The subservice session is allow to get session with system user and system user privileges based on service user but getting session from request in servlet allow to get session from current user.
When to use subservice user or session from request in servlet:
When you are not sure about current users privileges to read/write from repo, then use sub service session which get privileges of predefined system user. If need to perform based on user then adapt the session from request.