All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.antcore.security.request.HttpSecurityServletRequestWrapper Maven / Gradle / Ivy

The newest version!
package cn.antcore.security.request;

import cn.antcore.security.session.SessionStrategy;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Request包装类, 生成自定义Session
 * 
*

Created by Hong.

*

2021/3/24

**/ public class HttpSecurityServletRequestWrapper extends HttpServletRequestWrapper { private HttpSession session; public HttpSecurityServletRequestWrapper(HttpServletRequest request, HttpServletResponse response, SessionStrategy sessionStrategy) { super(request); if (sessionStrategy != null) { this.session = sessionStrategy.getSession(request, response); return; } this.session = super.getSession(); } @Override public HttpSession getSession() { return session; } @Override public HttpSession getSession(boolean create) { return this.getSession(); } @Override public String getRequestedSessionId() { return this.session.getId(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy