code: public static String getRequestURI(ExternalContext ec)
      {
          if (!isPortlet(ec))
          {
              return ((HttpServletRequest) ec.getRequest()).getRequestURI();
          }
          else
          {
              return null;
          }
      }
docs: Returns the requestURI of the HttpServletRequest or <code>null</code> for
  portlet requests
  
  @param ec the current external context
  @return A string containing the current request uri