code: public static String getFullUrl(HttpServletRequest request) {
  
          if (request.getQueryString() == null) {
              return request.getRequestURI();
          }
  
          return request.getRequestURI() + "?" + request.getQueryString();
      }
docs: Returns the full URL of the given request.
  
  @param request    an HTTP servlet request
  @return the full URL, including the query string