public Response service(Client sockector, HashMap<String, String> requestData){
if(requestData == null){
return null;
}
log.info(requestData.get(Constants.FILED_MSG));
Response responseMessage = null;
try{
if(!MyStringUtil.isBlank(requestData.get(Constants.HANDSHAKE))){
responseMessage = Response.msgOnlyBody(requestData.get(Constants.FILED_MSG));
}else{
responseMessage = Response.msgOnlyBody("Hello," + requestData.get(Constants.FILED_MSG));
}
}catch(Exception e){
e.printStackTrace();
responseMessage = Response.msgOnlyBody("500处理失败了");
}
return responseMessage;
}
请问,在Service中我如何广播消息。我尝试过这样
Response responseMessage = null;
if(!MyStringUtil.isBlank(requestData.get(Constants.HANDSHAKE))){
responseMessage = Response.msgOnlyBody(requestData.get(Constants.FILED_MSG));
}else{
responseMessage = Response.msgOnlyBody("Hello," + requestData.get(Constants.FILED_MSG));
}
MasterServer.addBroadMessage(responseMessage);
但是会报如下错误信息
java.lang.NullPointerException
at com.jason.server.Response.msgRespose(Response.java:120)
麻烦您时间方便请指点一下该怎样实现。