private static String cleanUri(final String uri){
  String result=uri.trim();
  if (!StringUtils.isEmpty(uri)) {
    final int endIndex=result.length() - 1;
    if (result.lastIndexOf('/') == endIndex) {
      result=result.substring(0,endIndex);
    }
  }
  return result;
}

private static String cleanUri ( final String uri ) { String result = uri . trim ( ) ; if ( ! StringUtils . isEmpty ( uri ) ) { final int endIndex = result . length ( ) - 1 ; if ( result . lastIndexOf ( '/' ) == endIndex ) { result = result . substring ( 0 , endIndex ) ; } } return result ; }
perform a cleaning of the uri by trimming it and removing last ' / ' character if exists .
