01: /*
02: * Copyright 2004, 2005, 2006 Odysseus Software GmbH
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package de.odysseus.calyxo.control;
17:
18: import java.io.IOException;
19:
20: import javax.servlet.ServletException;
21: import javax.servlet.http.HttpServletRequest;
22: import javax.servlet.http.HttpServletResponse;
23:
24: import de.odysseus.calyxo.base.ModuleContext;
25: import de.odysseus.calyxo.control.conf.ActionConfig;
26: import de.odysseus.calyxo.control.conf.DispatchConfig;
27: import de.odysseus.calyxo.control.conf.ExceptionHandlerConfig;
28:
29: /**
30: * Exception handler interface.
31: *
32: * @author Christoph Beck
33: */
34: public interface ExceptionHandler {
35:
36: /**
37: * Initialize exception handler.
38: * @param config exception configuration element
39: * @param module our module context
40: * @throws Exception
41: */
42: public void init(ExceptionHandlerConfig config, ModuleContext module)
43: throws Exception;
44:
45: /**
46: * Handle exception.
47: * @param request the request we are processing
48: * @param response the response we are creating
49: * @param actionConfig the action configuration
50: * @param exception the exception that occured during action invocation
51: * @return a {@link DispatchConfig} instance describing where and how
52: * control should be forwarded/included, or <code>null</code> if the
53: * response has already been completed.
54: * @exception IOException may be thrown if the exception could not be handled.
55: * @exception ServletException may be thrown if the exception could not be handled.
56: */
57: public DispatchConfig handle(HttpServletRequest request,
58: HttpServletResponse response, ActionConfig actionConfig,
59: Exception exception) throws IOException, ServletException;
60:
61: }
|