HttpRequestPathHelper in new web.server.support package

In general, web.util is supposed to remain lowest-level, not depending on any other web.* package. Since web.client also has a support package, a corresponding web.server.support package seemed appropriate for a helper class depending on ServerWebExchange in web.server itself.
This commit is contained in:
Juergen Hoeller
2016-11-30 11:12:06 +01:00
parent 93cfc791a7
commit 8cb7e026e2
10 changed files with 21 additions and 12 deletions

View File

@@ -25,7 +25,7 @@ import org.springframework.util.Assert;
import org.springframework.util.PathMatcher;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.util.HttpRequestPathHelper;
import org.springframework.web.server.support.HttpRequestPathHelper;
/**
* Provide a per reactive request {@link CorsConfiguration} instance based on a

View File

@@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.util;
package org.springframework.web.server.support;
import java.io.UnsupportedEncodingException;
import java.util.LinkedHashMap;
@@ -24,6 +25,7 @@ import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.util.UriUtils;
/**
* A helper class to obtain the lookup path for path matching purposes.
@@ -57,7 +59,7 @@ public class HttpRequestPathHelper {
public String getLookupPathForRequest(ServerWebExchange exchange) {
String path = getPathWithinApplication(exchange.getRequest());
return (this.shouldUrlDecode() ? decode(exchange, path) : path);
return (shouldUrlDecode() ? decode(exchange, path) : path);
}
private String getPathWithinApplication(ServerHttpRequest request) {
@@ -125,4 +127,4 @@ public class HttpRequestPathHelper {
return decodedVars;
}
}
}

View File

@@ -0,0 +1,5 @@
/**
* Helper classes on top of {@code org.springframework.web.server},
* as a convenience for working with {@code ServerWebExchange}.
*/
package org.springframework.web.server.support;