code: private String encodeUri( String uri )
  	{
  		StringBuilder newUri = new StringBuilder();
  		StringTokenizer st = new StringTokenizer( uri, "/ ", true );
  		while ( st.hasMoreTokens())
  		{
  			String tok = st.nextToken();
  			if ( tok.equals( "/" )) {
  				newUri.append('/');
  			} else if ( tok.equals( " " )) {
  				newUri.append("%20");
  			} else {
  				try {
  					newUri.append(URLEncoder.encode( tok, "UTF-8" ));
  				} catch ( UnsupportedEncodingException uee ) { // NOPMD - imported code
  					// imported code
  				}
  			}
  		}
  		return newUri.toString();
  	}
docs: URL-encodes everything between '/'-characters.
  Encodes spaces as '%20' instead of '+'.