cn.ocoop.framework.safe.WebContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of safe-spring-boot-starter Show documentation
Show all versions of safe-spring-boot-starter Show documentation
simple and easy use security framework to protect your spring boot web-application.
package cn.ocoop.framework.safe;
import lombok.Getter;
import lombok.Setter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class WebContext {
private static final ThreadLocal THREAD_LOCAL = new InheritableThreadLocal<>();
public static void clear() {
THREAD_LOCAL.remove();
}
public static Context get() {
return THREAD_LOCAL.get();
}
public static void set(Context context) {
THREAD_LOCAL.set(context);
}
@Getter
@Setter
public static class Context {
private HttpServletRequest request;
private HttpServletResponse response;
private String sessionId;
public Context(HttpServletRequest request, HttpServletResponse response) {
this.request = request;
this.response = response;
}
}
}