Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

HTTP Session object is not working in AEM Dispatcher.

Avatar

Level 3

Hello,

 

We have an implementation where we want to preserve the session at the back end using an HTTP session object. 

Example: we have 3 pages, we need to preserve the options selected on each page and display that option chosen on the results page.

Note: We don't have the login functionality. Every user is an anonymous user.

 

This implementation works fine in both the author and publisher but not the dispatcher. I know that the use of an HTTP session is not recommended in AEM but we have to use it to accomplish our use case.

Any thoughts here, on why the HTTP Session object is not working in the dispatcher?

 

6 Replies

Avatar

Community Advisor

Hi @sateeshreddy ,

 

Just trying to understand the requirement, cant we use client side storage (local storage or session storage) instead for this requirement.

 

Avatar

Employee Advisor

That means you cannot store this state in the browser, but you have to store this state in the backend system?

 

Yes, you can do this, but this requires, that each of these requests is handled by AEM. And that means that you cannot cache them, and likely this will become a bottleneck in your application. Not to mention some non-functional requirements like session failover etc.

But I would really recommend you to store that data in the browser (localstorage, cookie, etc).

 

Avatar

Community Advisor

Do you have more than one publisher for your setup?

i believe you need to change your implementation strategy, with HTTP session you might not be able to cache the HTML and best way to implement it via front end code like local or session storage and if you are not allowed to use this in your project then may be you can look for URL with query prams or sling selector to have dynamic nature of the page based on your use case