use of com.alibaba.nacos.api.exception.runtime.NacosDeserializationException in project nacos by alibaba.
the class DistroIpPortTagGenerator method getResponsibleTag.
@Override
public String getResponsibleTag(ReuseHttpServletRequest request) {
String ip = request.getParameter(PARAMETER_IP);
String port = request.getParameter(PARAMETER_PORT);
if (StringUtils.isBlank(ip)) {
// some old version clients using beat parameter
String beatStr = request.getParameter(PARAMETER_BEAT);
if (StringUtils.isNotBlank(beatStr)) {
try {
RsInfo rsInfo = JacksonUtils.toObj(beatStr, RsInfo.class);
ip = rsInfo.getIp();
port = String.valueOf(rsInfo.getPort());
} catch (NacosDeserializationException ignored) {
}
}
}
if (StringUtils.isNotBlank(ip)) {
ip = ip.trim();
}
port = StringUtils.isBlank(port) ? "0" : port.trim();
return ip + InternetAddressUtil.IP_PORT_SPLITER + port;
}
Aggregations