19 package org.turro.elephant.context;
21 import java.util.function.Supplier;
22 import javax.servlet.http.HttpServletRequest;
23 import javax.servlet.http.HttpServletResponse;
33 public static <E> E
get(String key, Supplier<E> supplier) {
37 public static <E> E
get(HttpServletRequest request, HttpServletResponse response, String key, Supplier<E> supplier) {
41 public static <E> E
get(
IConstructor constructor, String key, Supplier<E> supplier) {
42 if(constructor !=
null && !constructor.isHeadless()) {
43 E
object = (E) constructor.getSessionAttribute(key);
45 object = supplier.
get();
46 constructor.setSessionAttribute(key,
object);
50 return supplier.get();
53 public static void remove(String key) {
57 public static void remove(HttpServletRequest request, HttpServletResponse response, String key) {
62 if(constructor !=
null && !constructor.isHeadless()) {
63 constructor.removeSessionAttribute(key);
static< E > E get(String key, Supplier< E > supplier)
IConstructor getConstructor()
static Application getApplication()
static IConstructor getConstructor(HttpServletRequest request, HttpServletResponse response)