我想知道是否可以为仅处理 Web 服务 RESTful 的应用程序服务器禁用 HTTPSession.
I would like to know if it is possible to disable the HTTPSession for an application server handling only web services RESTful.
我不知道是否有专门的应用程序服务器或 servlet 容器来处理微型 RESTful Web 服务.
I don't know if there are specific application servers or servlet containers designed to handle micro RESTful web services.
我认为完全禁用会话概念将带来以下好处:
I think that disabling completely the session concept will give the following advantages:
- 更好的表现
- 在会话中保存数据没有风险,打破了 RESTful Web 服务的无状态概念
- 类加载器加载的类较少
- 会话中没有保存未使用的信息(例如会话 ID、会话状态)
- 对同步块的访问较少(我认为至少在 Session 中,lastAccessedTime 的值会为每个请求更新,这应该在同步块中完成)
如果没有应用服务器或 servlet 容器可以做到这一点:有没有其他 Java 引擎可以处理微服务而无需创建类似于 HttpSession 的东西?
If there is no application server or servlet container that can do that: Is there any other Java engine that can handle micro services without creating something similar to an HttpSession?
推荐答案您不能在 servlet 容器(如 Tomcat)上禁用 HttpSession.
You cannot disable HttpSession on a servlet container, like Tomcat.
也许 Play 框架是实现您的设计的好方法.
Maybe Play framework would be a good approach for implementing your design.
更多推荐
为无状态 Web 服务禁用 HTTPSession
发布评论