@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		String act = request.getParameter("act");
		String message = null;
		if (act == null) {
			act = "";
		} else {
			act = act.trim();
		}
		TimeLogger tl = new TimeLogger();
		try {
			if (act.equals("insert")) {
				int entries = Integer.parseInt(request.getParameter("num"));
				boneService.addDummyBones(entries);
				message = String.format("Inserting %d entries in H2 takes time: %d.", entries, tl.getTimeDiff());
			} else if (act.equals("count")) {
				message = boneService.getTotalNumberOfBones() + "";
			} else if (act.equals("queryAll")) {
				List<Bone> bones = boneService.getAllBones();
				message = JSONArray.fromObject(bones).toString();
			} else if (act.equals("init")) {
				int i = boneService.createBoneTable();
				message = "Create table returns " + i;
			} else if (act.equals("clear")) {
				int i = boneService.clearBones(null);
				message = "Clear bones returns " + i;
			} else if (act.equalsIgnoreCase("rejectedLog")) {
				message = testRejectedLog();
			} else {
				message = "Unknown action" + act + ", accepts: init, count, insert, queryAll, clear. \nExamples:\n" + "http://localhost:8080/BoneSpringBatis/InfoDbTest"
						+ "http://localhost:8080/BoneSpringBatis/InfoDbTest?act=insert&num=10" + "http://localhost:8080/BoneSpringBatis/InfoDbTest?act=query";
			}
		} catch (Exception e) {
			message = "An error occurred, did you forget to init your tables?";
			logger.error(e);
		}
		PrintWriter writer = response.getWriter();
		JSONObject jobj = JSONObject.fromObject(new Result(message));
		writer.append(jobj.toString());
		writer.close();
		new XmlWebApplicationContext().close();
	}