@Override
	protected void performTask(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		try {
			// try {
			// 	Thread.sleep(1000);
			// } catch (InterruptedException e) {
			// 	e.printStackTrace();
			// }
			String action = request.getParameter("action");
			System.out.println(action);
			String json = null;
			if ("getList".equals(action)) {
				List<Message> messages = DaoFactory.getFactory().getIMessageDao().findAll();
				Gson gson = new Gson();
				json = gson.toJson(messages);
			}
			// System.out.println(json);
			// Type listMessageType = new TypeToken<List<Message>>() { }
			// .getType();
			// List<Message> listFromJson = gson.fromJson(json,
			// listMessageType);
			// response.setCharacterEncoding("UTF-8");
			response.setContentType("application/x-json");
			response.getWriter().write(json);
			System.out.println(json);
		} catch (DaoException e) {
			LOG.error(e);
		}
	}