How to add cookies to the web browser where Jmix application

Hi all,
Is there a way to add cookies to the web browser where Jmix application is running?

I am getting a response object from a restful service with a header that contains certain information that I want to keep in the browser as a cookie so that I can later retrieve this cookie and add it to the subsequent request calls to the service.

Please advise me on how to go about this in a Jmix application.

Thanks

Hi all,
I got a solution for my question. I used the getInstance() method of App object to add cookies to the current web browser.

getInstance().addCookie("SAPSESSIONID",sapSessionId);

1 Like

Hi All,
I got a solution to my question. I am able to add a cookie but I am not able to retrieve the cookie immediately when I need it.
Sometimes it takes a few round trips of opening screens before I am able to retrieve it.

getInstance().getCookieValue("SAPSESSIONID"));

Any idea of what could be causing the delay?
Thanks