1
2
3
4
5
6
7
8
9
10
11 package psiprobe.controllers.apps;
12
13 import jakarta.servlet.http.HttpServletRequest;
14 import jakarta.servlet.http.HttpServletResponse;
15
16 import org.apache.catalina.Context;
17 import org.springframework.beans.factory.annotation.Value;
18 import org.springframework.stereotype.Controller;
19 import org.springframework.web.bind.ServletRequestUtils;
20 import org.springframework.web.bind.annotation.RequestMapping;
21 import org.springframework.web.servlet.ModelAndView;
22 import org.springframework.web.servlet.view.RedirectView;
23
24 import psiprobe.controllers.AbstractContextHandlerController;
25
26
27
28
29 @Controller
30 public class RemoveApplicationAttributeController extends AbstractContextHandlerController {
31
32 @RequestMapping(path = "/app/rmappattr.htm")
33 @Override
34 public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
35 throws Exception {
36 return super.handleRequest(request, response);
37 }
38
39 @Override
40 protected ModelAndView handleContext(String contextName, Context context,
41 HttpServletRequest request, HttpServletResponse response) throws Exception {
42
43 String attrName = ServletRequestUtils.getStringParameter(request, "attr");
44 context.getServletContext().removeAttribute(attrName);
45
46 return new ModelAndView(new RedirectView(
47 request.getContextPath() + getViewName() + "?" + request.getQueryString()));
48 }
49
50 @Value("appattributes")
51 @Override
52 public void setViewName(String viewName) {
53 super.setViewName(viewName);
54 }
55
56 }