code: public static boolean streamNotConsumed( HttpServletRequest request ) {
          try {
              ServletInputStream servletInputStream = request.getInputStream();
              //in servlet >= 3.0, available will throw an exception (while previously it didn't)
              return request.getContentLength() != 0 && servletInputStream.available() > 0;
          } catch (IOException e) {
              return false;
          }
      }
docs: Checks if the input stream of the given request is nor isn't consumed. This method is backwards-compatible with Servlet 2.x,
  as in Servlet 3.x there is a "isFinished" method.
  
  @param request a {@code HttpServletRequest}, never {@code null}
  @return {@code true} if the request stream has been consumed, {@code false} otherwise.