01: /*
02: *
03: * Copyright 2007 Florin T.PATRASCU
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18:
19: package ca.flop.jpublish.dwr;
20:
21: import org.jpublish.SiteContext;
22:
23: import javax.servlet.ServletConfig;
24: import javax.servlet.ServletContext;
25: import java.util.Enumeration;
26: import java.util.Properties;
27:
28: /**
29: * I am using this implementation to fool the DWRProcessor (a DwrServlet clone).
30: * Interim solution
31: *
32: * @author <a href="mailto:florin.patrascu@gmail.com">Florin T.PATRASCU</a>
33: * @since $Revision$ (created: Oct 1, 2006 4:58:33 PM)
34: */
35: public class FakeServletConfig implements ServletConfig {
36: private Properties initParameters = new Properties();
37: private ServletContext servletContext;
38:
39: public FakeServletConfig(ServletContext servletContext) {
40: this .servletContext = servletContext;
41: }
42:
43: public String getServletName() {
44: return "JPublish " + SiteContext.JPUBLISH_VERSION;
45: }
46:
47: public ServletContext getServletContext() {
48: return servletContext;
49: }
50:
51: public String getInitParameter(String name) {
52: return initParameters.getProperty(name);
53: }
54:
55: public void setInitParameter(String name, String value) {
56: if (name != null & value != null)
57: initParameters.setProperty(name, value);
58: }
59:
60: public Enumeration getInitParameterNames() {
61: return initParameters.keys();
62: }
63: }
|