Class UrlPathMatch

java.lang.Object
org.apache.juneau.rest.util.UrlPathMatch

public class UrlPathMatch extends Object
Represents a URL path pattern match. For example, given the pattern "/foo/{bar}/*" and the path "/foo/123/baz/qux", this match gives you a map containing "{bar:123}" and a remainder string containing "baz/qux".
See Also:
  • Constructor Details

    • UrlPathMatch

      protected UrlPathMatch(String path, int matchedParts, String[] keys, String[] values)
      Constructor.
      Parameters:
      path - The path being matched against. Can be null.
      matchedParts - The number of parts that were matched against the path.
      keys - The variable keys. Can be null.
      values - The variable values. Can be null.
  • Method Details

    • getVars

      public Map<String,String> getVars()
      Returns a map of the path variables and values.
      Returns:
      An unmodifiable map of variable keys/values.
      Returns an empty map if no variables were found in the path.
    • hasVars

      public boolean hasVars()
      Returns true if this match contains one or more variables.
      Returns:
      true if this match contains one or more variables.
    • hasEmptyVars

      public boolean hasEmptyVars()
      Returns true if any of the variable values are blank.
      Returns:
      true if any of the variable values are blank.
    • getRemainder

      public String getRemainder()
      Returns the remainder of the path after the pattern match has been made.

      Same as {#link getSuffix() but trims the leading slash if there is one.

      Returns:
      The remainder of the path after the pattern match has been made.
    • getSuffix

      public String getSuffix()
      Returns the remainder of the URL after the pattern was matched.
      Returns:
      The remainder of the URL after the pattern was matched.
      Can be null if nothing remains to be matched.
      Otherwise, always starts with '/'.
    • getPrefix

      public String getPrefix()
      Returns the part of the URL that the pattern matched against.
      Returns:
      The part of the URL that the pattern matched against.
      Can be null if nothing matched.
      Otherwise, always starts with '/'.
    • toString

      public String toString()
      Overrides:
      toString in class Object