View Javadoc

1   /*
2    * Copyright 2008 Hippo
3    *
4    * Licensed under the Apache License, Version 2.0 (the  "License"); 
5    * you may not use this file except in compliance with the License. 
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" 
12   * BASIS, 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 nl.hippo.client.webapp;
17  
18  import javax.servlet.ServletContext;
19  
20  import nl.hippo.client.api.service.WebdavService;
21  
22  public class ContextWrapper {
23  
24      private ServletContext context;
25  
26      public ContextWrapper(ServletContext context) {
27          this.context = context;
28      }
29  
30      public WebdavService lookupWebdav(String domain) {
31          WebdavService webdavService = null;
32          Object obj = context.getAttribute(domain);
33          if (obj != null && obj instanceof WebdavService) {
34              webdavService = (WebdavService) obj;
35          } else {
36              WebAppLogger.log.error("WebdavService lookup failed");
37          }
38          return webdavService;
39      }
40  
41  //    public ContentIncluder lookupContentIncluder(String domain) {
42  //        ContentIncluder contentIncluder = null;
43  //        Object obj = context.getAttribute(key);
44  //        if (obj != null && obj instanceof ContentIncluder) {
45  //            contentIncluder = (ContentIncluder) obj;
46  //        } else {
47  //            WebAppLogger.log.error("ContentIncluder lookup failed");
48  //        }
49  //        return contentIncluder;
50  //    }
51  
52  //    public String lookupString(String key) {
53  //        String result = null;
54  //        Object obj = context.getAttribute(key);
55  //        if (obj != null && obj instanceof String) {
56  //            result = (String) obj;
57  //        } else {
58  //            WebAppLogger.log.error("String lookup failed");
59  //        }
60  //        return result;
61  //    }
62  
63  }