-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProjectInterceptor.java
39 lines (29 loc) · 1.14 KB
/
ProjectInterceptor.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package org.scit.app.interceptors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
public class ProjectInterceptor extends HandlerInterceptorAdapter {
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
System.out.println("post...");
HttpSession session = request.getSession();
boolean isLeader = (Boolean) session.getAttribute("isLeader");
String proNum = (String) session.getAttribute("proNum");
if(isLeader) {
System.out.println("isLeader true!!!!!");
response.sendRedirect("gotoGroupLeader?proNum="+proNum);
} else {
System.out.println("isLeader false!!!!!");
response.sendRedirect("gotoGroupMember?proNum="+proNum);
}
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
System.out.println("pre....");
return true;
}
}