Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

AEM 5 - user session data maintenance

Avatar

Employee

Hi,


I am developing an application that requires to me to prompt user to login and then pass some data from page to page. This can't be GET or form POST data. So, I thought to do using HTTP SESSION.

 

I was trying to figure out how to do this in CQ5. I have been trying to figure out how to do this, but not successful so far.

 

In some posts I was reading that HttpSession is not supported by CQ5. In some forums, I read that HttpSession is not encouraged since it creates problems in multiple publish environments.

 

But I couldn't find any where as what is the approach we need to take for my case, which is very common. Can someone please help me out how to approach and go over this problem?

 

Just to simplify the use case:

I'll have a login form. Once the data is submitted, I'll make a service call using javascript and if service authenticates user, I'll set some hidden values in a form and submit the form. When this form is submitted, I want to set some session values and redirect user to a different page. Now, when next page is displayed, I will need to access the information stored in UI. This information needs to be available in any page we navigate to, so I thought to have Session approach. Please let me know what would be better approach.

1 Accepted Solution

Avatar

Correct answer by
Employee

HTTPSession use is not recommended, as it will break caching on dispatcher level. why not use cookies?

View solution in original post

1 Reply

Avatar

Correct answer by
Employee

HTTPSession use is not recommended, as it will break caching on dispatcher level. why not use cookies?