package com.walker.tcp.handler;
|
|
import com.walker.tcp.Message;
|
import com.walker.tcp.Request;
|
|
/**
|
* 系统默认长连接处理对象。该对象被重构
|
* @author 时克英
|
* @date 2018-11-27
|
*
|
*/
|
@Deprecated
|
public class MyLongHandler extends MyMessageHandler {
|
|
public MyLongHandler(){
|
this.setEmptyMsgDisconnect(true);
|
}
|
|
@Override
|
protected Request<?> createRequest(Message msg) throws Exception {
|
throw new UnsupportedOperationException("该类型消息暂未实现。");
|
// if(this.getMapper() == null){
|
// throw new IllegalArgumentException(MSG_REQUEST_ERROR);
|
// }
|
// MessageProtocolResolver resolver = (MessageProtocolResolver)ConvertorUtils.getProtocolResolver(msg, getProtocolResolverList());
|
// if(resolver == null){
|
// throw new IllegalArgumentException("protocolResolver not found, msg : " + msg);
|
// }
|
//
|
// // 去掉报文中的分隔符,因为netty打开了显示分隔符
|
// String content = msg.getPayload().toString().substring(0, msg.length()-resolver.getDelimiter().length());
|
//
|
// String protocol = resolver.getProtocolNum(content, content.length());
|
// String clazz = this.getMapper().get(protocol);
|
// if(StringUtils.isEmpty(clazz)){
|
// throw new IllegalArgumentException("请求协议对应的request类不存在。protocol = " + protocol + ", msg = " + content);
|
// }
|
// try {
|
// Class<?> clazzRequest = ClassUtils.forName(clazz, this.getClass().getClassLoader());
|
// AbstractStringRequest request = (AbstractStringRequest)clazzRequest.newInstance();
|
// request.fromSource(content);
|
//// request.setProtocolResolver(resolver);
|
// request.setProtocolResolverId(resolver.getOrder());
|
// return request;
|
//
|
// } catch (ClassNotFoundException e) {
|
// logger.error("根据映射创建request对象错误:" + e.getMessage(), e);
|
// throw new Exception(e);
|
// }
|
}
|
|
}
|