1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.labs.sessionPolicy;
17
18 import org.kuali.rice.krad.labs.KradLabsController;
19 import org.kuali.rice.krad.labs.KradLabsForm;
20 import org.kuali.rice.krad.util.GlobalVariables;
21 import org.kuali.rice.krad.web.controller.MethodAccessible;
22 import org.kuali.rice.krad.web.form.UifFormBase;
23 import org.springframework.stereotype.Controller;
24 import org.springframework.validation.BindingResult;
25 import org.springframework.web.bind.annotation.ModelAttribute;
26 import org.springframework.web.bind.annotation.RequestMapping;
27 import org.springframework.web.servlet.ModelAndView;
28
29 import javax.servlet.http.HttpServletRequest;
30 import javax.servlet.http.HttpServletResponse;
31
32
33
34
35
36
37 @Controller
38 @RequestMapping(value = "/sessionPolicy")
39 public class LabsSessionPolicyController extends KradLabsController {
40
41 @RequestMapping(params = "methodToCall=killSession")
42 public ModelAndView killSession(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
43 HttpServletRequest request, HttpServletResponse response) {
44
45 request.getSession().invalidate();
46
47 return getUIFModelAndView(form);
48 }
49
50 @RequestMapping(params = "methodToCall=sessionTimeout")
51 public ModelAndView sessionTimeout(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
52 HttpServletRequest request, HttpServletResponse response) {
53
54 GlobalVariables.getMessageMap().addGrowlMessage("Result", "labs.methodInvoked", "sessionTimeout");
55
56 return getUIFModelAndView(form);
57 }
58
59 @MethodAccessible
60 @RequestMapping(params = "methodToCall=setSessionTimeout")
61 public ModelAndView setSessionTimeout(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
62 HttpServletRequest request, HttpServletResponse response) {
63
64
65 request.getSession().setMaxInactiveInterval(120000);
66 ((KradLabsForm) form).setSessionTimeoutInterval(120000);
67
68 return getUIFModelAndView(form);
69 }
70 }