List of usage examples for java.net URL getAuthority
public String getAuthority()
From source file:org.artifactory.repo.service.RepositoryServiceImpl.java
private String adjustRefererValue(Map<String, String> headersMap, String headerVal) { //Append the artifactory uagent to the referer if (headerVal == null) { //Fallback to host headerVal = headersMap.get("HOST"); if (headerVal == null) { //Fallback to unknown headerVal = "UNKNOWN"; }//www . j av a 2 s . co m } if (!headerVal.startsWith("http")) { headerVal = "http://" + headerVal; } try { URL uri = new URL(headerVal); //Only use the uri up to the path part headerVal = uri.getProtocol() + "://" + uri.getAuthority(); } catch (MalformedURLException e) { //Nothing } headerVal += "/" + HttpUtils.getArtifactoryUserAgent(); return headerVal; }