***************************************/
public static synchronized boolean isAnchorMatched(HTTPSampler newLink,
HTTPSampler config) throws MalformedPatternException
{
boolean ok = true;
Perl5Matcher matcher = (Perl5Matcher)localMatcher.get();
Iterator iter = config.getArguments().iterator();
// In JDK1.2, URLDecoder.decode has Exception in its throws clause. However, it
// was removed in JDK1.3. Since JMeter is JDK1.2-compatible, we need to catch
// Exception.
String query = null;
try
{
query = URLDecoder.decode(newLink.getQueryString());
}
catch (Exception e)
{
// do nothing. query will remain null.
}
if(query == null && config.getArguments().getArgumentCount() > 0)
return false;
while(iter.hasNext())
{
Argument item = (Argument)iter.next();
if(query.indexOf(item.getName()+"=") == -1)
{
if(!(ok = ok && matcher.contains(query,
patternCache.getPattern(item.getName(), Perl5Compiler.READ_ONLY_MASK))))
{
return false;
}
}
}
if(config.getDomain() != null && config.getDomain().length() > 0 &&
!newLink.getDomain().equals(config.getDomain()))
{
if(!(ok = ok && matcher.matches(newLink.getDomain(),
patternCache.getPattern(config.getDomain(), Perl5Compiler.READ_ONLY_MASK))))
return false;
}
if(!newLink.getPath().equals(config.getPath()) && !matcher.matches(newLink.getPath(),
patternCache.getPattern("[/]*" + config.getPath(), Perl5Compiler.READ_ONLY_MASK)))
return false;
if(!(ok = ok && matcher.matches(newLink.getProtocol(),
patternCache.getPattern(config.getProtocol(), Perl5Compiler.READ_ONLY_MASK))))
return false;
return ok;
}