public static String getCurrentUri ( ) { HttpServletRequest request = ( ( ServletRequestAttributes ) RequestContextHolder . currentRequestAttributes ( ) ) . getRequest ( ) ; StringBuilder uri = new StringBuilder ( ) ; uri . append ( request . getAttribute ( "javax.servlet.forward.request_uri" ) ) ; if ( StringUtils . isNotBlank ( request . getQueryString ( ) ) ) { uri . append ( "?" ) . append ( request . getQueryString ( ) ) ; } return uri . toString ( ) ; }
Gets the uri which is currently visible in the browser .