<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	version="2.5">
	<context-param>
		<description>Spring集成Web环境的通用配置,用于加载除Web层的Bean</description>
		<param-name>contextConfigLocation</param-name>
		<param-value>
			classpath*:spring/*.xml
		</param-value>
	</context-param>
	<context-param>
		<description>缓存类型,支持redis、ehcache和hashmap三种</description>
		<param-name>cacheType</param-name>
		<param-value>hashmap</param-value>
	</context-param>
	<filter>
		<filter-name>sitemesh</filter-name>
		<filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
	</filter>
	<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>
		<init-param>
			<param-name>forceEncoding</param-name>
			<param-value>true</param-value>
		</init-param>
	</filter>
	<filter>
		<filter-name>webAppFilter</filter-name>
		<filter-class>ins.framework.web.filter.WebAppFilter</filter-class>
	</filter>
	<filter>
		<filter-name>HiddenHttpMethodFilter</filter-name>
		<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
	</filter>
	<filter>
		<filter-name>RequestFilter</filter-name>
		<filter-class>com.sinosoft.aop.log.tool.RequestFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>encodingFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>webAppFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>HiddenHttpMethodFilter</filter-name>
		<servlet-name>springmvc</servlet-name>
	</filter-mapping>
	<filter-mapping>
		<filter-name>RequestFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>RequestFilter</filter-name>
		<url-pattern>*.do</url-pattern>
	</filter-mapping>
	<listener>
		<listener-class>ins.framework.web.listener.WebAppListener</listener-class>
	</listener>
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	<listener>
		<listener-class>ins.platform.common.web.listener.StartupListener</listener-class>
	</listener>
	<!-- add by zhangdongdong 20160911 解决平台jar包问题 -->
	<listener>
    <listener-class>com.sinosoft.sysframework.web.control.OnlineUserListener</listener-class>
    </listener>
	<!-- add by zhangdongdong 20160911 解决平台jar包问题 -->
	<servlet>
		<servlet-name>springmvc</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet>
    <servlet-name>kaptcha</servlet-name>
    <servlet-class>
  		com.google.code.kaptcha.servlet.KaptchaServlet
  	</servlet-class>
  	<!-- 给验证码插件servlet类配置参数 -->
    <!-- 边框设置 yes  no -->
    <init-param>
      <param-name>kaptcha.border</param-name>
      <param-value>yes</param-value>
    </init-param>
    <!-- 边框颜色 颜色名称 例如:red blue black等 也可以是 RGB:105,179,90 -->
    <init-param>
      <param-name>kaptcha.border.color</param-name>
      <param-value>205,205,205</param-value>
    </init-param>
    <!-- 边框宽度 -->
    <init-param>
      <param-name>kaptcha.border.thickness</param-name>
      <param-value>1</param-value>
    </init-param>
    <!-- 产生验证码的字符源头 兼容中文的 -->
    <init-param>
      <param-name>kaptcha.textproducer.char.string</param-name>
      <param-value>ABCDEFGHJKMNPQRSTUVWXYZ0123456789</param-value>
    </init-param>
    <!-- 生成结果的字符个数 -->
    <init-param>
      <param-name>kaptcha.textproducer.char.length</param-name>
      <param-value>4</param-value>
    </init-param>
    <!-- 生成结果的字符字体 -->
    <init-param>
      <param-name>kaptcha.textproducer.font.names</param-name>
      <param-value>微软雅黑,宋体,楷体</param-value>
    </init-param>
    <!-- 生成结果的字符大小 -->
    <init-param>
      <param-name>kaptcha.textproducer.font.size</param-name>
      <param-value>30</param-value>
    </init-param>
    <!-- 生成结果的字符 颜色 -->
    <init-param>
      <param-name>kaptcha.textproducer.font.color</param-name>
      <param-value>135,155,6</param-value>
    </init-param>
    <!-- 生成结果的字符 字间距 -->
    <init-param>
      <param-name>kaptcha.textproducer.char.space</param-name>
      <param-value>6</param-value>
    </init-param>
    <!-- 干扰线 生成器 -->
    <init-param>
      <param-name>kaptcha.noise.impl</param-name>
      <param-value>com.google.code.kaptcha.impl.DefaultNoise</param-value>
    </init-param>
    <!-- 干扰线 颜色 -->
    <init-param>
      <param-name>kaptcha.noise.color</param-name>
      <param-value>179,203,7</param-value>
    </init-param>
    <!-- 干扰线 背景渐变颜色  从左侧向右渐变  -->
    <init-param>
      <param-name>kaptcha.background.clear.from</param-name>
      <param-value>white</param-value>
    </init-param>
    <!-- 干扰线 背景渐变颜色  从右侧向左渐变  -->
    <init-param>
      <param-name>kaptcha.background.clear.to</param-name>
      <param-value>white</param-value>
    </init-param>
    <!-- 验证码图片宽度 -->
    <init-param>
      <param-name>kaptcha.image.width</param-name>
      <param-value>200</param-value>
    </init-param>
    <!-- 验证码图片高度 -->
    <init-param>
      <param-name>kaptcha.image.height</param-name>
      <param-value>35</param-value>
    </init-param>
    <!-- 图片样式: 阴影 -->
    <!-- <init-param>
      <param-name>kaptcha.obscurificator.impl</param-name>
      <param-value>com.google.code.kaptcha.impl.ShadowGimpy</param-value>
    </init-param> -->
  </servlet>
  <!-- 配置文件初始化 -->
  <servlet>
    <servlet-name>ConfigInitServlet</servlet-name>
    <servlet-class>com.sinosig.n02.common.servlet.ConfigInitServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/config/appconfig/struts-config.xml</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>
  <!--上传 -->
  <servlet>
    <description></description>
    <display-name>YgbxUpload</display-name>
    <servlet-name>YgbxUpload</servlet-name>
    <servlet-class>com.sinosig.n02.n01service.motorcademanage.web.YgbxUpload</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>YgbxUpload</servlet-name>
    <url-pattern>/YgbxUpload</url-pattern>
  </servlet-mapping>
  <!-- 暂存定时删除异步任务-->
  <servlet>
    <description></description>
    <display-name>TempDelete</display-name>
    <servlet-name>TempDelete</servlet-name>
    <servlet-class>com.sinosig.n02.n01service.common.web.TempDelete</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>TempDelete</servlet-name>
    <url-pattern>/TempDelete</url-pattern>
  </servlet-mapping>
  <!-- 暂存定时删除异步任务-->
  <!-- 验证码请求名  映射 -->
  <!-- 江苏交管对接  -->
	<servlet>
    <description></description>
    <display-name>CreateImageServlet</display-name>
    <servlet-name>CreateImageServlet</servlet-name>
    <servlet-class>com.sinosig.n02.n01service.combineinput.web.CreateImageServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>CreateImageServlet</servlet-name>
    <url-pattern>/CreateImageServlet</url-pattern>
  </servlet-mapping>
  
  <servlet-mapping>
    <servlet-name>kaptcha</servlet-name>
    <url-pattern>/servlet/captchaCode</url-pattern>
  </servlet-mapping>
	<filter-mapping>
		<filter-name>sitemesh</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<servlet-mapping>
		<servlet-name>springmvc</servlet-name>
		<url-pattern>/rpc</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>springmvc</servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>
	<session-config>
		<session-timeout>60</session-timeout>
	</session-config>
<!-- 	<servlet> -->
<!--     <servlet-name>action</servlet-name> -->
<!--     <servlet-class>com.sinosoft.sysframework.web.control.ExtendedStrutsActionServlet</servlet-class> -->
<!--     <init-param> -->
<!--       <param-name>config</param-name> -->
<!--       <param-value>/WEB-INF/config/appconfig/struts-config.xml</param-value> -->
<!--     </init-param> -->
<!--      <load-on-startup>3</load-on-startup> -->
<!--     </servlet> -->
	
	
	
	
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
	</welcome-file-list>
	<error-page>
		<exception-type>java.lang.NullPointerException</exception-type>
		<location>/error.jsp</location>
	</error-page>
	<error-page>
		<error-code>500</error-code>
		<location>/500.jsp</location>
	</error-page>
	<error-page>
		<error-code>404</error-code>
		<location>/404.jsp</location>
	</error-page>
	<error-page>
		<error-code>403</error-code>
		<location>/403.jsp</location>
	</error-page>
	<error-page>
		<error-code>401</error-code>
		<location>/401.jsp</location>
	</error-page>
	<security-constraint>
		<web-resource-collection>
			<web-resource-name></web-resource-name>
			<url-pattern>/*</url-pattern>
			<http-method>PUT</http-method>
			<http-method>DELETE</http-method>
			<http-method>HEAD</http-method>
			<http-method>OPTIONS</http-method>
			<http-method>TRACE</http-method>
		</web-resource-collection>
		<auth-constraint />
	</security-constraint>
</web-app>



spring-mvc
<?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:p="http://www.springframework.org/schema/p"
	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.xsd  
           http://www.springframework.org/schema/mvc  
           http://www.springframework.org/schema/mvc/spring-mvc.xsd
           http://www.springframework.org/schema/context   
           http://www.springframework.org/schema/context/spring-context.xsd">
	<!-- 自动扫描且只扫描ins 包下的@Controller标注的类控制器类,可以配置多个 -->
	<!-- 此处只应该加载表现层组件,如果此处还加载dao层或service层的bean会将之前容器加载的替换掉,而且此处不会进行AOP织入,所以会造成AOP失效问题(如事务不起作用) -->
	<context:component-scan base-package="ins,com.sinosig"
		use-default-filters="false">
		<context:include-filter type="annotation"
			expression="org.springframework.stereotype.Controller" />
		<context:include-filter type="annotation"
			expression="org.springframework.web.bind.annotation.ControllerAdvice" />
		<context:exclude-filter type="regex"
			expression="com\.oracle.*" />
	</context:component-scan>

	<!-- 扫描要暴露为 JsonRpc服务的类 -->
	<bean class="ins.framework.rpc.scanner.RpcServerScanner">
		<property name="url" value="rpc/json" />
		<property name="basePackage" value="ins" />
		<property name="serviceExporterClass"
			value="ins.framework.rpc.implement.json.JsonServiceExporter" />
	</bean>

	<!-- 启动Spring MVC的注解功能,完成请求和注解POJO的映射 -->
	<mvc:annotation-driven conversion-service="conversionService">
		<mvc:message-converters register-defaults="false">
			<!-- fastjosn spring support 解决返回json乱码问题 -->
			<bean id="jsonConverter"
				class="ins.framework.utils.support.MappingFastJsonHttpMessageConverter">
				<property name="supportedMediaTypes" value="application/json" />
				<property name="serializerFeature">
					<list>
						<value>WriteMapNullValue</value>
						<value>QuoteFieldNames</value>
					</list>
				</property>
			</bean>
		</mvc:message-converters>
		<mvc:argument-resolvers>
			<bean
				class="ins.framework.web.bind.method.annotation.FormModelMethodArgumentResolver" />
		</mvc:argument-resolvers>
	</mvc:annotation-driven>
	<bean id="conversionService"
		class="org.springframework.context.support.ConversionServiceFactoryBean">
		<property name="converters">
			<list>
				<bean class="ins.framework.web.support.StringToDateConverter" />
			</list>
		</property>
	</bean>
	<!-- Spring MVC 自己处理静态资源,默认缓存1年(31536000) -->
	<!-- 版本号变更时 -->
	<mvc:resources mapping="/static/adminlte/**"
		location="/WEB-INF/view/common/static/adminlte/" cache-period="31536000" />
	<mvc:resources mapping="/static/bootbox/**"
		location="/WEB-INF/view/common/static/bootbox/" cache-period="31536000" />
	<mvc:resources mapping="/static/bootstrap-modal/**"
		location="/WEB-INF/view/common/static/bootstrap-modal/" cache-period="31536000" />
	<mvc:resources mapping="/static/bsadmin/**"
		location="/WEB-INF/view/common/static/bsadmin/" cache-period="31536000" />
	<mvc:resources mapping="/static/datatables-extension/**"
		location="/WEB-INF/view/common/static/datatables-extension/"
		cache-period="31536000" />
	<mvc:resources mapping="/static/datetimepicker/**"
		location="/WEB-INF/view/common/static/datetimepicker/" cache-period="31536000" />
	<mvc:resources mapping="/static/font-awesome/**"
		location="/WEB-INF/view/common/static/font-awesome/" cache-period="31536000" />
	<mvc:resources mapping="/static/html5shiv/**"
		location="/WEB-INF/view/common/static/html5shiv/" cache-period="31536000" />
	<mvc:resources mapping="/static/ionicons/**"
		location="/WEB-INF/view/common/static/ionicons/" cache-period="31536000" />
	<mvc:resources mapping="/static/jquery/**"
		location="/WEB-INF/view/common/static/jquery/" cache-period="31536000" />
	<mvc:resources mapping="/static/jquery-validation/**"
		location="/WEB-INF/view/common/static/jquery-validation/"
		cache-period="31536000" />
	<mvc:resources mapping="/static/qtip2/**"
		location="/WEB-INF/view/common/static/qtip2/" cache-period="31536000" />
	<mvc:resources mapping="/static/respond/**"
		location="/WEB-INF/view/common/static/respond/" cache-period="31536000" />
	<mvc:resources mapping="/static/select2/**"
		location="/WEB-INF/view/common/static/select2/" cache-period="31536000" />
	<mvc:resources mapping="/static/zTree/**"
		location="/WEB-INF/view/common/static/zTree/" cache-period="31536000" />
	<mvc:resources mapping="/static/echarts/**"
		location="/WEB-INF/view/common/static/echarts/" cache-period="31536000" />
	<!-- Spring MVC 自己处理系统JS资源,默认缓存10分钟(600) -->
	<mvc:resources mapping="/20160101/**/js/*.js" location="/WEB-INF/view/"
		cache-period="600" />
	<!-- <mvc:resources mapping="/**/js/*.js" location="/WEB-INF/view/" cache-period="600" 
		/> -->
	<mvc:default-servlet-handler />
	<bean id="messageSource"
		class="org.springframework.context.support.ResourceBundleMessageSource"
		p:basename="i18n/messages" />
	<!--WEB异常解析处理 <bean id="exceptionResolver" class="com.baobaotao.web.ForumHandlerExceptionResolver"> 
		<property name="defaultErrorView"> <value>fail</value> </property> <property 
		name="exceptionMappings"> <props> <prop key="java.lang.RuntimeException">fail</prop> 
		</props> </property> </bean> -->
	<mvc:view-controller path="/" view-name="forward:/index.jsp" />
	<!-- ========================= VIEW定义 ========================= -->
	<!-- bean name view resolver -->
	<bean class="org.springframework.web.servlet.view.BeanNameViewResolver"
		p:order="0" />
	<!-- 根据客户端的不同的请求决定不同的 view进行响应, 如 /blog/1.json /blog/1.xml -->
	<bean
		class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"
		p:order="1">
		<!-- 设置为true以忽略对Accept Header的支持 -->
		<property name="defaultContentType" value="text/html" />
		<!-- 扩展名至mimeType的映射,即 /user.json => application/json -->
		<property name="favorPathExtension" value="false" />
		<!-- 用于开启 /userinfo/123?format=json 的支持 -->
		<property name="favorParameter" value="false" />
		<property name="mediaTypes">  <!--favorPathExtension, favorParameter是true时才起作用 -->
			<map>
				<!-- <entry key="wml" value="text/vnd.wap.wml"/> -->
				<!-- <entry key="vnd" value="application/vnd.wap.xhtml+xml"/> -->
				<!-- <entry key="xhtml" value="application/xhtml+xml"/> -->
				<!-- <entry key="html" value="*" /> -->
				<entry key="html" value="text/html" />
				<entry key="json" value="application/json" />
			</map>
		</property>
		<property name="viewResolvers">
			<list>
				<bean
					class="org.springframework.web.servlet.view.InternalResourceViewResolver">
					<property name="viewClass"
						value="org.springframework.web.servlet.view.JstlView" />
					<property name="contentType" value="text/html" />
					<property name="prefix" value="/WEB-INF/view/" />
					<property name="suffix" value=".jsp" />
				</bean>
			</list>
		</property>
		<!-- 可配置Not Found url <property name="defaultViews"> <list> <bean class="org.springframework.web.servlet.view.JstlView" 
			p:url="/notfound"/> </list> </property> -->
	</bean>
	<!-- 默认的视图解析器 在上边的解析错误时使用 (默认使用html)- -->
	<bean id="defaultViewResolver"
		class="org.springframework.web.servlet.view.InternalResourceViewResolver"
		p:order="3">
		<property name="viewClass"
			value="org.springframework.web.servlet.view.JstlView" />
		<property name="contentType" value="text/html" />
		<property name="prefix" value="/WEB-INF/view/" />
		<property name="suffix" value=".jsp" />
	</bean>
	<!-- 文件上传相关 -->
	<bean id="multipartResolver"
		class="org.springframework.web.multipart.commons.CommonsMultipartResolver"
		p:defaultEncoding="utf-8">
		<!--one of the properties available;the maximum file size in bytes -->
		<property name="maxUploadSize" value="30000000" />
	</bean>
	<!-- 控制器异常处理 -->
	<bean id="exceptionResolver"
		class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
		<property name="exceptionMappings">
			<props>
				<prop key="java.lang.Exception"> error_all
				</prop>
			</props>
		</property>
	</bean>
	<!-- end -->


	<bean id="localeResolver"
		class="org.springframework.web.servlet.i18n.SessionLocaleResolver" />
	<mvc:interceptors>
		<!-- Changes the locale when a 'locale' request parameter is sent; e.g. 
			/?locale=de -->
		<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
	</mvc:interceptors>
	<bean
		class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
	<bean
		class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
</beans>

appcontexg
<?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:jee="http://www.springframework.org/schema/jee"
	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"
	default-autowire="byName" default-lazy-init="false">
	<!-- 打开aspectj织入 -->
	<!-- <context:load-time-weaver aspectj-weaving="off"/> -->
	<!-- 支持 @Transactional 标记 -->
	<!-- <tx:annotation-driven mode="aspectj" /> -->
	<tx:annotation-driven transaction-manager="transactionManager"
		proxy-target-class="true" />
	<!-- 启用类扫描机制,扫描ins包下的通过元数据标记为@Component、@Resource、@Service等的Bean并自动注入 -->
	<context:component-scan base-package="ins,com">
		<context:exclude-filter type="annotation"
			expression="org.springframework.stereotype.Controller" />
		<context:exclude-filter type="annotation"
			expression="org.springframework.web.bind.annotation.ControllerAdvice" />
		<context:exclude-filter type="regex"
			expression="com\.oracle.*" />
	</context:component-scan>
	<!-- 支持 @AspectJ 标记 -->
	<aop:aspectj-autoproxy></aop:aspectj-autoproxy>

	<!-- 启用类扫描机制,通过元数据配置Service,无元数据的在此配置 -->
	<!-- 自定义的bean在下面定义 -->
	<!-- Security -->
	<!-- 以下两个配置二选一,如果用单点登陆,使用applicationContext-cas,否则用applicationContext-security -->
	<!-- <import resource="components/applicationContext-security.xml" /> -->
	<!-- 安全认证使用Shiro实现 add by lujijiang -->
	<!-- 不带单点登录 -->
	<!-- <import resource="components/applicationContext-auth2.xml" /> -->
<!-- 	<import resource="components/applicationContext-shiro-nocas.xml" /> -->
	<!-- 单点登录 <import resource="components/applicationContext-shiro.xml" /> -->
	<!-- <import resource="components/applicationContext-cas.xml" /> -->
	<!-- Quartz <import resource="components/applicationContext-quartz.xml" 
		/> -->
	<!-- Mail -->
	<import resource="components/applicationContext-mail.xml" />
	<!-- Quartz -->
	<!-- <import resource="classpath:spring/components/applicationContext-quartz.xml" 
		/> -->
	<!-- log -->
	<import resource="classpath:spring/components/applicationContext-log.xml" />
<!-- 	<import resource="classpath:spring/components/applicationContext-aopsaa.xml" /> -->
	<import resource="classpath:spring/components/applicationContext-aoplog.xml" />
	<!-- rule <import resource="classpath:spring/components/applicationContext-rule.xml" 
		/> -->
	<bean id="springUtils" class="ins.platform.common.web.util.SpringUtils"></bean>
</beans>
posted on 2017-06-10 18:10  WesTward  阅读(335)  评论(0编辑  收藏  举报