1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.struts.chain.commands.servlet;
22
23 import jakarta.servlet.http.HttpServletRequest;
24 import jakarta.servlet.http.HttpServletResponse;
25
26 import org.apache.struts.action.ActionForm;
27 import org.apache.struts.action.ActionMapping;
28 import org.apache.struts.chain.commands.AbstractExceptionHandler;
29 import org.apache.struts.chain.commands.util.ClassUtils;
30 import org.apache.struts.chain.contexts.ActionContext;
31 import org.apache.struts.chain.contexts.ServletActionContext;
32 import org.apache.struts.config.ActionConfig;
33 import org.apache.struts.config.ExceptionConfig;
34 import org.apache.struts.config.ForwardConfig;
35 import org.apache.struts.config.ModuleConfig;
36
37
38
39
40
41
42
43 public class ExceptionHandler extends AbstractExceptionHandler {
44
45
46
47
48 protected ForwardConfig handle(ActionContext context, Exception exception,
49 ExceptionConfig exceptionConfig, ActionConfig actionConfig,
50 ModuleConfig moduleConfig)
51 throws Exception {
52
53 ServletActionContext sacontext = (ServletActionContext) context;
54 ActionForm actionForm = sacontext.getActionForm();
55 HttpServletRequest request = sacontext.getRequest();
56 HttpServletResponse response = sacontext.getResponse();
57
58
59 org.apache.struts.action.ExceptionHandler handler =
60 (org.apache.struts.action.ExceptionHandler) ClassUtils
61 .getApplicationInstance(exceptionConfig.getHandler());
62
63 return (handler.execute(exception, exceptionConfig,
64 (ActionMapping) actionConfig, actionForm, request, response));
65 }
66 }