开发者

GWT + Tomcat Session without Cookies!

I'm w开发者_如何转开发orking on a web-project which uses GWT on client and Java on server side (tomcat7).

If cookies are enabled on the browser, everything works fine. I can use sessions without any problems.

If cookies are disabled on the browser, sessions doesn't work.

I guess, this his mainly something to do with GWT apps being a single web-page application which only requests data from the server via ajax.

Is there a way to get sessions working under such circumstances?

Help is very appreciated!

All the best, Thomas


If you using GWT RPC, you will need to modify your RPC urls to burn in the jsessionid as discussed in this forum post. Though I am not sure if line Cookies.getCookie("JSESSIONID") as shown the forum post will work in your case. You might need to parse the location.href


On the server side you can access the session as follows:

public class NameImpl extends RemoteServiceServlet implements NameService {

public void doSomething()  throws IllegalArgumentException{
 HttpSession hs = this.getThreadLocalRequest().getSession();
//Do whatever it is you want to do with this information.
}

}

Not 100% sure that if is what you are asking for, but it seems like the most reasonable answer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜