You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by bu...@apache.org on 2007/02/27 14:59:17 UTC

DO NOT REPLY [Bug 40696] - retieve all embeded resources from html pages for CSS images

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40696>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40696





------- Additional Comments From alf@i100.no  2007-02-27 05:59 -------
The problem is not that the response is not valid xhtml.

The reason is that the parser that parses the response and looks for embedded
resources, does not look for constructs like <anytag
style="background:url('someurl')"/>.

I am not sure if the parser should look for such embedded resources. If the
stylesheet file references any resources, those will not be downloaded by
jmeter, because jmeter only downloads any stylesheet files referenced, it does
not parse the downloaded stylesheet files and then download all resources
referenced by the stylesheet file.

So if there should be no difference between resources mentioned inside
stylesheet files and resouces mentioned in inline style of the actual document,
then I think this bug should be closed as "invalid".

If you want resources mentioned in inline styling of the document, then the
following code could be added to the bottom of the "parseNodes" method of the
"HtmlParserHTMLParser" seems to do the work :

            String styleTagStr = tag.getAttribute("STYLE");
            if(styleTagStr != null) {
                PatternCompiler compiler = new Perl5Compiler();
                PatternMatcher matcher = new Perl5Matcher();
                Pattern pattern = null;
                PatternMatcherInput input = null;
                try {
                    pattern = compiler.compile("URL\\(('|\")(.*)('|\")\\)", 
                        Perl5Compiler.CASE_INSENSITIVE_MASK |
Perl5Compiler.SINGLELINE_MASK | Perl5Compiler.READ_ONLY_MASK);
                    input = new PatternMatcherInput(styleTagStr);
                    while (matcher.contains(input, pattern)) {
                        MatchResult match = matcher.getMatch();
                        // The value is in the second group
                        String styleUrl = match.group(2);
                        urls.addURL(styleUrl, baseUrl.url);
                    }
                } catch (MalformedPatternException mpe) {
                    log.warn("Malformed pattern for getting url of style
attribute of a tag");
                }
            }            


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org