tomcat session cookie值设置逻辑

tomcat session cookie 值设置,tomcat jsessionid设置

##调用request.getSession()

@Controller
@RequestMapping("/cookie")
public class CookieController {

    @RequestMapping("/tomcatRequest")
    @ResponseBody
    public String tomcatRequest(HttpServletRequest request) {
        String yym = request.getParameter("yym");
        request.getSession().setAttribute("key", yym);
        return yym;
    }

}

##源码

tomcat session cookie值设置逻辑_第1张图片

tomcat session cookie值设置逻辑_第2张图片

##请求中没有获取到jsessionid,新建值

tomcat session cookie值设置逻辑_第3张图片

##设置到response header

tomcat session cookie值设置逻辑_第4张图片

##reponse header写回客户端

tomcat session cookie值设置逻辑_第5张图片

你可能感兴趣的:(tomcat,java,前端)