配置修改

This commit is contained in:
谢洪龙 2017-07-07 18:05:16 +08:00
parent 2a27fc43e2
commit 3a98417ddf
6 changed files with 125 additions and 34 deletions

View File

@ -6,6 +6,12 @@ The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout. therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether. Without this configuration present, some functionality in the IDE may be limited or fail altogether.
--> -->
<spring-data xmlns="http://www.netbeans.org/ns/spring-data/1">
<config-files>
<config-file>src/main/resources/minaConfig.xml</config-file>
</config-files>
<config-file-groups/>
</spring-data>
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!-- <!--
Properties that influence various parts of the IDE, especially code formatting and the like. Properties that influence various parts of the IDE, especially code formatting and the like.
@ -13,13 +19,7 @@ You can copy and paste the single properties, into the pom.xml file and the IDE
That way multiple projects can share the same settings (useful for formatting rules for example). That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project. Any value defined here will override the pom.xml file value but is only applicable to the current project.
--> -->
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.6-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion> <org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.7-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>Tomcat</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server> <org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>Tomcat</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
</properties> </properties>
<spring-data xmlns="http://www.netbeans.org/ns/spring-data/1">
<config-files>
<config-file>src/main/resources/minaConfig.xml</config-file>
</config-files>
<config-file-groups/>
</spring-data>
</project-shared-configuration> </project-shared-configuration>

View File

@ -5,10 +5,25 @@
*/ */
package com.ifish.config; package com.ifish.config;
import com.sun.xml.ws.transport.http.servlet.WSServletContextListener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
/** /**
* *
* @author Administrator * @author Administrator
*/ */
public class MyWSServletContextListener { public class MyWSServletContextListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent sce) {
WSServletContextListener wsscl = new WSServletContextListener();
wsscl.contextInitialized(sce);
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
} }

View File

@ -1,28 +1,80 @@
<?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:jee="http://www.springframework.org/schema/jee"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xmlns:c="http://www.springframework.org/schema/c" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
xmlns:context="http://www.springframework.org/schema/context" http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
xmlns:flow="http://www.springframework.org/schema/webflow-config" http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
xmlns:jee="http://www.springframework.org/schema/jee" http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
xmlns:jms="http://www.springframework.org/schema/jms"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:p="http://www.springframework.org/schema/p"
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-4.3.xsd <!-- webService -->
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd <bean id="serviceBean" class="com.ifish.socket.webService.ServiceBean"></bean>
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd <!-- 消息处理类 -->
http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd <bean id="someServer" class="com.ifish.socket.config.SomeServer"></bean>
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.3.xsd <!-- 实现job中注入bean -->
http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-4.3.xsd <!--<bean name="jobFactory" class="com.ifish.socket.config.JobFactory"/>-->
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-4.3.xsd <!-- 调度任务 -->
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd <!--<bean id="scheduleJob" init-method="init" destroy-method="shutdown" class="com.ifish.socket.config.ScheduleJob"></bean>-->
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.3.xsd <!-- 自定义的serverHandler -->
"> <bean id="serverHandler" class="com.ifish.socket.config.MinaServerHandler"></bean>
<!-- 导入外部的properties文件-->
<context:property-placeholder location="classpath*:property.properties" ignore-unresolvable="true"/>
<!-- 指定服务端地址和端口 -->
<bean id="address" class="com.ifish.socket.config.MyInetSocketAddress">
<constructor-arg index="0">
<value>${ifiship}</value>
</constructor-arg>
<constructor-arg index="1">
<value>${ifishport}</value>
</constructor-arg>
</bean>
<!-- 黑名单filter
<bean id="minaBlacklistFilter" class="com.ifish.socketNew.filter.MinaBlacklistFilter" init-method="init"></bean> -->
<!-- 编码filter -->
<bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
<constructor-arg>
<!-- 自定义的字符编码类 -->
<bean class="com.ifish.socket.codeFactory.ServerCodecFactory"></bean>
</constructor-arg>
</bean>
<!-- 日志filter -->
<bean id="loggingFilter" class="org.apache.mina.filter.logging.LoggingFilter"></bean>
<!-- <bean id="noopFilter" class="org.apache.mina.filter.util.NoopFilter"></bean> -->
<!-- 连接控制过滤器对同一IP地址频繁的创建连接的时间间隔进行控制 -->
<!-- <bean id="connectionThrottleFilter" class="org.apache.mina.filter.firewall.ConnectionThrottleFilter"></bean> -->
<!-- 过滤器链 -->
<bean id="filterChainBuilder" class="org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder">
<property name="filters">
<map>
<!-- <entry key="minaBlacklistFilter" value-ref="minaBlacklistFilter" /> -->
<entry key="codecFilter" value-ref="codecFilter" />
<!-- <entry key="loggingFilter" value-ref="loggingFilter" /> -->
</map>
</property>
</bean>
<!-- SessionConfig 通过工厂方法注入 -->
<bean id="sessionConfig" factory-bean="ioAcceptor" factory-method="getSessionConfig">
<property name="bothIdleTime" value="60" />
<property name="minReadBufferSize" value="512" />
<property name="maxReadBufferSize" value="1024" />
</bean>
<!-- 开始运行socket服务 -->
<bean id="ioAcceptor" class="org.apache.mina.transport.socket.nio.NioSocketAcceptor"
init-method="bind" destroy-method="unbind">
<property name="defaultLocalAddress" value="#{address.socketAddress}" />
<property name="handler" ref="serverHandler" />
<property name="filterChainBuilder" ref="filterChainBuilder" />
<property name="reuseAddress" value="true" />
</bean>
</beans> </beans>

View File

@ -41,4 +41,4 @@ ifiship=192.168.199.129
#\u6b63\u5f0f\u4e91 #\u6b63\u5f0f\u4e91
#ifiship=120.55.190.56 #ifiship=120.55.190.56
#\u670d\u52a1\u5668\u7aef\u53e3 #\u670d\u52a1\u5668\u7aef\u53e3
ifishport=9956 ifishport=9955

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<endpoints version="2.0" xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime">
<endpoint implementation="com.ifish.socket.webService.MyService" name="MyServiceService" url-pattern="/MyServiceService"/>
</endpoints>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<servlet>
<servlet-name>MyServiceService</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MyServiceService</servlet-name>
<url-pattern>/MyServiceService</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>