본문 바로가기
develop/spring

프로젝트 설정 - web.xml

by hybr1d 2016. 3. 25.

web.xml 설정


<!-- encoding 설정 

.do로 호출되는 경우 기본 화면에 출력되는 encoding은 utf-8로 필터링 되도록 설정

특수문자에 의한 크로스사이트 스크립트를 방지. 

-->

    <filter>

<filter-name>encodingFilter</filter-name>

<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>

<init-param>

<param-name>encoding</param-name>

<param-value>utf-8</param-value>

</init-param>

</filter>

<filter-mapping>

<filter-name>encodingFilter</filter-name>

<url-pattern>*.do</url-pattern>

</filter-mapping>

<!-- encoding 설정 -->

<!-- HTMLTagFilter 설정

파라미터로 전달되는 값 자체를 변환하는 방식

-->

<filter>

<filter-name>HTMLTagFilter</filter-name>

<filter-class>egovframework.rte.ptl.mvc.filter.HTMLTagFilter</filter-class>

</filter>

<filter-mapping>

<filter-name>HTMLTagFilter</filter-name>

<url-pattern>*.do</url-pattern>

</filter-mapping>

<!-- HTMLTagFilter 설정 -->


<!-- spring context 관련 환경설정정보 파일 위치 등록 -->

<context-param>

<param-name>contextConfigLocation</param-name>

<param-value>classpath*:egovframework/spring/context-*.xml, classpath*:egovframework/batch/job/*.xml</param-value>

</context-param>

<!-- spring context 관련 환경설정정보 파일 위치 등록 -->


<!-- spring mvc를 위한 Listener, DispatcherServlet, mvc 관련 추가 환경설정정보 파일 위치 등록 -->


<!-- spring 설정파일을 읽어 들이기 위해서 org.springframework.web.context.ContextLoaderListener 가 필요 

이 리스너가 동작해야 설정파일을 읽어들이고 필요한 객체들을 등록하고 만드는 것

이 리스너가 동작하는데 설정파일의 위치를 알려주기 위하여 contextConfigLocation을 통해 위치 지정

-->

<context-param>

<param-name>contextConfigLocation</param-name>

<param-value>classpath*:egovframework/spring/context-*.xml, classpath*:egovframework/batch/job/*.xml</param-value>

</context-param>

<listener>

<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

</listener>


<servlet>

<servlet-name>websquareDispatcher</servlet-name>

<servlet-class>websquare.http.DefaultRequestDispatcher</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>websquareDispatcher</servlet-name>

<url-pattern>*.wq</url-pattern>

    </servlet-mapping>

  

<servlet>

<servlet-name>action</servlet-name>

<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

<init-param>

<param-name>contextConfigLocation</param-name>

<param-value>/WEB-INF/config/egovframework/springmvc/dispatcher-servlet.xml</param-value>

</init-param>

<load-on-startup>1</load-on-startup>

</servlet>

    

<servlet-mapping>

<servlet-name>action</servlet-name>

<url-pattern>*.do</url-pattern>

<url-pattern>/js/MessageUtil.js</url-pattern>

</servlet-mapping>

<!-- SSO Servlet Start -->

<servlet>

<servlet-name>Initialize</servlet-name>

<servlet-class>com.ubintis.framework.Initialize</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet>

<servlet-name>SSOLegacy</servlet-name>

<servlet-class>com.ubintis.app.SSOLegacy</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>SSOLegacy</servlet-name>

<url-pattern>/SSOLegacy.do</url-pattern>

</servlet-mapping>

<!-- SSO Servlet End -->


<welcome-file-list>

<welcome-file>index.jsp</welcome-file>

</welcome-file-list>

    

<login-config>

<auth-method>BASIC</auth-method>

</login-config>

    

<error-page>

<exception-type>java.lang.Throwable</exception-type>

<location>/common/error.jsp</location>

</error-page>

<error-page>

<error-code>404</error-code>

<location>/common/error.jsp</location>

</error-page>

<error-page>

<error-code>500</error-code>

<location>/common/error.jsp</location>

</error-page>

<!-- RequestContextListener

현재 요청되어진 HttpServletRequest 객체의 레퍼런스 정보를 저장하는 기능 

-->

<listener>

<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>

</listener>

<!-- RequestContextListener -->

'develop > spring' 카테고리의 다른 글

spring restful 관련 web.xml, servlet.xml 파일 설정  (0) 2017.06.21
spring property 사용  (0) 2016.03.25