Commit 97e08c89 by WeiCong

增加对文件上传类型得限制

parent 1bf77695
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
<mvc:annotation-driven /> <mvc:annotation-driven>
<mvc:message-converters>
<ref bean="stringHttpMessageConverter"/>
<ref bean="mappingJackson2HttpMessageConverter"/>
</mvc:message-converters>
</mvc:annotation-driven>
<bean id="stringHttpMessageConverter"
class="org.springframework.http.converter.StringHttpMessageConverter"/>
<!--解决IE浏览器json文件下载和json数据中午乱码的问题-->
<bean id="mappingJackson2HttpMessageConverter"
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
</list>
</property>
</bean>
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="200000" />
<property name="maxInMemorySize" value="200000" />
</bean>
<bean id="nouiVersion" class="org.sss.presentation.noui.api.response.NoUiVersion">
<property name="version" value="202009091600" />
<property name="rootFilePath" value="" />
</bean>
<mvc:default-servlet-handler /> <mvc:default-servlet-handler />
<mvc:interceptors> <mvc:interceptors>
<mvc:interceptor> <mvc:interceptor>
<mvc:mapping path="/**/*" /> <mvc:mapping path="/**/*" />
<bean class="org.sss.presentation.noui.filter.Cors" /> <bean class="org.sss.presentation.noui.filter.Cors" />
</mvc:interceptor> </mvc:interceptor>
...@@ -24,30 +50,20 @@ ...@@ -24,30 +50,20 @@
<mvc:mapping path="/**" /> <mvc:mapping path="/**" />
<!--login 不需要拦截 --> <!--login 不需要拦截 -->
<mvc:exclude-mapping path="/login" /> <mvc:exclude-mapping path="/login" />
<mvc:exclude-mapping path="/getUserByDn" />
<mvc:exclude-mapping path="/login/**" /> <mvc:exclude-mapping path="/login/**" />
<mvc:exclude-mapping path="/fileBrowser/**" /> <!--<mvc:exclude-mapping path="/fileBrowser/**" />-->
<bean class="org.sss.presentation.noui.jwt.TokenInterceptor"></bean> <bean class="org.sss.presentation.noui.jwt.TokenInterceptor"></bean>
</mvc:interceptor> </mvc:interceptor>
<mvc:interceptor> <mvc:interceptor>
<!-- /**表示所有URL和子URL路径 --> <mvc:mapping path="/**" />
<mvc:mapping path="/**" /> <bean class="org.sss.presentation.noui.filter.FileTypeInterceptor">
<!-- 配置自定义的文件上传类型限制拦截器 --> <property name="type_list" value="bat,sh,js,sql,exe" />
<bean class="org.sss.presentation.noui.filter.FileTypeInterceptor"> </bean>
<property name="type_list" value="jpg,gif,png,ico,bmp,jpeg" /> </mvc:interceptor>
</bean>
</mvc:interceptor>
</mvc:interceptors> </mvc:interceptors>
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="200000" />
<property name="maxInMemorySize" value="200000" />
</bean>
<bean id="noUiVersion" class="org.sss.presentation.noui.api.response.NoUiVersion">
<property name="version" value="202009091600" />
<property name="rootFilePath" value="f:/" />
</bean>
<!-- 配置自动扫描的包 --> <!-- 配置自动扫描的包 -->
<context:component-scan base-package="org.sss.presentation.noui.controller"></context:component-scan> <context:component-scan base-package="org.sss.presentation.noui.controller"></context:component-scan>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment