Tabnine Logo
MatcherUtil
Code IndexAdd Tabnine to your IDE (free)

How to use
MatcherUtil
in
com.nike.riposte.util

Best Java code snippets using com.nike.riposte.util.MatcherUtil (Showing top 5 results out of 315)

origin: Nike-Inc/riposte

public SingleMatcher(String matchingPathTemplate, Collection<HttpMethod> matchingMethods, boolean matchAllMethods) {
  // If the path template doesn't start with a forward slash it has no hope of ever matching any incoming request.
  if (matchingPathTemplate == null || !matchingPathTemplate.startsWith("/")) {
    throw new IllegalArgumentException("matchingPathTemplate cannot be null and must start with a forward "
                      + "slash '/'");
  }
  if (matchingMethods == null)
    throw new IllegalArgumentException("matchingMethods cannot be null");
  matchingPathTemplate = MatcherUtil.stripEndSlash(matchingPathTemplate);
  this.matchingMethods = matchingMethods;
  this.matchingPathTemplate = matchingPathTemplate;
  this.matchingPathTemplates = Collections.singletonList(matchingPathTemplate);
  this.matchAllMethods = matchAllMethods;
  this.cachedMatchesPathResponse = Optional.of(matchingPathTemplate);
}
origin: Nike-Inc/riposte

@Test
public void code_coverage_hoops() {
  // jump!
  new MatcherUtil();
}
origin: Nike-Inc/riposte

/**
 * @return Returns the first pattern found in the collection that matches the given request if one exists. Order of
 * paths can be significant so when creating a MultiMatcher use an ordered collection if some path may match
 * multiple patterns.
 */
@Override
public Optional<String> matchesPath(RequestInfo<?> request) {
  if (request == null || request.getPath() == null)
    return Optional.empty();
  // Ignore trailing slashes on the actual path.
  String path = MatcherUtil.stripEndSlash(request.getPath());
  return matchingPathTemplates
    .stream()
    // Ignore trailing slashes on the template.
    .filter(pathTemplate -> pathParamExtractor.match(pathTemplate, path))
    .findFirst();
}
origin: Nike-Inc/riposte

/**
 * {@inheritDoc}
 */
public Optional<String> matchesPath(RequestInfo<?> request) {
  if (request == null || request.getPath() == null)
    return Optional.empty();
  // Ignore trailing slashes on actual path.
  String path = MatcherUtil.stripEndSlash(request.getPath());
  if (pathParamExtractor.match(matchingPathTemplate, path)) {
    return cachedMatchesPathResponse;
  }
  else {
    return Optional.empty();
  }
}
origin: Nike-Inc/riposte

  @Test
  public void stripEndSlash_should_strip_an_end_slash() {
    String path = "/something/ending/in/slash/";
    assertThat(MatcherUtil.stripEndSlash(path), is("/something/ending/in/slash"));
  }
}
com.nike.riposte.utilMatcherUtil

Most used methods

  • stripEndSlash
  • <init>

Popular in Java

  • Reading from database using SQL prepared statement
  • startActivity (Activity)
  • setScale (BigDecimal)
  • scheduleAtFixedRate (Timer)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now