Reputation: 629
I have set the user defined cookie in Vaadin response object and tried to get that cookie in Ext-JS file but I was not able to get it, just getting as null value. Can anyone give me an IDEA of
*How to get that cookie Or Is there any alternative way to set user defined cookie in Vaadin response and get it in client side?*
Here is my scenario :
Both frameworks are running in different applications such as Vaadin in 3030 port and Ext-JS in 7070 as well. I have set the cookie in Vaadin framework and tried to get it in Ext-JS after redirect the page from Vaadin to Ext-JS.
Please find the code below what I have tried,
To redirect page from Vaadin to Ext-JS :
UI mainWindow = operationContext.getMainWindow();
mainWindow.getPage().setLocation("http://localhost:7070/index.jsp");
Set the cookie in Vaadin :
Cookie myCookie = new Cookie("tempKey", "Hi");
VaadinService.getCurrentResponse().addCookie(myCookie);
Get the cookie in Ext-JS :
Ext.util.Cookies.get('tempKey');
Upvotes: 1
Views: 3221
Reputation: 629
Finally got the IDEA to set the cookie in vaadin. Please find the code snippet below what i have tried.
I have set the cookie in Vaadin using the javascript api and now I am able to read this cookie in Ext-JS page.
Page().getJavaScript().execute("document.cookie='"+key+"="+value+"; path=/'");
Upvotes: 3