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 javax.servlet.http.HttpServletRequest;
19: import javax.servlet.http.HttpServletResponse;
20:
21: import de.odysseus.calyxo.base.ModuleContext;
22: import de.odysseus.calyxo.control.conf.DispatchConfig;
23: import de.odysseus.calyxo.control.conf.FilterConfig;
24:
25: /**
26: * Filter interface.
27: * A filter is used to intercept command execution.
28: * This may involve command pre-processing, execution and post-processing.
29: * Filtering is performed in the <code>filter</code> method.
30: *
31: * Filters are initialized by the controller via the <code>init()</code>.
32: * Exactly one instance will be created per filter configuration.
33: *
34: * @author Christoph Beck
35: */
36: public interface Filter {
37:
38: /**
39: * Initialize filter instance.
40: * @param config filter configuration element
41: * @param module our module context
42: * @throws Exception if initialization fails for some reason
43: */
44: public void init(FilterConfig config, ModuleContext module)
45: throws Exception;
46:
47: /**
48: * Filter the execution of the specified command.
49: */
50: public DispatchConfig filter(HttpServletRequest request,
51: HttpServletResponse response, Command command)
52: throws Exception;
53: }
|