コード例 #1
0
ファイル: RunningFrame.java プロジェクト: nmaupu/gatling
  private boolean addRequest(HttpRequest request) {
    URI uri = null;
    try {
      uri = new URI(request.getUri());
    } catch (URISyntaxException ex) {
      logger.error(
          "Can't create URI from request uri (" + request.getUri() + ")" + ex.getStackTrace());
      // FIXME error handling
      return false;
    }

    if (configuration.getFilterStrategy() != FilterStrategy.NONE) {

      String p = EMPTY;
      boolean add = true;
      if (configuration.getFilterStrategy() == FilterStrategy.ONLY) add = true;
      else if (configuration.getFilterStrategy() == FilterStrategy.EXCEPT) add = false;

      for (Pattern pattern : configuration.getPatterns()) {
        switch (pattern.getPatternType()) {
          case ANT:
            p = SelectorUtils.ANT_HANDLER_PREFIX;
            break;
          case JAVA:
            p = SelectorUtils.REGEX_HANDLER_PREFIX;
            break;
        }
        p += pattern.getPattern() + SelectorUtils.PATTERN_HANDLER_SUFFIX;
        if (SelectorUtils.matchPath(p, uri.getPath())) return add;
      }
      return !add;
    }
    return true;
  }
コード例 #2
0
 private boolean isIgnored(String name) {
   for (String pattern : IGNORED_PATTERNS) {
     if (SelectorUtils.matchPath(pattern, name, false)) {
       return true;
     }
   }
   return false;
 }