Commit 725d39d6 by TongZuu

modify response data to array [requestid , ResponseWebsocket]

parent d2e9ce34
......@@ -12,3 +12,4 @@
/CommandFactory$CMDSpecialBuilder.class
/CMDModeFactory.class
/ThreadsPoolsFactory$1.class
/HandlePackageFactory.class
package com.csc.library.factory;
import javax.websocket.Session;
import com.csc.library.properties.HandleMessageData;
import com.csc.library.properties.HandlePackage;
public class HandlePackageFactory {
private static HandlePackageFactory instance = null;
private HandlePackage handle = null;
private HandlePackageFactory(){
handle = new HandleMessageData();
}
public static HandlePackageFactory getInstance(){
if(instance == null){
instance = new HandlePackageFactory();
}
return instance;
}
public HandlePackage getHandlePackage(){
return handle;
}
}
......@@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map;
import com.csc.library.properties.CscSession;
import com.csc.library.properties.HandlePackage;
import com.csc.library.properties.ResponsePools;
import com.csc.library.request.CommandState;
import com.csc.library.request.RequestWebsocket;
......@@ -21,6 +22,7 @@ public class ResponseFactory {
//private Map<CscSession,List<ResponseWebsocket>> response = new HashMap<CscSession ,List<ResponseWebsocket>>();
private ResponsePools<ResponsePropertiesImpl> response;
private PropertiesFactory propInstance;
private HandlePackage handle;
private ResponseFactory(){
}
......@@ -30,6 +32,7 @@ public class ResponseFactory {
instance = new ResponseFactory();
instance.propInstance = PropertiesFactory.getInstance();
instance.response = ResponsePools.getInstance();
instance.handle = HandlePackageFactory.getInstance().getHandlePackage();
}
return instance;
}
......@@ -67,7 +70,7 @@ public class ResponseFactory {
}
protected void sendResponse(CscSession session , ResponseWebsocket res){
session.sendMessage(propInstance.toJson(res));
PackageDataFactory.getInstance().sendData(session, this.handle, res);
res.clear();
this.response.push((ResponsePropertiesImpl)res);
}
......
......@@ -33,7 +33,7 @@ public class HandleMessageData implements HandlePackage<CscSession>{
@Override
public void send(CscSession session, String jsonSting) {
session.sendMessage(jsonSting);
}
}
......@@ -4,6 +4,7 @@ import java.io.IOException;
import javax.websocket.Session;
import com.csc.library.factory.PackageDataFactory;
import com.csc.library.response.ResponseWebsocket;
import com.csc.library.utilities.UProfile;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment