01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/sam/tags/sakai_2-4-1/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/servlet/StoreApplicationContext.java $
03: * $Id: StoreApplicationContext.java 15401 2006-09-28 20:34:51Z ktsao@stanford.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2004, 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the"License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.tool.assessment.ui.servlet;
21:
22: import javax.servlet.http.HttpServlet;
23: import javax.servlet.ServletConfig;
24: import javax.servlet.ServletException;
25: import org.apache.commons.logging.Log;
26: import org.apache.commons.logging.LogFactory;
27: import org.springframework.web.context.WebApplicationContext;
28: import org.springframework.web.context.support.WebApplicationContextUtils;
29: import org.sakaiproject.spring.SpringBeanLocator;
30: import org.sakaiproject.tool.assessment.ui.listener.util.ContextUtil;
31:
32: public class StoreApplicationContext extends HttpServlet {
33:
34: /**
35: *
36: */
37: private static final long serialVersionUID = -930231313808212406L;
38: private static Log log = LogFactory
39: .getLog(StoreApplicationContext.class);
40: private WebApplicationContext ctx = null;
41:
42: public void init(ServletConfig config) throws ServletException {
43: super .init(config);
44: if (ctx == null) {
45: ctx = WebApplicationContextUtils
46: .getRequiredWebApplicationContext(config
47: .getServletContext());
48: //log.log("***context="+ctx);
49: SpringBeanLocator.setApplicationContext(ctx);
50:
51: ContextUtil.setServletContext(config.getServletContext());
52: }
53: }
54:
55: }
|