code: public static String getUriFromRequest(HttpServletRequest request) {
          Object includeUri = request.getAttribute("javax.servlet.include.request_uri");
          return includeUri == null ? request.getRequestURI() : (String)includeUri;
      }
docs: Retrieves the URI from the request from either the include attribute or the request.getRequestURI() method.
  
  @param request The HttpServletRequest instance
  @return The String URI