public static String getPathInfoFromLocation ( final HttpServletRequest request , final String location ) { if ( StringUtils . isEmpty ( location ) ) { throw new IllegalArgumentException ( "Location cannot be empty string!" ) ; } final String contextPath = request . getContextPath ( ) ; if ( contextPath != null ) { if ( startsWithIgnoreCase ( location , contextPath ) ) { return location . substring ( contextPath . length ( ) ) ; } else { return location ; } } final String noSlash = location . substring ( 1 ) ; final int nextSlash = noSlash . indexOf ( ' ' ) ; if ( nextSlash == - 1 ) { return "" ; } return noSlash . substring ( nextSlash ) ; }
Retrieve pathInfo from a given location .