Package io.undertow.util
Class PathTemplate
- java.lang.Object
-
- io.undertow.util.PathTemplate
-
- All Implemented Interfaces:
java.lang.Comparable<PathTemplate>
public class PathTemplate extends java.lang.Object implements java.lang.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(PathTemplate o)static PathTemplatecreate(java.lang.String inputPath)booleanequals(java.lang.Object o)java.lang.StringgetBase()java.util.Set<java.lang.String>getParameterNames()java.lang.StringgetTemplateString()inthashCode()booleanmatches(java.lang.String path, java.util.Map<java.lang.String,java.lang.String> pathParameters)Check if the given uri matches the template.java.lang.StringtoString()
-
-
-
Method Detail
-
create
public static PathTemplate create(java.lang.String inputPath)
-
matches
public boolean matches(java.lang.String path, java.util.Map<java.lang.String,java.lang.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 rootpathParameters- The path parameters map to fill out- Returns:
- true if the URI is a match
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
compareTo
public int compareTo(PathTemplate o)
- Specified by:
compareToin interfacejava.lang.Comparable<PathTemplate>
-
getBase
public java.lang.String getBase()
-
getTemplateString
public java.lang.String getTemplateString()
-
getParameterNames
public java.util.Set<java.lang.String> getParameterNames()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-