Wednesday, October 12, 2016

var cookies_collection = request.getCookies();

if (cookies_collection != null) {
 for (index in cookies_collection) {
   if (cookies_collection[index].getName().equals("cookie_Name")) {
               //concat with string to typecast from object , so as we can return as string
cookie_val = cookies_collection[index].getValue()+"";
   }
 }
}


2 comments:

  1. I am implementing this request.getCookies() method and I am able to fetch cookies but only the cookies that are related to the pages created on that particular server. If I create pages on a diffrent AEM server and then import those pages to my server using package, then this method doesn't fetch cookies for these pages that I installed from package though the cookies are getting stored in my browser.Retrieval is causing the problem. How can I resolve this issue.

    ReplyDelete
    Replies
    1. You will have to check domain , If you have 2 different domains then you wont get the cookie of one domain in other domain due to security reasons.

      Delete

Powered by Blogger.

Followers

Best Price Amazon Portal

Amazon Best Offers