org.apache.jmeter.protocol.http.parser

## Class HTMLParser

- java.lang.Object
- - org.apache.jmeter.protocol.http.parser.BaseParser
  - - org.apache.jmeter.protocol.http.parser.HTMLParser

- All Implemented Interfaces:
    LinkExtractorParser
  Direct Known Subclasses:
    JsoupBasedHtmlParser, LagartoBasedHtmlParser

      public abstract class HTMLParser
      extends BaseParser

  `HTMLParser` subclasses can parse HTML content to obtain URLs.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static java.lang.String` | `ATT_BACKGROUND`
    `protected static java.lang.String` | `ATT_CODE`
    `protected static java.lang.String` | `ATT_CODEBASE`
    `protected static java.lang.String` | `ATT_DATA`
    `protected static java.lang.String` | `ATT_HREF`
    `protected static java.lang.String` | `ATT_IS_IMAGE`
    `protected static java.lang.String` | `ATT_REL`
    `protected static java.lang.String` | `ATT_SRC`
    `protected static java.lang.String` | `ATT_STYLE`
    `protected static java.lang.String` | `ATT_TYPE`
    `static java.lang.String` | `DEFAULT_PARSER`
    `protected static java.lang.String` | `ICON`
    `protected static java.lang.String` | `IE_UA`
    `protected static java.util.regex.Pattern` | `IE_UA_PATTERN`
    `static java.lang.String` | `PARSER_CLASSNAME`
    `protected static java.lang.String` | `SHORTCUT_ICON`
    `protected static java.lang.String` | `STYLESHEET`
    `protected static java.lang.String` | `TAG_APPLET`
    `protected static java.lang.String` | `TAG_BASE`
    `protected static java.lang.String` | `TAG_BGSOUND`
    `protected static java.lang.String` | `TAG_BODY`
    `protected static java.lang.String` | `TAG_EMBED`
    `protected static java.lang.String` | `TAG_FRAME`
    `protected static java.lang.String` | `TAG_IFRAME`
    `protected static java.lang.String` | `TAG_IMAGE`
    `protected static java.lang.String` | `TAG_INPUT`
    `protected static java.lang.String` | `TAG_LINK`
    `protected static java.lang.String` | `TAG_OBJECT`
    `protected static java.lang.String` | `TAG_SCRIPT`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `HTMLParser()` Protected constructor to prevent instantiation except from within subclasses.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.lang.Float` | `extractIEVersion(java.lang.String userAgent)`
    `java.util.Iterator<java.net.URL>` | `getEmbeddedResourceURLs(java.lang.String userAgent, byte[] html, java.net.URL baseUrl, java.util.Collection<URLString> coll, java.lang.String encoding)` Get the URLs for all the resources that a browser would automatically download following the download of the HTML content, that is: images, stylesheets, javascript files, applets, etc...
    `java.util.Iterator<java.net.URL>` | `getEmbeddedResourceURLs(java.lang.String userAgent, byte[] html, java.net.URL baseUrl, java.lang.String encoding)` Get the URLs for all the resources that a browser would automatically download following the download of the HTML content, that is: images, stylesheets, javascript files, applets, etc...
    `abstract java.util.Iterator<java.net.URL>` | `getEmbeddedResourceURLs(java.lang.String userAgent, byte[] html, java.net.URL baseUrl, URLCollection coll, java.lang.String encoding)` Get the URLs for all the resources that a browser would automatically download following the download of the HTML content, that is: images, stylesheets, javascript files, applets, etc...
    `protected boolean` | `isEnableConditionalComments(java.lang.Float ieVersion)`
    `protected static java.lang.String` | `normalizeUrlValue(java.lang.CharSequence url)` Normalizes URL as browsers do

    - ### Methods inherited from class org.apache.jmeter.protocol.http.parser.BaseParser

      `getParser, isReusable`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ATT_BACKGROUND

          protected static final java.lang.String ATT_BACKGROUND

      See Also:
        Constant Field Values

    - #### ATT_CODE

          protected static final java.lang.String ATT_CODE

      See Also:
        Constant Field Values

    - #### ATT_CODEBASE

          protected static final java.lang.String ATT_CODEBASE

      See Also:
        Constant Field Values

    - #### ATT_DATA

          protected static final java.lang.String ATT_DATA

      See Also:
        Constant Field Values

    - #### ATT_HREF

          protected static final java.lang.String ATT_HREF

      See Also:
        Constant Field Values

    - #### ATT_REL

          protected static final java.lang.String ATT_REL

      See Also:
        Constant Field Values

    - #### ATT_SRC

          protected static final java.lang.String ATT_SRC

      See Also:
        Constant Field Values

    - #### ATT_STYLE

          protected static final java.lang.String ATT_STYLE

      See Also:
        Constant Field Values

    - #### ATT_TYPE

          protected static final java.lang.String ATT_TYPE

      See Also:
        Constant Field Values

    - #### ATT_IS_IMAGE

          protected static final java.lang.String ATT_IS_IMAGE

      See Also:
        Constant Field Values

    - #### TAG_APPLET

          protected static final java.lang.String TAG_APPLET

      See Also:
        Constant Field Values

    - #### TAG_BASE

          protected static final java.lang.String TAG_BASE

      See Also:
        Constant Field Values

    - #### TAG_BGSOUND

          protected static final java.lang.String TAG_BGSOUND

      See Also:
        Constant Field Values

    - #### TAG_BODY

          protected static final java.lang.String TAG_BODY

      See Also:
        Constant Field Values

    - #### TAG_EMBED

          protected static final java.lang.String TAG_EMBED

      See Also:
        Constant Field Values

    - #### TAG_FRAME

          protected static final java.lang.String TAG_FRAME

      See Also:
        Constant Field Values

    - #### TAG_IFRAME

          protected static final java.lang.String TAG_IFRAME

      See Also:
        Constant Field Values

    - #### TAG_IMAGE

          protected static final java.lang.String TAG_IMAGE

      See Also:
        Constant Field Values

    - #### TAG_INPUT

          protected static final java.lang.String TAG_INPUT

      See Also:
        Constant Field Values

    - #### TAG_LINK

          protected static final java.lang.String TAG_LINK

      See Also:
        Constant Field Values

    - #### TAG_OBJECT

          protected static final java.lang.String TAG_OBJECT

      See Also:
        Constant Field Values

    - #### TAG_SCRIPT

          protected static final java.lang.String TAG_SCRIPT

      See Also:
        Constant Field Values

    - #### STYLESHEET

          protected static final java.lang.String STYLESHEET

      See Also:
        Constant Field Values

    - #### SHORTCUT_ICON

          protected static final java.lang.String SHORTCUT_ICON

      See Also:
        Constant Field Values

    - #### ICON

          protected static final java.lang.String ICON

      See Also:
        Constant Field Values

    - #### IE_UA

          protected static final java.lang.String IE_UA

      See Also:
        Constant Field Values

    - #### IE_UA_PATTERN

          protected static final java.util.regex.Pattern IE_UA_PATTERN

    - #### PARSER_CLASSNAME

          public static final java.lang.String PARSER_CLASSNAME

      See Also:
        Constant Field Values

    - #### DEFAULT_PARSER

          public static final java.lang.String DEFAULT_PARSER

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### HTMLParser

          protected HTMLParser()

      Protected constructor to prevent instantiation except from within subclasses.

  - ### Method Detail

    - #### getEmbeddedResourceURLs

          public java.util.Iterator<java.net.URL> getEmbeddedResourceURLs(java.lang.String userAgent,
                                                                          byte[] html,
                                                                          java.net.URL baseUrl,
                                                                          java.lang.String encoding)
                                                                   throws HTMLParseException

      Get the URLs for all the resources that a browser would automatically download following the download of the HTML content, that is: images, stylesheets, javascript files, applets, etc...

      URLs should not appear twice in the returned iterator.

      Malformed URLs can be reported to the caller by having the Iterator return the corresponding RL String. Overall problems parsing the html should be reported by throwing an HTMLParseException.

      Parameters:
        `userAgent` - User Agent
        `html` - HTML code
        `baseUrl` - Base URL from which the HTML code was obtained
        `encoding` - Charset
      Returns:
        an Iterator for the resource URLs
      Throws:
        `HTMLParseException` - when parsing the `html` fails

    - #### getEmbeddedResourceURLs

          public abstract java.util.Iterator<java.net.URL> getEmbeddedResourceURLs(java.lang.String userAgent,
                                                                                   byte[] html,
                                                                                   java.net.URL baseUrl,
                                                                                   URLCollection coll,
                                                                                   java.lang.String encoding)
                                                                            throws HTMLParseException

      Get the URLs for all the resources that a browser would automatically download following the download of the HTML content, that is: images, stylesheets, javascript files, applets, etc...

      All URLs should be added to the Collection.

      Malformed URLs can be reported to the caller by having the Iterator return the corresponding RL String. Overall problems parsing the html should be reported by throwing an HTMLParseException.

      N.B. The Iterator returns URLs, but the Collection will contain objects of class URLString.

      Parameters:
        `userAgent` - User Agent
        `html` - HTML code
        `baseUrl` - Base URL from which the HTML code was obtained
        `coll` - URLCollection
        `encoding` - Charset
      Returns:
        an Iterator for the resource URLs
      Throws:
        `HTMLParseException` - when parsing the `html` fails

    - #### getEmbeddedResourceURLs

          public java.util.Iterator<java.net.URL> getEmbeddedResourceURLs(java.lang.String userAgent,
                                                                          byte[] html,
                                                                          java.net.URL baseUrl,
                                                                          java.util.Collection<URLString> coll,
                                                                          java.lang.String encoding)
                                                                   throws HTMLParseException

      Get the URLs for all the resources that a browser would automatically download following the download of the HTML content, that is: images, stylesheets, javascript files, applets, etc...

      N.B. The Iterator returns URLs, but the Collection will contain objects of class URLString.

      Parameters:
        `userAgent` - User Agent
        `html` - HTML code
        `baseUrl` - Base URL from which the HTML code was obtained
        `coll` - Collection - will contain URLString objects, not URLs
        `encoding` - Charset
      Returns:
        an Iterator for the resource URLs
      Throws:
        `HTMLParseException` - when parsing the `html` fails

    - #### isEnableConditionalComments

          protected final boolean isEnableConditionalComments(java.lang.Float ieVersion)

      Parameters:
        `ieVersion` - Float IE version
      Returns:
        true if IE version < IE v10

    - #### extractIEVersion

          protected java.lang.Float extractIEVersion(java.lang.String userAgent)

      Parameters:
        `userAgent` - User Agent
      Returns:
        version null if not IE or the version after MSIE

    - #### normalizeUrlValue

          protected static java.lang.String normalizeUrlValue(java.lang.CharSequence url)

      Normalizes URL as browsers do
      Parameters:
        `url` - `CharSequence`
      Returns:
        normalized url

Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.