out.close();
return new RequestFileAttachment(temp, false, (AbstractHttpRequest<?>) request);
}
private byte[] downloadResource(HtmlPage page, HtmlElement htmlElement, URL url) throws IOException {
WebRequestSettings wrs = null;
wrs = new WebRequestSettings(url);
wrs.setAdditionalHeader("Referer", page.getWebResponse().getRequestSettings().getUrl().toString());
client.addRequestHeader("Accept", acceptTypes.get(htmlElement.getTagName().toLowerCase()));
return client.getPage(wrs).getWebResponse().getContentAsBytes();
}