Hi all,
We have our website running on AEM 6.5 AMS which is interacting with Intershop via a shared cookie. Once the user is logged into Intershop, a cookie is set by Intershop for the loggedIn user details. This cookie is leveraged by AEM to show the loggedIn user and cart info on AEM pages. AEM has a servlet (invoked from topnav) which reads through all the cookies in request and matches cookie name and then updates the header. This is working fine in AEM 6.5 currently.
We are now migrating the website to AEMaaCS and on our cloud dev environment, we are having issue that even though the cookie is correctly set by Intershop but when the servlet is invoked from AEM, it is not getting the cookie using request.getCookies.
I checked and the servlet call has cookie present in request headers but in below code, it is not retreived.
Below is the code from servlet to read the cookies
public static JsonObject getCookieAsJson(HttpServletRequest request, String name) {
Cookie[] cookies = request.getCookies();
JsonObject json = new JsonObject();
if (cookies != null) {
for (Cookie cookie : cookies) {
LOG.info("cookie name is:" + cookie.getName());
if (cookie.getName().equals(name)) {
JsonParser parser = new JsonParser();
json = parser.parse(cookie.getValue()).getAsJsonObject();
}
}
}
return json;
}
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @pardeepg4829047
Are you able to see any of the cookie in the backend? i.e.
LOG.info("cookie name is:" + cookie.getName());
Yes..other cookies are being printed in logger.
I am not sure about this but the only thing I noticed is size, can you try to reduce cookie size and check?
We changed the logic to read request.getHeader("Cookie") and then match the exact cookie name. This approach worked for us but not sure why the original code of request.getCookies() which was working fine on AEM 6.5 is unable to read the cookie in AEMaaCS.
Views
Likes
Replies