Class HtmlParsingUtils
java.lang.Object
org.apache.jmeter.protocol.http.parser.HtmlParsingUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic Document
static HTTPSamplerBase
createUrlFromAnchor
(String parsedUrlString, URL context) Create a new Sampler based on an HREF string plus a contextual URL object.static List<HTTPSamplerBase>
createURLFromForm
(Node doc, URL context) static void
extractStyleURLs
(URL baseUrl, URLCollection urls, String styleTagStr) static Node
Returns a node representing a whole xml given an xml document.static org.w3c.tidy.Tidy
Returnstidy
as HTML parser.static boolean
isAnchorMatched
(HTTPSamplerBase newLink, HTTPSamplerBase config) Check if anchor matches by checking against: - protocol - domain - path - parameter namesstatic boolean
isArgumentMatched
(Argument arg, Argument patternArg) Arguments match if the input name matches the corresponding pattern name and the input value matches the pattern value, where the matching is done first using String equals, and then Regular Expression matching if the equals test fails.static boolean
isEqualOrMatches
(String arg, String pat) Match the input argument against the pattern using String.equals() or pattern matching if that fails using case-insensitive matching.static boolean
isEqualOrMatches
(String arg, String pat, org.apache.oro.text.regex.Perl5Matcher matcher, org.apache.oro.text.PatternCacheLRU cache) Match the input argument against the pattern using String.equals() or pattern matching if that fails.static boolean
isEqualOrMatchesCaseBlind
(String arg, String pat) Match the input argument against the pattern using String.equals() or pattern matching if that fails using case-insensitive matching.static boolean
isEqualOrMatchesCaseBlind
(String arg, String pat, org.apache.oro.text.regex.Perl5Matcher matcher, org.apache.oro.text.PatternCacheLRU cache) Match the input argument against the pattern using String.equals() or pattern matching if that fails using case-insensitive matching.
-
Method Details
-
isAnchorMatched
Check if anchor matches by checking against: - protocol - domain - path - parameter names- Parameters:
newLink
- target to matchconfig
- pattern to match against- Returns:
- true if target URL matches pattern URL
-
isArgumentMatched
Arguments match if the input name matches the corresponding pattern name and the input value matches the pattern value, where the matching is done first using String equals, and then Regular Expression matching if the equals test fails.- Parameters:
arg
- - input ArgumentpatternArg
- - pattern to match against- Returns:
- true if both name and value match
-
isEqualOrMatches
public static boolean isEqualOrMatches(String arg, String pat, org.apache.oro.text.regex.Perl5Matcher matcher, org.apache.oro.text.PatternCacheLRU cache) Match the input argument against the pattern using String.equals() or pattern matching if that fails.- Parameters:
arg
- input stringpat
- pattern stringmatcher
- Perl5Matchercache
- PatternCache- Returns:
- true if input matches the pattern
-
isEqualOrMatchesCaseBlind
public static boolean isEqualOrMatchesCaseBlind(String arg, String pat, org.apache.oro.text.regex.Perl5Matcher matcher, org.apache.oro.text.PatternCacheLRU cache) Match the input argument against the pattern using String.equals() or pattern matching if that fails using case-insensitive matching.- Parameters:
arg
- input stringpat
- pattern stringmatcher
- Perl5Matchercache
- PatternCache- Returns:
- true if input matches the pattern
-
isEqualOrMatches
Match the input argument against the pattern using String.equals() or pattern matching if that fails using case-insensitive matching.- Parameters:
arg
- input stringpat
- pattern string- Returns:
- true if input matches the pattern
-
isEqualOrMatchesCaseBlind
Match the input argument against the pattern using String.equals() or pattern matching if that fails using case-insensitive matching.- Parameters:
arg
- input stringpat
- pattern string- Returns:
- true if input matches the pattern
-
getParser
public static org.w3c.tidy.Tidy getParser()Returnstidy
as HTML parser.- Returns:
- a
tidy
HTML parser
-
getDOM
Returns a node representing a whole xml given an xml document.- Parameters:
text
- an xml document- Returns:
- a node representing a whole xml
-
createEmptyDoc
-
createUrlFromAnchor
public static HTTPSamplerBase createUrlFromAnchor(String parsedUrlString, URL context) throws MalformedURLException Create a new Sampler based on an HREF string plus a contextual URL object. Given that an HREF string might be of three possible forms, some processing is required.- Parameters:
parsedUrlString
- the url from the hrefcontext
- the context in which the href was found. This is used to extract url information that might be missing inparsedUrlString
- Returns:
- sampler with filled in information about the fully parsed url
- Throws:
MalformedURLException
- when the given url (parsedUrlString
pluscontext
is malformed)
-
createURLFromForm
-
extractStyleURLs
-