GWT and storing a session key

萝らか妹 提交于 2020-01-05 04:59:08

问题


My app logs into an external service & needs to store the sessionKey (the sessionKey needs to be added to the HTTP header for future RPC calls).

What alternatives do I have for storing the sessionKey ? I've read about a scenario where the sessionKey is saved into a DIV tag on the page.


回答1:


There is no need for the client side to have this information. Session management should be transparent to the client side.

The only acceptable way is to use cookies and manage this on the server side. Technically, you can throw this data on the client-side somewhere, but cookies is exactly the place for it.




回答2:


As jldupont said ... use cookies.

import com.google.gwt.user.client.Cookies;

Cookies.setCookie(name, value);
Cookies.getCookie(name);


来源:https://stackoverflow.com/questions/2053960/gwt-and-storing-a-session-key

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!