<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc.xsd" default-autowire="byName">

    <mvc:annotation-driven/>

    <mvc:resources mapping="/resources/**" location="/WEB-INF/resources/"/>
    <mvc:resources mapping="/assets/flash/**" location="/WEB-INF/resources/assets/flash/"/>

    <!--
    <mvc:annotation-driven/>
    <mvc:default-servlet-handler default-servlet-name="default"/>
    <mvc:resources mapping="/resources/**" location="/resources/"/>
    <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"/>
    <mvc:resources mapping="/assets/flash/**" location="/resources/assets/flash/"/>
    -->

    <mvc:interceptors>
        <!-- 前台验证 -->
        <mvc:interceptor>
            <mvc:mapping path="/admin/app/*"/>
            <mvc:mapping path="/admin/instance/*"/>
            <mvc:mapping path="/client/show/*"/>
            <mvc:mapping path="/server/*"/>
            <bean class="com.sohu.cache.interceptor.FrontUserLoginInterceptor"/>
        </mvc:interceptor>
        <!-- 后台管理员验证 -->
        <mvc:interceptor>
            <mvc:mapping path="/manage/app/*"/>
            <mvc:mapping path="/manage/instance/*"/>
            <mvc:mapping path="/manage/user/*"/>
            <mvc:mapping path="/manage/quartz/*"/>
            <mvc:mapping path="/manage/total/*"/>
            <mvc:mapping path="/manage/machine/*"/>
            <mvc:mapping path="/manage/notice/*"/>
            <mvc:mapping path="/import/app/*"/>
            <mvc:mapping path="/manage/config/*"/>
            <mvc:mapping path="/data/migrate/*"/>
            <mvc:mapping path="/manage/redisConfig/*"/>
            <bean class="com.sohu.cache.interceptor.ManageUserLoginInterceptor"/>
        </mvc:interceptor>
        <!-- 应用和实例权限验证 -->
        <mvc:interceptor>
            <mvc:mapping path="/admin/app/*"/>
            <mvc:mapping path="/admin/instance/*"/>
            <bean class="com.sohu.cache.interceptor.AppAndInstanceAuthorityInterceptor"/>
        </mvc:interceptor>
    </mvc:interceptors>

    <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
        <property name="order" value="1"/>
        <property name="contentNegotiationManager">
            <bean class="org.springframework.web.accept.ContentNegotiationManager">
                <constructor-arg>
                    <bean class="org.springframework.web.accept.PathExtensionContentNegotiationStrategy">
                        <constructor-arg>
                            <map>
                                <entry key="json" value="application/json"/>
                            </map>
                        </constructor-arg>
                    </bean>
                </constructor-arg>
            </bean>
        </property>
        <property name="defaultViews">
            <list>
                <bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"/>
            </list>
        </property>
    </bean>

    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="order" value="2"/>
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
        <property name="prefix" value="/WEB-INF/jsp/"/>
        <property name="suffix" value=".jsp"/>
    </bean>

    <context:component-scan base-package="com.sohu.cache.client.heartbeat,com.sohu.cache.web.controller"/>



</beans>
