Hi All,
I have items in session storage that I want to use in backend.
I have tried Servlet class with get method but was unable to get the item.
Can anybody with experience help me out ?
Solved! Go to Solution.
Views
Replies
Total Likes
Here is the example
Cookie countryCookie = slingRequest.getCookie("myCountryCookie");
if(countryCookie==null) {
String cookieValue = countryCookie.getValue();
// rest of the logic
}
https://github.com/arunpatidar02/aem63app-repo/blob/master/java/DemoCookieFilter.java
You cannot access browser session storage at server side, only cookies can be retrieve and updated from backed.
.
Here is the example
Cookie countryCookie = slingRequest.getCookie("myCountryCookie");
if(countryCookie==null) {
String cookieValue = countryCookie.getValue();
// rest of the logic
}
https://github.com/arunpatidar02/aem63app-repo/blob/master/java/DemoCookieFilter.java
Once you get the cookie, map all the countries codes which you want to convert or maintain a Generic list in the AEM with all the mappings and get the values from the list
Please find the reference for using generic lists
https://adobe-consulting-services.github.io/acs-aem-commons/features/generic-lists/index.html
Hope this is helpful
Views
Likes
Replies