/** * Find and return the parent directory of the URL argument * @param url to find the parent directory of * @return parent directory of URL, or null, if either the url argument is * invalid, or if the url is the root of the authority. */ public static String getUrlParentDir(String url) { try { UsableURI uri = UsableURIFactory.getInstance(url); String path = uri.getPath(); if(path.length() > 1) { int startIdx = path.length()-1; if(path.charAt(path.length()-1) == '/') { startIdx--; } int idx = path.lastIndexOf('/',startIdx); if(idx >= 0) { uri.setPath(path.substring(0,idx+1)); uri.setQuery(null); return uri.toUnicodeHostString(); } } } catch (URIException e) { LOGGER.warning(e.getLocalizedMessage() + ": " + url); } return null; }
/** * Find and return the parent directory of the URL argument * @param url to find the parent directory of * @return parent directory of URL, or null, if either the url argument is * invalid, or if the url is the root of the authority. */ public static String getUrlParentDir(String url) { try { UsableURI uri = UsableURIFactory.getInstance(url); String path = uri.getPath(); if(path.length() > 1) { int startIdx = path.length()-1; if(path.charAt(path.length()-1) == '/') { startIdx--; } int idx = path.lastIndexOf('/',startIdx); if(idx >= 0) { uri.setPath(path.substring(0,idx+1)); uri.setQuery(null); return uri.toUnicodeHostString(); } } } catch (URIException e) { LOGGER.warning(e.getLocalizedMessage() + ": " + url); } return null; }
host = refuri.getHost(); authority = refuri.getAuthority(); path = refuri.getPath(); } catch (URIException ex) { LOGGER.info("Ignoring unparsable Referer: " + referer);
host = refuri.getHost(); authority = refuri.getAuthority(); path = refuri.getPath(); } catch (URIException ex) { LOGGER.info("Ignoring unparsable Referer: " + referer);
tmpURI.setPath(tmpURI.getPath());
UsableURI url = UsableURIFactory.getInstance(fullUrl); solr.setField(SolrFields.SOLR_URL_PATH, url.getPath()); if (url.getPath().equals("/") || url.getPath().equals("") || url.getPath().matches("/index\\.[a-z]+$")) { solr.setField(SolrFields.SOLR_URL_TYPE, SolrFields.SOLR_URL_TYPE_SLASHPAGE); } else if (url.getPath().equalsIgnoreCase("/robots.txt")) { solr.setField(SolrFields.SOLR_URL_TYPE, SolrFields.SOLR_URL_TYPE_ROBOTS_TXT);
UsableURI url = UsableURIFactory.getInstance(fullUrl); solr.setField(SolrFields.SOLR_URL_PATH, url.getPath()); if (url.getPath().equals("/") || url.getPath().equals("") || url.getPath().matches("/index\\.[a-z]+$")) { solr.setField(SolrFields.SOLR_URL_TYPE, SolrFields.SOLR_URL_TYPE_SLASHPAGE); } else if (url.getPath().equalsIgnoreCase("/robots.txt")) { solr.setField(SolrFields.SOLR_URL_TYPE, SolrFields.SOLR_URL_TYPE_ROBOTS_TXT);
tmpURI.setPath(tmpURI.getPath());