1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krad.web.struts.pojo; |
17 | |
|
18 | |
import javax.servlet.http.HttpServletRequest; |
19 | |
import javax.servlet.http.HttpServletResponse; |
20 | |
|
21 | |
import org.apache.commons.logging.Log; |
22 | |
import org.apache.commons.logging.LogFactory; |
23 | |
import org.apache.struts.Globals; |
24 | |
import org.apache.struts.action.ActionForm; |
25 | |
import org.apache.struts.action.ActionForward; |
26 | |
import org.apache.struts.action.ActionMapping; |
27 | |
import org.apache.struts.action.ExceptionHandler; |
28 | |
import org.apache.struts.config.ExceptionConfig; |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | 0 | public class AuthorizationExceptionHandler extends ExceptionHandler { |
34 | |
|
35 | |
private static final String AUTHORIZATION_EXCEPTION_HANDLER = "authorizationExceptionHandler"; |
36 | |
|
37 | 0 | private static final Log LOG = LogFactory.getLog(AuthorizationExceptionHandler.class); |
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
@Override |
47 | |
public ActionForward execute(Exception exception, ExceptionConfig exceptionConfig, ActionMapping mapping, ActionForm form, HttpServletRequest request, |
48 | |
HttpServletResponse response) { |
49 | |
|
50 | 0 | if (LOG.isTraceEnabled()) { |
51 | 0 | String message = String.format("ENTRY %s", exception.getMessage()); |
52 | 0 | LOG.trace(message); |
53 | |
} |
54 | |
|
55 | 0 | request.setAttribute(Globals.EXCEPTION_KEY, exception); |
56 | |
|
57 | 0 | ActionForward forward = mapping.findForward(AUTHORIZATION_EXCEPTION_HANDLER); |
58 | |
|
59 | 0 | if (LOG.isTraceEnabled()) { |
60 | 0 | LOG.trace(String.format("EXIT %s", exception.getMessage())); |
61 | |
} |
62 | |
|
63 | 0 | return forward; |
64 | |
} |
65 | |
|
66 | |
} |