MCPcopy Index your code
hub / github.com/HtmlUnit/htmlunit / setRefererHeader

Method setRefererHeader

src/main/java/org/htmlunit/WebRequest.java:549–560  ·  view source on GitHub ↗

Sets the referer HTTP header - only if the provided url is valid. @param url the url for the referer HTTP header

(final URL url)

Source from the content-addressed store, hash-verified

547 * @param url the url for the referer HTTP header
548 */
549 public void setRefererHeader(final URL url) {
550 if (url == null || !url.getProtocol().startsWith("http")) {
551 return;
552 }
553
554 try {
555 setAdditionalHeader(HttpHeader.REFERER, UrlUtils.getUrlWithoutRef(url).toExternalForm());
556 }
557 catch (final MalformedURLException ignored) {
558 // bad luck us the whole url from the pager
559 }
560 }
561
562 /**
563 * Sets the specified name/value pair in the additional HTTP headers.

Callers 14

WebRequestMethod · 0.95
openWindowMethod · 0.95
openDialogWindowMethod · 0.95
reloadMethod · 0.95
setHrefMethod · 0.95
setUrlMethod · 0.95
openMethod · 0.95
doClickStateUpdateMethod · 0.95
getWebRequestMethod · 0.95
getWebRequestMethod · 0.95
loadJavaScriptFromUrlMethod · 0.95
downloadImageIfNeededMethod · 0.95

Calls 4

setAdditionalHeaderMethod · 0.95
getUrlWithoutRefMethod · 0.95
startsWithMethod · 0.45
getProtocolMethod · 0.45

Tested by

no test coverage detected