Spring MVC整合MINA配置

1 篇文章 0 订阅
Spring MVC整合MINA配置
<?xml version="1.0" encoding="UTF-8"?>
<beans
 xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
 xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
 xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
 xmlns:util="http://www.springframework.org/schema/util"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
 
 <context:property-placeholder location="classpath*:mina.properties" ignore-unresolvable="true"/>
   
 <!--mina server-->
 <bean id="serverHandler" class="com.yuchengtech.vtfileweb.socket.ServerHandler">
 </bean>
 
 <!--executorFilter 多线程处理-->
 <bean id="executorFilter" class="org.apache.mina.filter.executor.ExecutorFilter">
  <constructor-arg index="0" value="${mina.initPoolSize}" />
  <constructor-arg index="1" value="${mina.maximumPoolSize}"/>
 </bean>
 
 <bean id="mdcInjectionFilter" class="org.apache.mina.filter.logging.MdcInjectionFilter">
  <constructor-arg value="remoteAddress"/>
 </bean>
 
 <bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
  <constructor-arg>
   <bean class="com.yuchengtech.vtfileweb.socket.ServerCodeFactory"/>
  </constructor-arg>
 </bean>
 
 <bean id="loggingFilter" class="org.apache.mina.filter.logging.LoggingFilter"/>
 
 <bean id="filterChainBuilder" class="org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder"> 
  <property name="filters">
   <map>
    <entry key="executor" value-ref="executorFilter"/>
    <entry key="mdcInjectionFilter" value-ref="mdcInjectionFilter"/>
    <entry key="codecFilter" value-ref="codecFilter"/>
    <entry key="loggingFilter" value-ref="loggingFilter"/>
   </map>
  </property>
 </bean>
 
 <!-- session config -->
    <bean id="sessionConfig" factory-bean="ioAcceptor"
        factory-method="getSessionConfig" >
        <property name="bothIdleTime" value="10"/>
        <property name="receiveBufferSize" value="1024"/>
        <property name="sendBufferSize" value="1024"/>
    </bean>
 
 <bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
  <property name="customEditors">
   <map>
    <entry key="java.net.SocketAddress">
     <bean class="org.apache.mina.integration.beans.InetSocketAddressEditor"/>
    </entry>
   </map> decorator
  </property>
 </bean>
 
 <bean id="ioAcceptor" class="org.apache.mina.transport.socket.nio.NioSocketAcceptor" init-method="bind" destroy-method="unbind">
  <property name="defaultLocalAddress" value="${mina.port}"/>
  <property name="handler" ref="serverHandler"/>
  <property name="filterChainBuilder" ref="filterChainBuilder"/>
  <property name="reuseAddress" value="true"/>
<!-- <property name="backlog" value="100"/> -->
 </bean>
</beans>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值