public void processRequest(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		//PrintWriter out = response.getWriter();
		String event = request.getParameter(Protocol.MSG_EVENT.toString());
		if(event == null){
			logger.warn("im,接收到错误的请求,无event 参数");
			response.sendError(HttpServletResponse.SC_BAD_REQUEST, "No event specified");
			return;
		}
		
		String sid = request.getParameter(Protocol.MSG_SID.toString());
		
		Session session = null;
		
		//新的用户,创建新的Session,并添加到SessionManager
		if(event.equals(Protocol.EVENT_JOIN.toString())){
			
			//创建Session
			session = Session.create();
			//设置IP
			session.setAddress(request.getRemoteAddr());
			
		}else {
			
			if (sid == null ) {
				logger.warn("im,接收到错误的请求,缺少 sid 参数");
				response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Join No sid specified");
				return;
			}
			
			session = SessionManager.getInstance().getSession(sid);
			
			if(session == null){
				logger.warn("im,Session不存在或者已经失效  id:"+sid);
				response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Invalid or expired id:"+sid);
				return;
			}
		}
		
		//更新request,reponse
		session.setSession(request, response);
		
		session.getController().doRequest();
	}