{"id":50350516,"url":"https://github.com/x-hansong/RedisHttpSession","last_synced_at":"2026-06-15T12:01:42.087Z","repository":{"id":57724117,"uuid":"57365169","full_name":"x-hansong/RedisHttpSession","owner":"x-hansong","description":"HttpSession base on Redis, support RESTful API.","archived":false,"fork":false,"pushed_at":"2016-08-14T15:40:51.000Z","size":31,"stargazers_count":84,"open_issues_count":0,"forks_count":40,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-03-18T06:52:13.232Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/x-hansong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-29T07:34:11.000Z","updated_at":"2023-11-12T14:25:09.000Z","dependencies_parsed_at":"2022-09-02T06:55:31.790Z","dependency_job_id":null,"html_url":"https://github.com/x-hansong/RedisHttpSession","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/x-hansong/RedisHttpSession","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-hansong%2FRedisHttpSession","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-hansong%2FRedisHttpSession/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-hansong%2FRedisHttpSession/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-hansong%2FRedisHttpSession/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/x-hansong","download_url":"https://codeload.github.com/x-hansong/RedisHttpSession/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-hansong%2FRedisHttpSession/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34361403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-29T21:00:23.923Z","updated_at":"2026-06-15T12:01:42.076Z","avatar_url":"https://github.com/x-hansong.png","language":"Java","funding_links":[],"categories":["分布式开发"],"sub_categories":["微服务框架"],"readme":"# RedisHttpSession\nRedisHttpSession provides an way to transparently store http session in redis, which allows multi-clients to share the sessions.\n\n# Features\n- **RESTful APIs** - RedisHttpSession allows providing session ids in headers to work with RESTful APIs.\n- **Transparently** - RedisHttpSession allows using HttpSession APIs directly, while the magic work with redis is totally transparent.\n\n# Quick Start\n\n## maven\n    \u003cdependency\u003e\n      \u003cgroupId\u003ecom.github.x-hansong\u003c/groupId\u003e\n      \u003cartifactId\u003eredis-http-session\u003c/artifactId\u003e\n      \u003cversion\u003e1.0\u003c/version\u003e\n    \u003c/dependency\u003e\n    \n## gradle\n    dependencies {\n        compile \"com.github.x-hansong:redis-http-session:1.0\"\n    }\n\n## Usage\n\nConfigures redis in `redis.json`, and put it to the `src` folder or `resources` folder.(see example)\n\n    {\n      \"connectionConfig\": {\n        \"maxTotal\": \"10\",\n        \"maxIdle\": \"10\",\n        \"maxWait\": \"10000\",\n        \"timeout\": \"10000\"\n      },\n      \"redisServers\":[\n        {\n          \"ip\":\"127.0.0.1\",\n          \"port\":\"3679\",\n          \"password\":\"if no password, remove this property\"\n        }\n     ]\n    }\n\nUse `RedisHttpSessionFilter` or a subclass of it as a Filter. \n \nFor example:\n \n- With `web.xml`\n \n        \u003cfilter\u003e\n            \u003cfilter-name\u003eredisHttpSessionFilter\u003c/filter-name\u003e\n            \u003cfilter-class\u003ecom.hansong.session.RedisHttpSessionFilter\u003c/filter-class\u003e\n        \u003c/filter\u003e\n        \u003cfilter-mapping\u003e\n            \u003cfilter-name\u003eredisHttpSessionFilter\u003c/filter-name\u003e\n            \u003curl-pattern\u003e/*\u003c/url-pattern\u003e\n        \u003c/filter-mapping\u003e\n        \n- With Spring-boot\n\n        @Component\n        public class MySessionFilter extends RedisHttpSessionFilter{}\n        \n- With Other\n\n    make sure the `RedisHttpSessionFilter` or a subclass of it to be a Filter for each request.\n    \nAfter that, for each request/response, their header will have a field -- `x-auth-token`, which is the session id.\n\nAnd we can use the `HttpSession` as we always do, but the session is now in redis. If you check the redis, you will see something following.\n\n    localhost:63679\u003e keys *\n    1) \"session:fd9ec3cf-fb9b-4672-ade6-67a810e7db9f\"\n    2) \"session:cbaa057c-85a4-475d-b399-38c320e85dcc\"\n    3) \"session:13e030f5-de3d-458f-8d25-fd5643c40ff0\"\n    4) \"session:262596b3-3d13-4df1-8328-714153c1ae83\"\n    5) \"session:0b7d04c6-eaac-4eed-a9aa-8366f25f04f0\"\n      \n    localhost:63679\u003e hgetall session:fd9ec3cf-fb9b-4672-ade6-67a810e7db9f\n    1) \"lastAccessedTime\"\n    2) \"\\xac\\xed\\x00\\x05sr\\x00\\x0ejava.lang.Long;\\x8b\\xe4\\x90\\xcc\\x8f#\\xdf\\x02\\x00\\x01J\\x00\\x05valuexr\\x00\\x10java.lang.Number\\x86\\xac\\x95\\x1d\\x0b\\x94\\xe0\\x8b\\x02\\x00\\x00xp\\x00\\x00\\x01T\\x91\\x03\\\"\\xec\"\n    3) \"maxInactiveInterval\"\n    4) \"\\xac\\xed\\x00\\x05sr\\x00\\x11java.lang.Integer\\x12\\xe2\\xa0\\xa4\\xf7\\x81\\x878\\x02\\x00\\x01I\\x00\\x05valuexr\\x00\\x10java.lang.Number\\x86\\xac\\x95\\x1d\\x0b\\x94\\xe0\\x8b\\x02\\x00\\x00xp\\x00\\x00\\a\\b\"\n    5) \"creationTime\"\n    6) \"\\xac\\xed\\x00\\x05sr\\x00\\x0ejava.lang.Long;\\x8b\\xe4\\x90\\xcc\\x8f#\\xdf\\x02\\x00\\x01J\\x00\\x05valuexr\\x00\\x10java.lang.Number\\x86\\xac\\x95\\x1d\\x0b\\x94\\xe0\\x8b\\x02\\x00\\x00xp\\x00\\x00\\x01T\\x91\\x03\\\"\\xb4\"\n\nAs you see, RedisHttpSession store the Serialized Object to the redis. For each request(except the first request), it needs have a `x-auth-token` in headers, which can be got from the response, so the server can use the session associated with the request. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-hansong%2FRedisHttpSession","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fx-hansong%2FRedisHttpSession","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-hansong%2FRedisHttpSession/lists"}