code: public static String parseUrl(String urlStr, String partToExtract) {
  		URL url;
  		try {
  			url = URL_CACHE.get(urlStr);
  		} catch (Exception e) {
  			LOG.error("Parse URL error: " + urlStr, e);
  			return null;
  		}
  		if ("HOST".equals(partToExtract)) {
  			return url.getHost();
  		}
  		if ("PATH".equals(partToExtract)) {
  			return url.getPath();
  		}
  		if ("QUERY".equals(partToExtract)) {
  			return url.getQuery();
  		}
  		if ("REF".equals(partToExtract)) {
  			return url.getRef();
  		}
  		if ("PROTOCOL".equals(partToExtract)) {
  			return url.getProtocol();
  		}
  		if ("FILE".equals(partToExtract)) {
  			return url.getFile();
  		}
  		if ("AUTHORITY".equals(partToExtract)) {
  			return url.getAuthority();
  		}
  		if ("USERINFO".equals(partToExtract)) {
  			return url.getUserInfo();
  		}
  
  		return null;
  	}
docs: Parse url and return various components of the URL.
  If accept any null arguments, return null.
  
  @param urlStr        URL string.
  @param partToExtract determines which components would return.
  accept values:
  HOST,PATH,QUERY,REF,
  PROTOCOL,FILE,AUTHORITY,USERINFO
  @return target value.