jetty sessionId生成
2014-06-22 23:35
246 查看
jetty中sessionId生成源码如下:
public String newSessionId(HttpServletRequest request, long created) { synchronized (this) { if (request!=null) { // A requested session ID can only be used if it is in use already. String requested_id=request.getRequestedSessionId(); if (requested_id!=null) { String cluster_id=getClusterId(requested_id); if (idInUse(cluster_id)) return cluster_id; } // Else reuse any new session ID already defined for this request. String new_id=(String)request.getAttribute(__NEW_SESSION_ID); if (new_id!=null&&idInUse(new_id)) return new_id; } // pick a new unique ID! String id=null; while (id==null||id.length()==0||idInUse(id)) { long r0=_weakRandom ?(hashCode()^Runtime.getRuntime().freeMemory()^_random.nextInt()^(((long)request.hashCode())<<32)) :_random.nextLong(); if (r0<0) r0=-r0; long r1=_weakRandom ?(hashCode()^Runtime.getRuntime().freeMemory()^_random.nextInt()^(((long)request.hashCode())<<32)) :_random.nextLong(); if (r1<0) r1=-r1; id=Long.toString(r0,36)+Long.toString(r1,36); //add in the id of the node to ensure unique id across cluster //NOTE this is different to the node suffix which denotes which node the request was received on if (_workerName!=null) id=_workerName + id; } request.setAttribute(__NEW_SESSION_ID,id); return id; } }
相关文章推荐
- 配置TOMCAT SESSIONID 字符长度和生成算法
- 配置TOMCAT SESSIONID 字符长度和生成算法
- php生成SessionID和图片校验码的思路和实现
- jetty对sessionId的处理分析
- php生成SessionID和图片校验码的思路和实现代码
- SessionUtil Tomcat 生成 session id 的算法
- php中session_id()函数详细介绍,会话id生成过程及session id长度
- 生成sessionid和随机密码的例子
- 解析PHP默认的session id生成算法
- php生成SessionID和图片校验码的思路和实现
- 配备TOMCAT SESSIONID 字符长度和生成算法
- 设置TOMCAT SESSIONID 字符长度和生成算法
- session对象在web开发中的创建以及sessionId生成并返回客户端的运行机制
- 设置TOMCAT SESSIONID 字符长度和生成算法
- php生成SessionID和图片校验码的思路和实现
- 在shiro当设置sessionIdCookie配置的domain和访问url不匹配时,每次请求都会重新生成session
- php中session_id()函数详细介绍,会话id生成过程及session id长度
- PHP的SESSIONID生成原理
- jsessionid 的使用 (使用httpconnection 生成静态页面是跳过session)
- php生成SessionID和图片校验码的思路和实现