@Override public void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException { try { // printAllParameters(httpServletRequest); if (doPing(httpServletRequest, httpServletResponse)) return; doIt(httpServletRequest, httpServletResponse); } catch (Throwable t) { t.printStackTrace(); handleException(t, httpServletRequest, httpServletResponse); } }
@Override public void doPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException { try { // printAllParameters(httpServletRequest); if (doPing(httpServletRequest, httpServletResponse)) return; /* To read the request body for processing use something like this. // Read from request StringBuilder buffer = new StringBuilder(); BufferedReader reader = httpServletRequest.getReader(); String line; while ((line = reader.readLine()) != null) { buffer.append(line); } String data = buffer.toString() */ doIt(httpServletRequest, httpServletResponse); } catch (Throwable t) { handleException(t, httpServletRequest, httpServletResponse); } }