code: public static String getRealHttpMethod(ServletRequest req) {
      HttpServletRequest httpRequest = (HttpServletRequest) req;
      String method = (String) httpRequest.getAttribute(HTTP_METHOD_OVERRIDE_ATTRIBUTE);
      if (method != null) {
        return method;
      }
      return httpRequest.getMethod();
    }
docs: Get the "real" HTTP method for the request, taking into account the X-HTTP-Method-Override
  header.
  
  @param req a {@code ServletRequest}
  @return the HTTP method for the request