kr.co.hit.live.web.action
Class WebApplicationContextLoader
java.lang.Object
kr.co.hit.live.web.action.WebApplicationContextLoader
- All Implemented Interfaces:
- EventListener, javax.servlet.ServletContextListener
public class WebApplicationContextLoader
- extends Object
- implements javax.servlet.ServletContextListener
Servlet 컨테이너가 초기화되는 시점과 Servlet 컨테이너가 중지되는 시점에 호출되는
ServletContextListener의 구현 클래스이다.
해당 ServletContext에 WebApplicatinContext 객체를 생성하여 담아 놓는다.
WebApplicationContext는 Servlet 프로그램이나 WebAction 클래스에서 사용이 가능하며
ServiceContainer와 Message resources 등의 WebApplication 수행을 위한
정보를 제공한다.
web.xml 에 아래와 같이 <listener> 를 설정하여야 한다. <listener>는 web.xml 내에서
<filter-mapping>와 <servlet> 사이에 위치한다.
<listener>
<listener-class>kr.co.hit.live.web.action.WebApplicationContextLoader</listener-class>
</listener>
WebApplicationContextLoader는 web.xml의 <context-param>를 사용하여 다음의 파라메터를 지정할 수 있다.
- live.web.default.resource : 사용할 메시지 Resource 명을 지정한다. <context-param>로 지정되지 않은 경우에는
live 설정 파일(live-config.properties)에서 live.resources.default.name로 지정된 값을 사용하며
이것도 지정되지 않은 경우에는 "default"를 사용한다. 메시지 리소스는 WebApplicationContext의
getMessages() 메소드를 사용하여 얻어올 수 있다.
아래는 Context parameter을 지정하는 예시이다. <context-param> 는 <listener> 전에 정의한다.
<context-param>
<param-name>
live.web.default.resource
</param-name>
<param-value>
himed
</param-value>
</context-param>
- Since:
- 4.0
- Author:
- 김형도
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WebApplicationContextLoader
public WebApplicationContextLoader()
contextInitialized
public void contextInitialized(javax.servlet.ServletContextEvent sce)
- Specified by:
contextInitialized in interface javax.servlet.ServletContextListener
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent sce)
- Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener
Copyright © 2014. All Rights Reserved.