/** * {@inheritDoc} */ @Override public Iterator<URL> getEmbeddedResourceURLs(String userAgent, byte[] html, URL baseUrl, URLCollection urls, String encoding) throws HTMLParseException { Document dom; try { dom = (Document) getDOM(html, encoding); } catch (SAXException se) { throw new HTMLParseException(se); } // Now parse the DOM tree scanNodes(dom, urls, baseUrl); return urls.iterator(); }
@Override public Iterator<URL> getEmbeddedResourceURLs(String userAgent, byte[] html, URL baseUrl, URLCollection coll, String encoding) throws HTMLParseException { try { // TODO Handle conditional comments for IE String contents = new String(html,encoding); Document doc = Jsoup.parse(contents); JMeterNodeVisitor nodeVisitor = new JMeterNodeVisitor(new URLPointer(baseUrl), coll); new NodeTraversor(nodeVisitor).traverse(doc); return coll.iterator(); } catch (Exception e) { throw new HTMLParseException(e); } } }
@Override public Iterator<URL> getEmbeddedResourceURLs(String userAgent, byte[] html, URL baseUrl, URLCollection coll, String encoding) throws HTMLParseException { try { Float ieVersion = extractIEVersion(userAgent); String contents = new String(html,encoding); LagartoParser lagartoParser = new LagartoParser(contents.toCharArray()); LagartoDomBuilderConfig config = new LagartoDomBuilderConfig(); config.setCaseSensitive(false); // Conditional comments only apply for IE < 10 config.setEnableConditionalComments(isEnableConditionalComments(ieVersion)); if(ieVersion != null) { config.setCondCommentIEVersion(ieVersion); } lagartoParser.setConfig(config); JMeterTagVisitor tagVisitor = new JMeterTagVisitor(new URLPointer(baseUrl), coll, ieVersion); lagartoParser.parse(tagVisitor); return coll.iterator(); } catch (LagartoException e) { // TODO is it the best way ? https://bz.apache.org/bugzilla/show_bug.cgi?id=55634 if(log.isDebugEnabled()) { log.debug("Error extracting embedded resource URLs from:'"+baseUrl+"', probably not text content, message:"+e.getMessage()); } return Collections.<URL>emptyList().iterator(); } catch (Exception e) { throw new HTMLParseException(e); } } }
} catch (UnsupportedEncodingException | MalformedCachePatternException e) { throw new HTMLParseException(e.getMessage(), e); } finally { JMeterUtils.clearMatcherMemory(matcher, pattern);
baseUrl = ConversionUtils.makeRelativeURL(baseUrl, tmp); } catch (MalformedURLException e) { throw new HTMLParseException(e);