}
private void creatConnection(SocketManager socketManager,
HttpServletRequest request, HttpServletResponse response)
throws IOException {
SocketHandler service = getSocketHandler(request);
if (null == service) {
String uri = RequestUtils.getServletPath(request);
throw new DispatchException("Cant find comet handler by [" + uri
+ "]. Did you registered it?");
}
PushSocket socket = new PushSocket();
boolean accept = service.accept(socket, request);
PrintWriter write = response.getWriter();
String commend = null;
if (accept) {// 如果接受连接请求则创建连接
socketManager.creatConnection(socket);
commend = JsonProtocolUtils.getConnectionCommend(socket.getId());