Browse Source

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.
pull/1238/merge
Juergen Hoeller 8 years ago
parent
commit
8cb7e026e2
  1. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/config/PathMatchConfigurer.java
  2. 3
      spring-web-reactive/src/main/java/org/springframework/web/reactive/handler/AbstractHandlerMapping.java
  3. 2
      spring-web-reactive/src/main/java/org/springframework/web/reactive/resource/ResourceUrlProvider.java
  4. 2
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/condition/PatternsRequestCondition.java
  5. 4
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfo.java
  6. 2
      spring-web-reactive/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java
  7. 2
      spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java
  8. 2
      spring-web/src/main/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSource.java
  9. 8
      spring-web/src/main/java/org/springframework/web/server/support/HttpRequestPathHelper.java
  10. 5
      spring-web/src/main/java/org/springframework/web/server/support/package-info.java

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/config/PathMatchConfigurer.java

@ -13,10 +13,11 @@ @@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.config;
import org.springframework.util.PathMatcher;
import org.springframework.web.util.HttpRequestPathHelper;
import org.springframework.web.server.support.HttpRequestPathHelper;
/**
* Assist with configuring {@code HandlerMapping}'s with path matching options.

3
spring-web-reactive/src/main/java/org/springframework/web/reactive/handler/AbstractHandlerMapping.java

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.handler;
import java.util.Map;
@ -33,7 +34,7 @@ import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource; @@ -33,7 +34,7 @@ import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
import org.springframework.web.reactive.HandlerMapping;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebHandler;
import org.springframework.web.util.HttpRequestPathHelper;
import org.springframework.web.server.support.HttpRequestPathHelper;
/**
* Abstract base class for {@link org.springframework.web.reactive.HandlerMapping}

2
spring-web-reactive/src/main/java/org/springframework/web/reactive/resource/ResourceUrlProvider.java

@ -37,7 +37,7 @@ import org.springframework.util.AntPathMatcher; @@ -37,7 +37,7 @@ import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;
import org.springframework.web.reactive.handler.SimpleUrlHandlerMapping;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.util.HttpRequestPathHelper;
import org.springframework.web.server.support.HttpRequestPathHelper;
/**
* A central component to use to obtain the public URL path that clients should

2
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/condition/PatternsRequestCondition.java

@ -31,7 +31,7 @@ import org.springframework.util.AntPathMatcher; @@ -31,7 +31,7 @@ import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;
import org.springframework.util.StringUtils;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.util.HttpRequestPathHelper;
import org.springframework.web.server.support.HttpRequestPathHelper;
/**
* A logical disjunction (' || ') request condition that matches a request

4
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfo.java

@ -21,8 +21,8 @@ import java.util.Set; @@ -21,8 +21,8 @@ import java.util.Set;
import org.springframework.util.PathMatcher;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.reactive.accept.RequestedContentTypeResolver;
import org.springframework.web.reactive.accept.MappingContentTypeResolver;
import org.springframework.web.reactive.accept.RequestedContentTypeResolver;
import org.springframework.web.reactive.result.condition.ConsumesRequestCondition;
import org.springframework.web.reactive.result.condition.HeadersRequestCondition;
import org.springframework.web.reactive.result.condition.ParamsRequestCondition;
@ -32,7 +32,7 @@ import org.springframework.web.reactive.result.condition.RequestCondition; @@ -32,7 +32,7 @@ import org.springframework.web.reactive.result.condition.RequestCondition;
import org.springframework.web.reactive.result.condition.RequestConditionHolder;
import org.springframework.web.reactive.result.condition.RequestMethodsRequestCondition;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.util.HttpRequestPathHelper;
import org.springframework.web.server.support.HttpRequestPathHelper;
/**
* Encapsulates the following request mapping conditions:

2
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java

@ -50,7 +50,7 @@ import org.springframework.web.reactive.accept.RequestedContentTypeResolver; @@ -50,7 +50,7 @@ import org.springframework.web.reactive.accept.RequestedContentTypeResolver;
import org.springframework.web.reactive.result.AbstractHandlerResultHandler;
import org.springframework.web.server.NotAcceptableStatusException;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.util.HttpRequestPathHelper;
import org.springframework.web.server.support.HttpRequestPathHelper;
/**
* {@code HandlerResultHandler} that encapsulates the view resolution algorithm

2
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java

@ -60,7 +60,7 @@ import org.springframework.web.server.UnsupportedMediaTypeStatusException; @@ -60,7 +60,7 @@ import org.springframework.web.server.UnsupportedMediaTypeStatusException;
import org.springframework.web.server.adapter.DefaultServerWebExchange;
import org.springframework.web.server.session.MockWebSessionManager;
import org.springframework.web.server.session.WebSessionManager;
import org.springframework.web.util.HttpRequestPathHelper;
import org.springframework.web.server.support.HttpRequestPathHelper;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

2
spring-web/src/main/java/org/springframework/web/cors/reactive/UrlBasedCorsConfigurationSource.java

@ -25,7 +25,7 @@ import org.springframework.util.Assert; @@ -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

8
spring-web/src/main/java/org/springframework/web/util/HttpRequestPathHelper.java → spring-web/src/main/java/org/springframework/web/server/support/HttpRequestPathHelper.java

@ -13,7 +13,8 @@ @@ -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; @@ -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 { @@ -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 { @@ -125,4 +127,4 @@ public class HttpRequestPathHelper {
return decodedVars;
}
}
}

5
spring-web/src/main/java/org/springframework/web/server/support/package-info.java

@ -0,0 +1,5 @@ @@ -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;
Loading…
Cancel
Save