Expand my Community achievements bar.

SOLVED

Not able to find Cookie data in doPost() at SlingHttpServletRequest request

Avatar

Level 1

In my AEM application I'm able to fetch the cookie (while landing the home page application) but in SlingHttpServletRequest I'm not able to get SlingHttpServletRequest.getCookie("MypropertyValue") in my dopost method. Can someone help me in looking into the issue and rectify it.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
2 Replies

Avatar

Community Advisor

Hi @anithara 


Same issue happened with me. 
What I was doing wrong was that my cookie scope was wrong i.e. when I checked my cookie was under wrong domain/path. 
When I corrected the cookie domain/path, it worked fine.


Same check you can do, you can compare props for other cookies that are working fine to your 
"MypropertyValue" cookie under dev tools ->  application ->  Storage -> cookies

 

Also make sure that you are not using incorrect cookie name to fetch cookie at backend.
You can try to print all cookies to debug this. ( request.getCookies() )

Avatar

Correct answer by
Community Advisor