Grails会话创建,以及如何防止它 [英] grails session creation, on how to prevent it

查看:76
本文介绍了Grails会话创建,以及如何防止它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下错误报告的最后一行

https://github.com/grails/grails-core/issues/5296



据说:在理想的世界中,可以关闭整个Controller的HttpSession创建(所有操作),并关闭它们以关闭特定的集合



然而,这是一个相当古老的bugreport,所以我的问题是:

在grails的即将到来的版本(1.3.7)中,这是可能的吗?如果没有,不应该是吗?



我寻求这种行为的原因是由于在grails中开发了RESTful API,REST的本质是<强>无状态即可。

解决方案

如果您不访问隐式会话对象或使用会话,Grails不会创建会话的服务。我们有多个项目在生产中运行,我们不使用会话。只要你不访问这些对象,你就不会看到任何会话(没有JSESSIONID cookies与响应一起发送)。


in the last line in the following bug report

https://github.com/grails/grails-core/issues/5296

it is stated that;

In an ideal world, it would be possible to turn off HttpSession creation for a whole Controller (all actions) and also turn them off for a particular set of actions.

This is however, a quite old bugreport, so my question is:

is this possible in an upcoming or todays version (1.3.7) of grails? If not, shouldn't it be?

The reason i seek this kind of behavior is due to development of RESTful API's in grails, where the very nature of REST is stateless.

解决方案

Grails does not create a session if you do not access the implicit session object or use session-scoped services. We have multiple projects running in production, where we do not use sessions. As long as you don't access those objects, you won't see any sessions (no JSESSIONID cookies being sent with the response).

这篇关于Grails会话创建,以及如何防止它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆