/**
  * 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
  */
 protected void processRequest(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   response.setContentType("text/html;charset=UTF-8");
   try (PrintWriter out = response.getWriter()) {
     out.println("<html>");
     out.println("<head>");
     out.println("<title>Servlet TestServlet</title>");
     out.println("</head>");
     out.println("<body>");
     out.println("<h1>Servlet TestServlet at " + request.getContextPath() + "</h1>");
     out.println("About to start the job<br>");
     JobOperator jo = BatchRuntime.getJobOperator();
     out.println("Got the job operator: " + jo + "<br>");
     long jid = jo.start("myJob", new Properties());
     out.println("Job submitted: " + jid + "<br>");
     out.println(jo.getJobInstanceCount("myJob") + " job instance found<br/>");
     out.println("<br><br>Check server.log for output");
     out.println("</body>");
     out.println("</html>");
   } catch (JobStartException | JobSecurityException ex) {
     Logger.getLogger(TestServlet.class.getName()).log(Level.SEVERE, null, ex);
   }
 }