From: <rb...@us...> - 2017-10-21 10:33:47
|
Revision: 14874 http://sourceforge.net/p/htmlunit/code/14874 Author: rbri Date: 2017-10-21 10:33:44 +0000 (Sat, 21 Oct 2017) Log Message: ----------- simplification Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLink.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/XmlSerializer.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLinkTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLink.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLink.java 2017-10-12 19:55:21 UTC (rev 14873) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLink.java 2017-10-21 10:33:44 UTC (rev 14874) @@ -39,6 +39,7 @@ * @author Ronald Brill */ public class HtmlLink extends HtmlElement { + // private static final Log LOG = LogFactory.getLog(HtmlLink.class); /** The HTML tag represented by this element. */ public static final String TAG_NAME = "link"; @@ -153,20 +154,6 @@ } /** - * <span style="color:red">POTENIAL PERFORMANCE KILLER - DOWNLOADS THE RESOURCE - USE AT YOUR OWN RISK.</span><br> - * If the linked content is not already downloaded it triggers a download. Then it stores the response - * for later use.<br> - * - * @param downloadIfNeeded indicates if a request should be performed this hasn't been done previously - * @return {@code null} if no download should be performed and when this wasn't already done; the response - * received when performing a request for the content referenced by this tag otherwise - * @throws IOException if an error occurs while downloading the content - */ - public WebResponse getWebResponse(final boolean downloadIfNeeded) throws IOException { - return getWebResponse(downloadIfNeeded, null); - } - - /** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br> * * If the linked content is not already downloaded it triggers a download. Then it stores the response Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/XmlSerializer.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/XmlSerializer.java 2017-10-12 19:55:21 UTC (rev 14873) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/XmlSerializer.java 2017-10-21 10:33:44 UTC (rev 14874) @@ -241,7 +241,7 @@ final String protocol = link.getWebRequest().getUrl().getProtocol(); if ("http".equals(protocol) || "https".equals(protocol)) { final File file = createFile(hrefAttr.getValue(), ".css"); - FileUtils.writeStringToFile(file, link.getWebResponse(true).getContentAsString(), ISO_8859_1); + FileUtils.writeStringToFile(file, link.getWebResponse(true, null).getContentAsString(), ISO_8859_1); hrefAttr.setValue(outputDir_.getName() + FILE_SEPARATOR + file.getName()); } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLinkTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLinkTest.java 2017-10-12 19:55:21 UTC (rev 14873) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLinkTest.java 2017-10-21 10:33:44 UTC (rev 14874) @@ -43,7 +43,7 @@ final HtmlPage page = loadPage(html); final HtmlLink link = page.getFirstByXPath("//link"); - final WebResponse respCss = link.getWebResponse(true); + final WebResponse respCss = link.getWebResponse(true, null); assertEquals(page.getUrl().toExternalForm(), respCss.getWebRequest().getAdditionalHeaders().get("Referer")); } } |