为无状态 Web 服务禁用 HTTPSession

编程入门 行业动态 更新时间:2024-10-26 18:28:52
本文介绍了为无状态 Web 服务禁用 HTTPSession的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想知道是否可以为仅处理 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

本文发布于:2023-11-09 03:13:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571240.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:状态   Web   HTTPSession

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!