1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
import javax.servlet.http.HttpSession;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes;
public class HttpSessionUtil {
public static HttpSession getHttpSession() {
HttpSession httpSession = null;
final ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder .currentRequestAttributes(); httpSession = requestAttributes.getRequest().getSession();
return httpSession;
}
}
|
近期评论