use of cn.taketoday.http.server.PathContainer in project today-framework by TAKETODAY.
the class HandlerMatchingMetadata method pathWithinApplication.
@Experimental
public final PathContainer pathWithinApplication() {
PathContainer pathWithinApplication = this.pathWithinApplication;
if (pathWithinApplication == null) {
pathWithinApplication = requestPath.pathWithinApplication();
this.pathWithinApplication = pathWithinApplication;
}
return pathWithinApplication;
}
use of cn.taketoday.http.server.PathContainer in project today-framework by TAKETODAY.
the class PathPatternTests method extractPathWithinPatternCustomSeparator.
@Test
public void extractPathWithinPatternCustomSeparator() {
PathPatternParser ppp = new PathPatternParser();
ppp.setPathOptions(PathContainer.Options.create('.', true));
PathPattern pp = ppp.parse("test.**");
PathContainer pathContainer = PathContainer.parsePath("test.projects..spring-framework", PathContainer.Options.create('.', true));
PathContainer result = pp.extractPathWithinPattern(pathContainer);
assertThat(result.value()).isEqualTo("projects.spring-framework");
assertThat(result.elements()).hasSize(3);
}
use of cn.taketoday.http.server.PathContainer in project today-framework by TAKETODAY.
the class PathPatternTests method checkMatches.
private void checkMatches(String uriTemplate, String path) {
PathPatternParser parser = new PathPatternParser();
parser.setMatchOptionalTrailingSeparator(true);
PathPattern p = parser.parse(uriTemplate);
PathContainer pc = toPathContainer(path);
assertThat(p.matches(pc)).isTrue();
}
use of cn.taketoday.http.server.PathContainer in project today-framework by TAKETODAY.
the class PathPatternTests method checkNoMatch.
private void checkNoMatch(String uriTemplate, String path) {
PathPatternParser p = new PathPatternParser();
PathPattern pattern = p.parse(uriTemplate);
PathContainer PathContainer = toPathContainer(path);
assertThat(pattern.matches(PathContainer)).isFalse();
}
use of cn.taketoday.http.server.PathContainer in project today-infrastructure by TAKETODAY.
the class HandlerMatchingMetadata method getPathWithinMapping.
public PathContainer getPathWithinMapping() {
PathContainer pathWithinMapping = this.pathWithinMapping;
if (pathWithinMapping == null) {
pathWithinMapping = getBestMatchingPattern().extractPathWithinPattern(requestPath);
this.pathWithinMapping = pathWithinMapping;
}
return pathWithinMapping;
}
Aggregations