Unable to add a Cookie using response.addCookie

I am trying to add cookie to cookies, but on trying to get its value its coming as null.

String gsidCookieName = "GlobalSessionID_26";
String gSIDCookie = null;
gSIDCookie = CookieHelper.getCookieValue(request, gsidCookieName);

if(null!= gSIDCookie){  
logger.info("gSIDCookie is not null and value is " + gSIDCookie);
}
else{
logger.info("gSIDCookie is null and value is " + gSIDCookie);
String status = "test";
Cookie cookie = new Cookie (gsidCookieName,status);
logger.info("\n Session id set in cookie in fios ::" +status);
cookie.setMaxAge(180);
cookie.setPath("/");
cookie.setDomain(".mydomain.com");
cookie.setSecure(false);
response.addCookie(cookie);
}

On first time accessing my application, its going inside "else" condition above and adding the cookie. But on accessing second time, its not going to "if" condition and value is coming as null. Please help me why its not getting stored in cookies.

Answers


Need Your Help

How to redirect to dynamic content with .htaccess

php .htaccess redirect seo

Now that I know how to write SEO friendly links, I have this problem: If I'm going to use the entry title in the URL, then the links are going to be broken if I update that title.

android image crop and wallpaper settings page

java android live-wallpaper

I would like to implement live wallpaper where user will be able to setup own photo on the phone desktop.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.