minasping整合-创新互联
xml代码
成都创新互联专注于企业全网整合营销推广、网站重做改版、斗门网站定制设计、自适应品牌网站建设、HTML5、商城网站定制开发、集团公司官网建设、成都外贸网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为斗门等各大城市提供网站开发制作服务。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
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
当前标题:minasping整合-创新互联
浏览路径:http://abwzjs.com/article/cccoid.html