code: protected void processRequest(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          response.setContentType("application/json;charset=UTF-8"); 
          response.setCharacterEncoding("UTF-8"); 
          request.setCharacterEncoding("UTF-8");
          
          String questionStr = request.getParameter("q");
          String n = request.getParameter("n");
          int topN = -1;
          if(n != null && StringUtils.isNumeric(n)){
              topN = Integer.parseInt(n);
          }
          Question question = null;
          List<CandidateAnswer> candidateAnswers = null;
          if (questionStr != null && questionStr.trim().length() > 3) {
              question = SharedQuestionAnsweringSystem.getInstance().answerQuestion(questionStr);
              if (question != null) {
                  candidateAnswers = question.getAllCandidateAnswer();
              }
          }
          LOG.info("问题："+questionStr); 
          try (PrintWriter out = response.getWriter()) {
              String json = JsonGenerator.generate(candidateAnswers, topN);
              out.println(json);
              LOG.info("答案："+json);
          }
      }
docs: Processes requests for both HTTP <code>GET</code> and <code>POST</code>
  methods.
  
  @param request servlet request
  @param response servlet response
  @throws ServletException if a servlet-specific error occurs
  @throws IOException if an I/O error occurs