# HTTP Session Replacement
[![Maven Central](https://img.shields.io/maven-central/v/com.amadeus/session.svg?style=flat-square)](https://search.maven.org/#search%7Cga%7C1%7Ccom.amadeus.session)
[![Javadocs](http://www.javadoc.io/badge/com.amadeus/session-replacement.svg?style=flat-square)](http://www.javadoc.io/doc/com.amadeus/session-replacement)
[![Travis](https://img.shields.io/travis/AmadeusITGroup/HttpSessionReplacer.svg?style=flat-square)](http://travis-ci.org/AmadeusITGroup/HttpSessionReplacer)
[![license](https://img.shields.io/github/license/AmadeusITGroup/HttpSessionReplacer.svg?style=flat-square)](LICENSE)
[![Dependency Status](https://www.versioneye.com/user/projects/583d2f19d2fd57003fdfbe76/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/583d2f19d2fd57003fdfbe76/)
[![SonarQube Coverage](https://img.shields.io/sonar/http/sonarqube.com/com.amadeus:session/coverage.svg?style=flat-square)](https://sonarqube.com/dashboard?id=com.amadeus%3Asession)
[![SonarQube Tech Debt](https://img.shields.io/sonar/http/sonarqube.com/com.amadeus:session/tech_debt.svg?style=flat-square)](https://sonarqube.com/dashboard?id=com.amadeus%3Asession)
This project provides session management including, possibly, distributed
session repository for JEE and other java containers. Default implementation
comes with in-memory and Redis based implementation.
The project is inspired by Spring Session project and reuses some of redis logic from it.
Its objective is to avoid any dependency on Spring libraries, and, so, make it usable in applications that
don't use Spring, or that use an older version.
The implementation, however, uses the Jedis library directly.
This makes the algorithm easier to port to other languages.
The project aims to make session management transparent for existing webapps (zero code
change) and as compatible as possible with wide variety of the JEE containers, all the while
offering full support for session API including different session listeners.
Redis support includes both single instance, sentinel based and cluster modes.
Two session expiration strategies are available when using Redis. One is based
on Redis notifications, and antoher on sorted sets (ZRANGE).
Useful links:
* For details about installing the library see [docs/Usage.md](docs/Usage.md)
* For information about building this project see [docs/BUILD.md](docs/BUILD.md).
* For information about using session encryption see [docs/ENCRYPTION.md](docs/ENCRYPTION.md).
## HTTP Servlet support
The primary usecase is the support for session management for `HttpSessions`.
Support includes the following:
* Creation of sessions on demand
* Storing of session attributes between requests
* Invalidation of sessions
* Session expiration management
* Session propagation to clients via cookie and URL.
* Full support for all non-deprecated `HttpSession` methods
* Support for callbacks for values stored in session that implement
`javax.servlet.http.HttpSessionActivationListener` or
`javax.servlet.http.HttpSessionBindingListener`
* When used with an agent, support for listener objects such as
`javax.servlet.http.HttpSessionListener` and
`javax.servlet.http.HttpSessionAttributeListener`
* Support for Servlet 3.1 features such as session id switch
* Compatibility with Servlet 2.5
* Session stickiness - sessions can be sticked to node and expiration events will then be triggered on node owner of session
* Support for non-distributable web applications
### General Concepts
#### Session Repository
The session information needs to be stored between server request.
This storage is called session repository.
Different repository implementations are supported by the session replacement mechanism.
#### Configuration
Most of the configuration can be specified with `ServletContext`s initialization
parameters, system properties and some paramaters can be provided via the agent.
Unless otherwise specified the general rule for priority of configuration is as
follows in descending order:
* `ServletContext`s initiate parameters (set through `web.xml` or programmatically since Servlet 3.x )
* Agent configuration (when exists)
* System properties
* Default values
#### Architecture
Here is the block diagram of the architecture:
```
+--------------------------------------------------+
| |
| +---+ +-------------------------------+ |
| | | | | |
| | | | | |
| | * | | | |
| | F | | | |
| | I | Wrapped | WEB APPLICATION | |
| | L | request | | |
HTTP | | T |--------->| | |
---->| | E | | | |
HTTPS| | R | | | |
| | * | | | |
| | | +-------------------------------+ |
| | | ^ |
| | | Session interaction | |
| | | v |
| | +------------------------------------------+ |
| | *Session-management* | |
| +----------------------------------------------+ |
| Container (e.g. JBoss, jetty, tomcat) |
+-------------------------------------+------------+
| JVM | *Agent* |
+-------------------------------------+------------+
```
In the above picture, *Agent*, *Filter* and *Session-management* are modules added to support
session storage in repository.
* The *Filter* wraps all incoming requests to allow session retrieval and commit.
When using the agent, all filters have code to wrap incoming requests,
however, only the first one will wrap it.
The following filter in chain will return the request it received.
The canonical implementation of a filter is
[com.amadeus.session.servlet.SessionFilter](session-replacement/src/main/java/com/amadeus/session/servlet/SessionFilter.java)
* The *Session-management* is intercepting all interactions with sessions
and communicates with the session repository.
Normally, unless using container specific interface,
container should not be aware of the existence of the session.
* The *Agent* performs instrumentation as described below.
### Session management
The general algorithm for managing sessions is independent of the underlying storage.
It has the following characteristics:
* Session retrieval from repository.
* New session creation of session with cryptographically secure session id.
For details see Session id section.
* Partial and full session updates allows updating all session attributes
or only those that were changed or touched during session request (if repository supports it).
For details see Optimized session updates section.
* Support for atomic commit allows updating all attributes at once in one transaction or network exchange (if repository supports it).
* Support of non-cacheable attributes, i.e. attributes that are stored or retrieved from repository on each access to session attribute.
For details see Non-sticky sessions and concurrent access.
* Support for session encryption when storing sessions into repository.
#### Optimized session updates
The session management keeps track of the attributes that have changed
(including deletion) and only updates those.
This means if an attribute is written once and read many times we only need to
write that attribute once.
Session management can be configured to update all the attributes no matter
what or to update all non-primitive wrappers
#### Session id
A session id is an UUID generated using type 4 algorithm, a random
sequence of bytes encoded in modified base64 algor
徐浪老师
- 粉丝: 8536
- 资源: 1万+
最新资源
- MATLAB、PSIM全桥或者半桥LLC谐振DC DC变器的设计与仿真,内含开环仿真、电压闭环仿真两个仿真文件,并含有电路参数仿真计算过程 支持版本2018b
- 基于SVPWM改进的异步电机 感应电机直接转矩控制 针对传统滞环DTC纹波较大的问题,利用SVPWM发波的方法去替滞环的离线开关状态表发波方式,一定程度的改善传统方法的纹波问题 提供对
- 11kw OBC 三相PFC仿真模型,三相功率因数校正技术,PLECS仿真 可以导入管子spice模型,仿出管子损耗,管子结温
- 扩展卡尔曼滤波与滑模观测器的结合,反电势波形近乎完美的正弦波形,观测器估算转子电角度与实际电角度相差0.3弧度左右,转速跟随效果较好
- 逆变器下垂控制,负载跳变实验,有功无功可控,电压电流波形质量好,有意抓紧下手吧 由于是仿真文件是2022b版本的,如果你电脑里是其他版本的,可联系我降版本
- labview框架生产线MES系统源码上位机程序源代码程序设计 labview框架 产线MES系统 物料管理,排产计划,设备管理,报表管理,功能齐全 扫码追溯 PLC通信 数据库存储 标签打印
- COMSOL激光超声仿真:激光激发超声波的产生lamb波的数值模拟 版本为6.1,低于此版本打不开此模型
- PWM pwm L型三相并网 离网逆变器,并网时采用单电流环控制,离网时采用电压电流双闭环控制,提供了四种调制方式:SVPWM(系统自带),SVPWM(程序编写)的gh坐标系和ab坐标系,以及SPWM
- PLC西门子200smart,3轴控制程序,西门子触摸屏程序,详细注释,IO表,电气原理图
- 永磁同步电机模型预测转矩控制MPTC MPTC采用实时在线计算的方式确保预施加的电压矢量为最优电压矢量,与直接转矩控制相比,该方法选取的电压矢量更为合理有效 提供对应的参考文献;
- 自适应无迹卡尔曼滤波AUKF算法 配套文件包含MATLAB代码+excel数据+学习资料 估计效果与系统特性有关,图片展示为一复杂系统估计效果
- 4机10节点系统暂态稳定性仿真 Simulink仿真 1.基于MATLAB Simulink平台搭建4机10节点系统仿真模型,可以仿真单相接地 两相相间短路 两相接地短路 三相短路故障情况下 系统的暂
- 基于三电平SVPWM改进的异步电机 感应电机直接转矩控制 发波方式用三电平SVPWM,相比较于两电平SVPWM和滞环离线开关表发波方式,整体的控制性能有很大的改善 提供对应的参考文献;
- MATLAB代码,车牌定位,车牌分割及车牌识别,带3千字报告
- 使用粒子群优化算法(PSO)辨识锂电池二阶RC模型参数(附MATLAB代码) 使用粒子群优化算法来辨识锂离子电池二阶RC模型的参数 将粒子群优化算法寻找到的最优参数代入二阶RC模型进行仿真,经过验证
- opencv 多角度多尺寸边缘模板匹配 带掩膜功能 仿visionpro 使用的是opencvsharp C#自定义控件,可以直接导入自己项目使用
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈