Adding Cookies in Java/Liferay


In Liferay , when user is logging into ,he/she can remember username . so that whenever user again  tries to login no need to enter his crenditinals.

Following are things liferay is doing to add username in cookie in LoginUtil.java


Cookie loginCookie = new Cookie(CookieKeys.LOGIN, login);

if (Validator.isNotNull(domain)) {    // Here domain is "www.liferay.com"
loginCookie.setDomain(domain);
}

loginCookie.setMaxAge(loginMaxAge);  // Age of the Cookie

loginCookie.setPath(StringPool.SLASH);

   CookieKeys.addCookie(request, response, loginCookie, secure);

Comments

  1. Thanks for sharing this information. Since most of the students have lack o knowledge in how to organize a perfect essay during their academic life. So here you did a great job for the successful completion of their academic assignments.

    ReplyDelete
  2. what is "secure" here in above code

    ReplyDelete

Post a Comment

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Opening portlet in popup