public String sanitizePaths ( String baseUri , String resourcePath ) { if ( baseUri . endsWith ( "/" ) && resourcePath . startsWith ( "/" ) ) { return baseUri . substring ( 0 , baseUri . length ( ) - 1 ) + resourcePath ; } if ( ( ! baseUri . endsWith ( "/" ) ) && ( ! resourcePath . startsWith ( "/" ) ) ) { return baseUri + "/" + resourcePath ; } return baseUri + resourcePath ; }
Helper to remove duplicate slashes