Class PathTemplate

java.lang.Object
io.undertow.util.PathTemplate
All Implemented Interfaces:
Comparable<PathTemplate>

public class PathTemplate extends Object implements Comparable<PathTemplate>
Represents a parsed web socket path template.

This class can be compared to other path templates, with templates that are considered lower have a higher priority, and should be checked first.

This comparison can also be used to check for semantically equal paths, if a.compareTo(b) == 0 then the two paths are equivalent, which will generally result in a deployment exception.

Author:
Stuart Douglas
  • Method Details

    • create

      public static PathTemplate create(String inputPath)
    • matches

      public boolean matches(String path, Map<String,String> pathParameters)
      Check if the given uri matches the template. If so then it will return true and place the value of any path parameters into the given map.

      Note the map may be modified even if the match in unsuccessful, however in this case it will be emptied before the method returns

      Parameters:
      path - The request path, relative to the context root
      pathParameters - The path parameters map to fill out
      Returns:
      true if the URI is a match
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(PathTemplate o)
      Specified by:
      compareTo in interface Comparable<PathTemplate>
    • getBase

      public String getBase()
    • getTemplateString

      public String getTemplateString()
    • getParameterNames

      public Set<String> getParameterNames()
    • toString

      public String toString()
      Overrides:
      toString in class Object