1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krad.web.filter; |
17 | |
|
18 | |
import org.apache.log4j.Logger; |
19 | |
|
20 | |
import javax.servlet.Filter; |
21 | |
import javax.servlet.FilterChain; |
22 | |
import javax.servlet.FilterConfig; |
23 | |
import javax.servlet.ServletException; |
24 | |
import javax.servlet.ServletRequest; |
25 | |
import javax.servlet.ServletResponse; |
26 | |
import javax.servlet.http.HttpServletRequest; |
27 | |
import java.io.IOException; |
28 | |
|
29 | 0 | public class SessionFilter implements Filter { |
30 | 0 | private static final Logger LOG = Logger.getLogger(SessionFilter.class); |
31 | |
|
32 | |
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { |
33 | |
try { |
34 | 0 | ((HttpServletRequest) request).getSession(); |
35 | |
} |
36 | 0 | catch (IllegalStateException ise) { |
37 | 0 | LOG.info("A user was denied a session"); |
38 | 0 | throw new IllegalStateException(new StringBuffer("Thank you for visiting Kuali Test Drive!\n\n").append("To ensure that test drivers of the Kuali System demo site have a safe and uneventful trip, we must limit the number of concurrent users and, unfortunately, that number has been reached.\n\n").append("Please check back later.\n\n").append("Questions can be submitted to the Kuali Test Drive listserv at mailto:kualitestdrive@oncourse.iu.edu").toString()); |
39 | 0 | } |
40 | 0 | filterChain.doFilter(request, response); |
41 | 0 | } |
42 | |
|
43 | |
public void init(FilterConfig filterConfig) throws ServletException { |
44 | 0 | LOG.info("Initialized"); |
45 | 0 | } |
46 | |
|
47 | |
public void destroy() { |
48 | 0 | LOG.info("Destroyed"); |
49 | 0 | } |
50 | |
} |