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 se...@apache.org on 2004/09/18 23:15:07 UTC

cvs commit: jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/modifier AnchorModifier.java

sebb        2004/09/18 14:15:07

  Modified:    src/protocol/http/org/apache/jmeter/protocol/http/modifier
                        Tag: rel-2_0 AnchorModifier.java
  Log:
  Bug25490 - handle base href
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.14.2.2  +10 -5     jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java
  
  Index: AnchorModifier.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java,v
  retrieving revision 1.14.2.1
  retrieving revision 1.14.2.2
  diff -u -r1.14.2.1 -r1.14.2.2
  --- AnchorModifier.java	3 Jul 2004 02:07:54 -0000	1.14.2.1
  +++ AnchorModifier.java	18 Sep 2004 21:15:06 -0000	1.14.2.2
  @@ -222,6 +222,11 @@
           HTTPSamplerBase config,
           List potentialLinks)
       {
  +    	String base="";
  +    	NodeList baseList = html.getElementsByTagName("base");
  +    	if (baseList.getLength()>0){
  +    		base=baseList.item(0).getAttributes().getNamedItem("href").getNodeValue();
  +    	}
           NodeList nodeList = html.getElementsByTagName("a");
           for (int i = 0; i < nodeList.getLength(); i++)
           {
  @@ -237,7 +242,7 @@
               {
                   HTTPSamplerBase newUrl =
                       HtmlParsingUtils.createUrlFromAnchor(
  -                        hrefStr, result.getURL());
  +                        hrefStr, new URL(result.getURL(),base));
                   newUrl.setMethod(HTTPSamplerBase.GET);
                   log.debug("possible match: " + newUrl);
                   if (HtmlParsingUtils.isAnchorMatched(newUrl, config))
  @@ -343,12 +348,12 @@
               testProcessingHTMLFile(
                   "/testfiles/jmeter_home_page_with_relative_links.html");
           }
  -/* Feature not yet implemented. TODO: implement it.
  +//* Feature not yet implemented. TODO: implement it.
           public void testModifySamplerWithBaseHRef() throws Exception
           {
               testProcessingHTMLFile(
                   "/testfiles/jmeter_home_page_with_base_href.html");
           }
  -*/
  +//*/
       }
   }
  
  
  

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