I have a web application developed using gwt.2.5.1, java. In my application i have a link "Volex page" which will send to the request to the other server(Volex).
supppose if i open my application with "http://localhost:8085/myApp" and can see the "vloex page", once user clicks on the 'Volex page' it will be redirected to 'Volex server' like below.
Window.Location("http://167.23.543.34:8087/VolexSer/volex")
The above url hits the volex server which needs some inforamtion like session id, for this i have to set the session id in the cookie like below:
Date cookieDate = new Date();
cookieDate.setDate(cookieDate.getDate() + 1);
String baseUrl = "http://167.23.543.34:8087/VolexSer/volex";
Integer nDomainInitialPosition = baseUrl.indexOf("/");
Integer nDomainEndPosition = baseUrl.lastIndexOf(":");
String baseDomain = baseUrl;
if (nDomainInitialPosition == nDomainEndPosition) {
nDomainEndPosition = baseUrl.indexOf("/");
}
baseDomain = baseUrl.substring(nDomainInitialPosition + 2, nDomainEndPosition);
Window.alert("baseDomain: " + baseDomain);
String eWebPageUrl = com.google.gwt.user.client.Window.Location.getHref();
if (eWebPageUrl.contains("https://")) {
Cookies.setCookie("sessionId", LoginInfo.getSessionId(), cookieDate, baseDomain, "/", true);
} else {
Cookies.setCookie("sessionId", LoginInfo.getSessionId(), cookieDate, baseDomain, "/", false);
}
Here opening with two domains one is "localhost" other is "167.23.543.34", If i set the cookie like above, it is not showing in the request header. Can any body tell mw what is the wrong in the above code?