btg-httpsession 分布式 session 实现开源项目

我要开发同款
匿名用户2019年12月31日
91阅读

技术信息

官网地址
/zcltd-btg/btg-httpsession
开源地址
https://gitee.com/zcltd-btg/btg-httpsession
授权协议
Apache

作品详情

btg-httpsessio是实现了httpsessio标准适用于普通web项目和jfial项目的分布式sessio

使用方式一、配置方式:1、通过filter配置(非jfial项目推荐配置方式);/****BTGHttpSessioRequest替换filter(localsessio管理)*注意:此filter优先级必须大于业务系统处理相关filter**若需要redis、db模式的sessio管理:*1、请在初始化配置参数iit-param*sessioDao:可选,默认为local。*local-使用local的BTGSessioDao;*redis-使用redis的BTGSessioDao*db-使用redis的BTGSessioDao;*dame:可选,默认为jfial默认;*若sessioDao为redis,该参数则表示RedisPlugi的ame;*若sessioDao为db,该参数表示ActiveRecordPlugi的ame;*2、或者扩展此类,重写iit方法完成sessioDao的初始化即可*/<filter><filter-ame>btgsessio</filter-ame><filter-class>c.usbtg.httpsessio.servlet.filter.BTGHttpSessioFilter</filter-class><iit-param><param-ame>sessioDao</param-ame><param-value>redis</param-value></iit-param><iit-param><param-ame>dame</param-ame><param-value>myredis</param-value></iit-param></filter><filter-mappig><filter-ame>btgsessio</filter-ame><url-patter>/*</url-patter></filter-mappig>2、(jfial项目推荐)使用jfial的plugi+iterceptor(iterceptor或hadler,二选一)配置(若使用默认sessio管理容器无需配置plugi,仅当需要使用非默认BTGSessioDao实现时,需要在plugi中进行初始化);JfialCofig:可选配置,用户初始化sessioDao实现方案publicvoidcofigPlugi(Plugisme){//local(默认,无需配置)BTGSessioDaolocalSessioDao=ewBTGLocalSessioDao();BTGSessioPlugisessioPlugi=ewBTGSessioPlugi(localSessioDao);me.add(sessioPlugi);//redisBTGSessioDaoredisSessioDao=ewBTGRedisSessioDao();BTGSessioDaoredisSessioDao=ewBTGRedisSessioDao("myredis");BTGSessioPlugisessioPlugi=ewBTGSessioPlugi(redisSessioDao);me.add(sessioPlugi);//dbBTGSessioDaodbSessioDao=ewBTGDBSessioDao();BTGSessioDaodbSessioDao=ewBTGDBSessioDao("mydb");BTGSessioPlugisessioPlugi=ewBTGSessioPlugi(dbSessioDao);me.add(sessioPlugi);}Iterceptor:必须配置,用于替换sessio管理机制me.add(ewBTGHttpSessioIterceptor());Hadler:必须配置,用于替换sessio管理机制me.add(ewBTGHttpSessioHadler());二、调用API:1、使用BTGHttpSessioCotext接口的实现类BTGStadardSessioCotext直接完成对sessio的操作;getSessio(StrigsessioId):BTGStadardSessioCotext.getSessioCotext().getSessio(sessioId)getNewSessio():BTGStadardSessioCotext.getSessioCotext().getNewSessio()更多api请查看BTGSessioCotext接口2、(推荐)使用静态访问类SessioKit完成对sessio的操作;getSessio(StrigsessioId):SessioKit.getSessio(sessioId)getNewSessio():SessioKit.getNewSessio()更多api请查看SessioKit类

功能介绍

btg-httpsession是实现了httpsession标准适用于普通web项目和jfinal项目的分布式session 使用方式
一、配置方式:
1、通过filter配置(非jfin...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论