The invention discloses a session management method, a web server and a computer readable storage medium. The session management method includes receiving session configuration information, session configuration information including the storage device and the session name; the web server loads the session configuration information to the storage device when the web server is started; and the client login is detected. When requesting, judge whether the client is first logon, if, then create the client session information and send it to the client, and save the client session information to the database corresponding to the session name on the storage device after the client login successfully. If not, the stored client sessi is read directly from the storage device. On information is used to authenticate the client. Compared with the existing technology, the invention can better manage the client session information by replacing the original manual configuration mode by the management platform; at the same time, the invention can also configure the session name to store the client session information corresponding to the different service types, and realize the support of various service types, and not Need business to fit.
【技术实现步骤摘要】
session管理方法、web服务器及计算机可读存储介质
本专利技术涉及移动终端
,尤其涉及一种session管理方法、web服务器及计算机可读存储介质。
技术介绍
随着互联网高速发展,特别是移动互联网的高速发展,使得各个单机系统的流量急剧增加,系统难以支撑。分布式系统的产生,将单机流量分散到各个节点中,降低了单机系统的冲击。但是分布式系统的产生,为了保持用户的登录信息,需要分布式系统各个节点间共享登录session信息。为了实现各个节点间登录session信息的共享,人们提出了开源框架的服务器session管理方法,即tomcat-session-manager。然而,上述session管理方法存在以下缺点:配置信息需要手工维护,容易出错;对业务支持不够全面。因此,有必要提供一种session管理方法、web服务器及计算机可读存储介质来解决上述技术问题。
技术实现思路
本专利技术的主要目的在于提出一种session管理方法、web服务器及计算机可读存储介质,旨在解决通过现有的tomcat-session-manager方法实现用户登录session信息共享时配 ...
【技术保护点】
1.一种session管理方法,应用于web服务器,其特征在于,所述session管理方法包括以下步骤:接收session配置信息,所述session配置信息包括用于存储客户端session信息的存储设备和session名称,其中所述session名称与所述web服务器对应的业务类型相匹配;启动时读取所述session配置信息并将所述session配置信息加载至所述存储设备;检测到客户端登录请求时,判断客户端是否第一次登录;若判断结果为是,则创建客户端session信息并发送给客户端,并在客户端登录成功后将客户端session信息保存至所述存储设备上与所述session名称 ...
【技术特征摘要】
1.一种session管理方法,应用于web服务器,其特征在于,所述session管理方法包括以下步骤:接收session配置信息,所述session配置信息包括用于存储客户端session信息的存储设备和session名称,其中所述session名称与所述web服务器对应的业务类型相匹配;启动时读取所述session配置信息并将所述session配置信息加载至所述存储设备;检测到客户端登录请求时,判断客户端是否第一次登录;若判断结果为是,则创建客户端session信息并发送给客户端,并在客户端登录成功后将客户端session信息保存至所述存储设备上与所述session名称对应的数据库中;若判断结果为否,则从所述存储设备读取已存储的客户端session信息以对客户端进行认证。2.如权利要求1所述的session管理方法,其特征在于,所述启动时读取所述session配置信息并将所述session配置信息加载至所述存储设备的步骤之后还包括:实时监测所述session配置信息是否发生变化;若发生变化,则将变化后的session配置信息同步更新至所述存储设备。3.如权利要求1所述的session管理方法,其特征在于,所述在客户端登录成功后将客户端session信息保存至所述存储设备上与所述session名称对应的数据库中的步骤之前还包括:判断客户端是否登录成功;若客户端登录成功,则通过预设序列化工具对所述客户端session信息进行序列化处理;若客户端登录失败,则提示登录异常至客户端。4.如权利要求3所述的session管理方法,其特征在于,所述通过预设序列化工具对所述客户端session信息进行序列化处理的步骤具体为:通过序列化工具Fast-Json对所述客户端session信息进行序列化处理。5.如权利要求1所述的session管理方法,其特征在于,所述接收session配置信息的步骤之前还包括:判断所述session配置信息是否处于管理权限范围内;若所述session配置信息处于管理权限范围内,则保存所述session配置信息。6.一种web服务器,其特征在于,所述web服务器包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的session管理程序,所述session管理程序被所述处理器执行时实现以下步骤:接收...
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。