minasping整合
xml代码
创新互联公司专注于中大型企业的成都做网站、成都网站设计、成都外贸网站建设和网站改版、网站营销服务,追求商业策划与数据分析、创意艺术与技术开发的融合,累计客户超过千家,服务满意度达97%。帮助广大客户顺利对接上互联网浪潮,准确优选出符合自己需要的互联网运用,我们将一直专注品牌网站设计和互联网程序开发,在前进的路上,与客户一起成长!
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
"
>
public class TimeServerHandler extends IoHandlerAdapter
{
public TimeServerHandler() {
super();
}
@Override
public void sessionCreated(IoSession session) throws Exception {
super.sessionCreated(session);
System.err.println("session is created !");
}
@Override
public void sessionOpened(IoSession session) throws Exception {
super.sessionOpened(session);
System.err.println("session is open !");
}
@Override
public void sessionClosed(IoSession session) throws Exception {
super.sessionClosed(session);
System.err.println("session is closed !");
}
@Override
public void sessionIdle(IoSession session, IdleStatus status) throws Exception {
super.sessionIdle(session, status);
System.err.println("IDLE:" +status.toString() +";count:"+ session.getIdleCount( status ));
}
@Override
public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
super.exceptionCaught(session, cause);
}
@Override
public void messageReceived(IoSession session, Object message) throws Exception {
// super.messageReceived(session, message);
String str = message.toString();
System.err.println("receive message:"+str);
if( str.trim().equalsIgnoreCase("quit") ) {
session.closeOnFlush();
return;
}
Date date = new Date();
session.write(date.toString());
System.out.println("Message written...");
}
@Override
public void messageSent(IoSession session, Object message) throws Exception {
System.err.println("ready send message!"+message.toString());
super.messageSent(session, message);
}
@Override
public void inputClosed(IoSession session) throws Exception {
super.inputClosed(session);
}
}
public class Test {
public static void main(String[] args)
{
new ClassPathXmlApplicationContext("spring-config.xml");
}
}
参考文档:
http://www.tuicool.com/articles/JRzmqi
http://mina.apache.org/mina-project/userguide/ch27-spring-integration/ch27-spring-integration.html
名称栏目:minasping整合
网页URL:http://cdiso.cn/article/gecpgj.html