From ac6c96a391ebffe40af3f6a500a51eea98fe1d8f Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Sat, 11 May 2019 05:39:58 -0400 Subject: [PATCH] Polish --- .../http/server/PathContainer.java | 35 +++++++++---------- .../web/util/pattern/PathPattern.java | 2 +- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/http/server/PathContainer.java b/spring-web/src/main/java/org/springframework/http/server/PathContainer.java index 93599a78c7..841dda2f36 100644 --- a/spring-web/src/main/java/org/springframework/http/server/PathContainer.java +++ b/spring-web/src/main/java/org/springframework/http/server/PathContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,14 +21,13 @@ import java.util.List; import org.springframework.util.MultiValueMap; /** - * Structured representation of a URI path whose elements have been pre-parsed - * into a sequence of {@link Separator Separator} and {@link PathSegment - * PathSegment} elements. + * Structured representation of a URI path parsed via {@link #parsePath(String)} + * into a sequence of {@link Separator} and {@link PathSegment} elements. * - *

An instance of this class can be created via {@link #parsePath(String)}. - * Each {@link PathSegment PathSegment} exposes its structure decoded - * safely without the risk of encoded reserved characters altering the path or - * segment structure and without path parameters for path matching purposes. + *

Each {@link PathSegment} exposes its content in decoded form and with path + * parameters removed. This makes it safe to match one path segment at a time + * without the risk of decoded reserved characters altering the structure of + * the path. * * @author Rossen Stoyanchev * @since 5.0 @@ -36,12 +35,12 @@ import org.springframework.util.MultiValueMap; public interface PathContainer { /** - * The original (raw, encoded) path that this instance was parsed from. + * The original path from which this instance was parsed. */ String value(); /** - * The list of path elements, either {@link Separator} or {@link PathSegment}. + * The contained path elements, either {@link Separator} or {@link PathSegment}. */ List elements(); @@ -55,8 +54,8 @@ public interface PathContainer { } /** - * Extract a sub-path from the given start offset (inclusive) into the - * element list and to the end offset (exclusive). + * Extract a sub-path from the given start offset into the element list + * (inclusive) and to the end offset (exclusive). * @param startIndex the start element index (inclusive) * @param endIndex the end element index (exclusive) * @return the sub-path @@ -78,12 +77,12 @@ public interface PathContainer { /** - * Common representation of a path element, e.g. separator or segment. + * A path element, either separator or path segment. */ interface Element { /** - * Return the original (raw, encoded) value of this path element. + * The unmodified, original value of this element. */ String value(); } @@ -102,19 +101,17 @@ public interface PathContainer { interface PathSegment extends Element { /** - * Return the path segment value to use for pattern matching purposes. - * By default this is the same as {@link #value()} but may also differ - * in sub-interfaces (e.g. decoded, sanitized, etc.). + * Return the path segment value, decoded and sanitized, for path matching. */ String valueToMatch(); /** - * The same as {@link #valueToMatch()} but as a {@code char[]}. + * Expose {@link #valueToMatch()} as a character array. */ char[] valueToMatchAsChars(); /** - * Path parameters parsed from the path segment. + * Path parameters associated with this path segment. */ MultiValueMap parameters(); } diff --git a/spring-web/src/main/java/org/springframework/web/util/pattern/PathPattern.java b/spring-web/src/main/java/org/springframework/web/util/pattern/PathPattern.java index acdab2eba2..750e60c25d 100644 --- a/spring-web/src/main/java/org/springframework/web/util/pattern/PathPattern.java +++ b/spring-web/src/main/java/org/springframework/web/util/pattern/PathPattern.java @@ -352,7 +352,7 @@ public class PathPattern implements Comparable { } /** - * Combine this pattern with another. Currently does not produce a new PathPattern, just produces a new string. + * Combine this pattern with another. */ public PathPattern combine(PathPattern pattern2string) { // If one of them is empty the result is the other. If both empty the result is ""