Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sesemomo
spring-framework
提交
f0be79e0
S
spring-framework
项目概览
sesemomo
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f0be79e0
编写于
11月 08, 2016
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Promoted BindingContext to web.reactive root (since HandlerResult requires it there)
Issue: SPR-14542
上级
99a8510a
变更
43
隐藏空白更改
内联
并排
Showing
43 changed file
with
130 addition
and
169 deletion
+130
-169
spring-web-reactive/src/main/java/org/springframework/web/reactive/BindingContext.java
...java/org/springframework/web/reactive/BindingContext.java
+3
-15
spring-web-reactive/src/main/java/org/springframework/web/reactive/HandlerResult.java
.../java/org/springframework/web/reactive/HandlerResult.java
+0
-1
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/HandlerMethodArgumentResolver.java
...reactive/result/method/HandlerMethodArgumentResolver.java
+2
-3
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java
...rk/web/reactive/result/method/InvocableHandlerMethod.java
+2
-1
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncHandlerMethodArgumentResolver.java
...tive/result/method/SyncHandlerMethodArgumentResolver.java
+2
-2
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncInvocableHandlerMethod.java
...eb/reactive/result/method/SyncInvocableHandlerMethod.java
+2
-1
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java
...hod/annotation/AbstractMessageReaderArgumentResolver.java
+3
-2
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueArgumentResolver.java
...method/annotation/AbstractNamedValueArgumentResolver.java
+3
-1
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueSyncArgumentResolver.java
...od/annotation/AbstractNamedValueSyncArgumentResolver.java
+1
-2
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactory.java
...ctive/result/method/annotation/BindingContextFactory.java
+2
-1
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolver.java
...esult/method/annotation/ErrorsMethodArgumentResolver.java
+2
-1
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolver.java
.../result/method/annotation/HttpEntityArgumentResolver.java
+2
-2
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContext.java
...ve/result/method/annotation/InitBinderBindingContext.java
+2
-1
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelArgumentResolver.java
...ctive/result/method/annotation/ModelArgumentResolver.java
+2
-2
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolver.java
...thod/annotation/ModelAttributeMethodArgumentResolver.java
+2
-1
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolver.java
...hod/annotation/PathVariableMapMethodArgumentResolver.java
+1
-2
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PrincipalArgumentResolver.java
...e/result/method/annotation/PrincipalArgumentResolver.java
+2
-1
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolver.java
...result/method/annotation/RequestBodyArgumentResolver.java
+1
-2
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMapMethodArgumentResolver.java
...od/annotation/RequestHeaderMapMethodArgumentResolver.java
+1
-1
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java
...esult/method/annotation/RequestMappingHandlerAdapter.java
+1
-1
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolver.java
...hod/annotation/RequestParamMapMethodArgumentResolver.java
+1
-1
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolver.java
.../method/annotation/ServerWebExchangeArgumentResolver.java
+2
-1
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/WebSessionArgumentResolver.java
.../result/method/annotation/WebSessionArgumentResolver.java
+2
-7
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java
...web/reactive/result/view/ViewResolutionResultHandler.java
+1
-1
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java
...b/reactive/result/method/InvocableHandlerMethodTests.java
+2
-0
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java
.../result/method/RequestMappingInfoHandlerMappingTests.java
+6
-11
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactoryTests.java
.../result/method/annotation/BindingContextFactoryTests.java
+5
-7
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CookieValueMethodArgumentResolverTests.java
...od/annotation/CookieValueMethodArgumentResolverTests.java
+2
-4
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsArgumentResolverTests.java
...result/method/annotation/ErrorsArgumentResolverTests.java
+4
-3
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ExpressionValueMethodArgumentResolverTests.java
...nnotation/ExpressionValueMethodArgumentResolverTests.java
+4
-7
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolverTests.java
...lt/method/annotation/HttpEntityArgumentResolverTests.java
+4
-7
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContextTests.java
...sult/method/annotation/InitBinderBindingContextTests.java
+3
-6
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageReaderArgumentResolverTests.java
...method/annotation/MessageReaderArgumentResolverTests.java
+16
-11
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolverTests.java
...annotation/ModelAttributeMethodArgumentResolverTests.java
+15
-14
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolverTests.java
...nnotation/PathVariableMapMethodArgumentResolverTests.java
+4
-5
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolverTests.java
...d/annotation/PathVariableMethodArgumentResolverTests.java
+2
-4
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestAttributeMethodArgumentResolverTests.java
...notation/RequestAttributeMethodArgumentResolverTests.java
+5
-8
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolverTests.java
...t/method/annotation/RequestBodyArgumentResolverTests.java
+3
-8
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolverTests.java
.../annotation/RequestHeaderMethodArgumentResolverTests.java
+2
-5
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java
...d/annotation/RequestParamMethodArgumentResolverTests.java
+2
-6
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolverTests.java
...od/annotation/ServerWebExchangeArgumentResolverTests.java
+1
-1
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java
...notation/SessionAttributeMethodArgumentResolverTests.java
+1
-1
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java
...eactive/result/view/ViewResolutionResultHandlerTests.java
+7
-8
未找到文件。
spring-web-reactive/src/main/java/org/springframework/web/reactive/
result/method/
BindingContext.java
→
spring-web-reactive/src/main/java/org/springframework/web/reactive/BindingContext.java
浏览文件 @
f0be79e0
...
...
@@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method
;
package
org.springframework.web.reactive
;
import
org.springframework.ui.Model
;
import
org.springframework.validation.support.BindingAwareConcurrentModel
;
...
...
@@ -22,7 +23,6 @@ import org.springframework.web.bind.WebExchangeDataBinder;
import
org.springframework.web.bind.support.WebBindingInitializer
;
import
org.springframework.web.server.ServerWebExchange
;
/**
* A context for binding requests to method arguments that provides access to
* the default model, data binding, validation, and type conversion.
...
...
@@ -45,14 +45,6 @@ public class BindingContext {
this
.
initializer
=
initializer
;
}
private
static
WebExchangeDataBinder
initTypeConverter
(
WebBindingInitializer
initializer
)
{
WebExchangeDataBinder
binder
=
new
WebExchangeDataBinder
(
null
);
if
(
initializer
!=
null
)
{
initializer
.
initBinder
(
binder
);
}
return
binder
;
}
/**
* Return the default model.
...
...
@@ -65,7 +57,6 @@ public class BindingContext {
/**
* Create a {@link WebExchangeDataBinder} for applying data binding, type
* conversion, and validation on the given "target" object.
*
* @param exchange the current exchange
* @param target the object to create a data binder for
* @param name the name of the target object
...
...
@@ -82,7 +73,6 @@ public class BindingContext {
/**
* Create a {@link WebExchangeDataBinder} without a "target" object, i.e.
* for applying type conversion to simple types.
*
* @param exchange the current exchange
* @param name the name of the target object
* @return a Mono for the created {@link WebDataBinder} instance
...
...
@@ -101,9 +91,7 @@ public class BindingContext {
/**
* Initialize the data binder instance for the given exchange.
*/
protected
WebExchangeDataBinder
initDataBinder
(
WebExchangeDataBinder
binder
,
ServerWebExchange
exchange
)
{
protected
WebExchangeDataBinder
initDataBinder
(
WebExchangeDataBinder
binder
,
ServerWebExchange
exchange
)
{
return
binder
;
}
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/HandlerResult.java
浏览文件 @
f0be79e0
...
...
@@ -25,7 +25,6 @@ import org.springframework.core.MethodParameter;
import
org.springframework.core.ResolvableType
;
import
org.springframework.ui.Model
;
import
org.springframework.util.Assert
;
import
org.springframework.web.reactive.result.method.BindingContext
;
/**
* Represent the result of the invocation of a handler or a handler method.
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/HandlerMethodArgumentResolver.java
浏览文件 @
f0be79e0
/*
* Copyright 2002-201
5
the original author or authors.
* Copyright 2002-201
6
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.
...
...
@@ -19,9 +19,9 @@ package org.springframework.web.reactive.result.method;
import
reactor.core.publisher.Mono
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
/**
* Strategy interface for resolving method parameters into argument values in
* the context of a given request.
...
...
@@ -31,7 +31,6 @@ import org.springframework.web.server.ServerWebExchange;
*/
public
interface
HandlerMethodArgumentResolver
{
boolean
supportsParameter
(
MethodParameter
parameter
);
/**
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java
浏览文件 @
f0be79e0
...
...
@@ -36,11 +36,12 @@ import org.springframework.util.ClassUtils;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.HandlerResult
;
import
org.springframework.web.server.ServerWebExchange
;
/**
* A sub
-
class of {@link HandlerMethod} that can resolve method arguments from
* A subclass of {@link HandlerMethod} that can resolve method arguments from
* a {@link ServerWebExchange} and use that to invoke the underlying method.
*
* @author Rossen Stoyanchev
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncHandlerMethodArgumentResolver.java
浏览文件 @
f0be79e0
/*
* Copyright 2002-201
5
the original author or authors.
* Copyright 2002-201
6
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,9 +21,9 @@ import java.util.Optional;
import
reactor.core.publisher.Mono
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
/**
* An extension of {@link HandlerMethodArgumentResolver} for implementations
* that are synchronous in nature and do not block to resolve values.
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/SyncInvocableHandlerMethod.java
浏览文件 @
f0be79e0
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method
;
import
java.lang.reflect.Method
;
...
...
@@ -21,6 +22,7 @@ import java.util.List;
import
org.springframework.util.Assert
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.HandlerResult
;
import
org.springframework.web.server.ServerWebExchange
;
...
...
@@ -35,7 +37,6 @@ import org.springframework.web.server.ServerWebExchange;
*/
public
class
SyncInvocableHandlerMethod
extends
InvocableHandlerMethod
{
public
SyncInvocableHandlerMethod
(
HandlerMethod
handlerMethod
)
{
super
(
handlerMethod
);
}
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java
浏览文件 @
f0be79e0
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method.annotation
;
import
java.lang.annotation.Annotation
;
...
...
@@ -38,12 +39,12 @@ import org.springframework.http.server.reactive.ServerHttpResponse;
import
org.springframework.util.Assert
;
import
org.springframework.validation.Validator
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.WebExchangeBindException
;
import
org.springframework.web.bind.WebExchangeDataBinder
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.ServerWebInputException
;
import
org.springframework.web.server.UnsupportedMediaTypeStatusException
;
import
org.springframework.web.bind.WebExchangeBindException
;
/**
* Abstract base class for argument resolvers that resolve method arguments
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueArgumentResolver.java
浏览文件 @
f0be79e0
...
...
@@ -30,7 +30,7 @@ import org.springframework.core.MethodParameter;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.annotation.ValueConstants
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver
;
import
org.springframework.web.server.ServerErrorException
;
import
org.springframework.web.server.ServerWebExchange
;
...
...
@@ -40,6 +40,7 @@ import org.springframework.web.server.ServerWebInputException;
* Abstract base class for resolving method arguments from a named value.
* Request parameters, request headers, and path variables are examples of named
* values. Each may have a name, a required flag, and a default value.
*
* <p>Subclasses define how to do the following:
* <ul>
* <li>Obtain named value information for a method parameter
...
...
@@ -47,6 +48,7 @@ import org.springframework.web.server.ServerWebInputException;
* <li>Handle missing argument values when argument values are required
* <li>Optionally handle a resolved value
* </ul>
*
* <p>A default value string can contain ${...} placeholders and Spring Expression
* Language #{...} expressions. For this to work a
* {@link ConfigurableBeanFactory} must be supplied to the class constructor.
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractNamedValueSyncArgumentResolver.java
浏览文件 @
f0be79e0
...
...
@@ -22,7 +22,7 @@ import reactor.core.publisher.Mono;
import
org.springframework.beans.factory.config.ConfigurableBeanFactory
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver
;
import
org.springframework.web.server.ServerWebExchange
;
...
...
@@ -38,7 +38,6 @@ import org.springframework.web.server.ServerWebExchange;
public
abstract
class
AbstractNamedValueSyncArgumentResolver
extends
AbstractNamedValueArgumentResolver
implements
SyncHandlerMethodArgumentResolver
{
public
AbstractNamedValueSyncArgumentResolver
(
ConfigurableBeanFactory
beanFactory
)
{
super
(
beanFactory
);
}
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactory.java
浏览文件 @
f0be79e0
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method.annotation
;
import
java.lang.reflect.Method
;
...
...
@@ -33,8 +34,8 @@ import org.springframework.util.StringUtils;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.support.WebBindingInitializer
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.HandlerResult
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver
;
import
org.springframework.web.reactive.result.method.InvocableHandlerMethod
;
import
org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver
;
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolver.java
浏览文件 @
f0be79e0
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method.annotation
;
import
reactor.core.publisher.Mono
;
...
...
@@ -27,7 +28,7 @@ import org.springframework.util.StringUtils;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.Errors
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver
;
import
org.springframework.web.server.ServerWebExchange
;
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolver.java
浏览文件 @
f0be79e0
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method.annotation
;
import
java.util.List
;
...
...
@@ -28,7 +29,7 @@ import org.springframework.http.RequestEntity;
import
org.springframework.http.codec.HttpMessageReader
;
import
org.springframework.http.server.reactive.ServerHttpRequest
;
import
org.springframework.validation.Validator
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver
;
import
org.springframework.web.server.ServerWebExchange
;
...
...
@@ -43,7 +44,6 @@ import org.springframework.web.server.ServerWebExchange;
public
class
HttpEntityArgumentResolver
extends
AbstractMessageReaderArgumentResolver
implements
HandlerMethodArgumentResolver
{
/**
* Constructor with {@link HttpMessageReader}'s and a {@link Validator}.
* @param readers readers for de-serializing the request body with
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContext.java
浏览文件 @
f0be79e0
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method.annotation
;
import
java.util.Arrays
;
...
...
@@ -24,8 +25,8 @@ import org.springframework.web.bind.WebExchangeDataBinder;
import
org.springframework.web.bind.annotation.InitBinder
;
import
org.springframework.web.bind.support.WebBindingInitializer
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.HandlerResult
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.reactive.result.method.SyncInvocableHandlerMethod
;
import
org.springframework.web.server.ServerWebExchange
;
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelArgumentResolver.java
浏览文件 @
f0be79e0
...
...
@@ -13,13 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method.annotation
;
import
java.util.Optional
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.ui.Model
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver
;
import
org.springframework.web.server.ServerWebExchange
;
...
...
@@ -31,7 +32,6 @@ import org.springframework.web.server.ServerWebExchange;
*/
public
class
ModelArgumentResolver
implements
SyncHandlerMethodArgumentResolver
{
@Override
public
boolean
supportsParameter
(
MethodParameter
parameter
)
{
return
Model
.
class
.
isAssignableFrom
(
parameter
.
getParameterType
());
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolver.java
浏览文件 @
f0be79e0
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method.annotation
;
import
java.lang.annotation.Annotation
;
...
...
@@ -37,7 +38,7 @@ import org.springframework.validation.annotation.Validated;
import
org.springframework.web.bind.WebExchangeBindException
;
import
org.springframework.web.bind.WebExchangeDataBinder
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver
;
import
org.springframework.web.server.ServerWebExchange
;
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolver.java
浏览文件 @
f0be79e0
...
...
@@ -23,8 +23,8 @@ import java.util.Optional;
import
org.springframework.core.MethodParameter
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.HandlerMapping
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver
;
import
org.springframework.web.server.ServerWebExchange
;
...
...
@@ -40,7 +40,6 @@ import org.springframework.web.server.ServerWebExchange;
*/
public
class
PathVariableMapMethodArgumentResolver
implements
SyncHandlerMethodArgumentResolver
{
@Override
public
boolean
supportsParameter
(
MethodParameter
parameter
)
{
PathVariable
ann
=
parameter
.
getParameterAnnotation
(
PathVariable
.
class
);
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/PrincipalArgumentResolver.java
浏览文件 @
f0be79e0
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method.annotation
;
import
java.security.Principal
;
...
...
@@ -20,7 +21,7 @@ import java.security.Principal;
import
reactor.core.publisher.Mono
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver
;
import
org.springframework.web.server.ServerWebExchange
;
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolver.java
浏览文件 @
f0be79e0
...
...
@@ -25,7 +25,7 @@ import org.springframework.core.ReactiveAdapterRegistry;
import
org.springframework.http.codec.HttpMessageReader
;
import
org.springframework.validation.Validator
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.ServerWebInputException
;
...
...
@@ -47,7 +47,6 @@ import org.springframework.web.server.ServerWebInputException;
public
class
RequestBodyArgumentResolver
extends
AbstractMessageReaderArgumentResolver
implements
HandlerMethodArgumentResolver
{
/**
* Constructor with {@link HttpMessageReader}'s and a {@link Validator}.
* @param readers readers for de-serializing the request body with
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMapMethodArgumentResolver.java
浏览文件 @
f0be79e0
...
...
@@ -23,7 +23,7 @@ import org.springframework.core.MethodParameter;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver
;
import
org.springframework.web.server.ServerWebExchange
;
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerAdapter.java
浏览文件 @
f0be79e0
...
...
@@ -47,9 +47,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.support.WebBindingInitializer
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.method.annotation.ExceptionHandlerMethodResolver
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.HandlerAdapter
;
import
org.springframework.web.reactive.HandlerResult
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver
;
import
org.springframework.web.reactive.result.method.InvocableHandlerMethod
;
import
org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver
;
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolver.java
浏览文件 @
f0be79e0
...
...
@@ -23,7 +23,7 @@ import org.springframework.core.MethodParameter;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver
;
import
org.springframework.web.server.ServerWebExchange
;
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolver.java
浏览文件 @
f0be79e0
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method.annotation
;
import
java.util.Optional
;
...
...
@@ -21,7 +22,7 @@ import org.springframework.core.MethodParameter;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.server.reactive.ServerHttpRequest
;
import
org.springframework.http.server.reactive.ServerHttpResponse
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver
;
import
org.springframework.web.server.ServerWebExchange
;
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/WebSessionArgumentResolver.java
浏览文件 @
f0be79e0
...
...
@@ -13,19 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method.annotation
;
import
java.util.Optional
;
package
org.springframework.web.reactive.result.method.annotation
;
import
reactor.core.publisher.Mono
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.server.reactive.ServerHttpRequest
;
import
org.springframework.http.server.reactive.ServerHttpResponse
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver
;
import
org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.WebSession
;
...
...
spring-web-reactive/src/main/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandler.java
浏览文件 @
f0be79e0
...
...
@@ -42,11 +42,11 @@ import org.springframework.util.StringUtils;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.WebExchangeDataBinder
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.HandlerResult
;
import
org.springframework.web.reactive.HandlerResultHandler
;
import
org.springframework.web.reactive.accept.RequestedContentTypeResolver
;
import
org.springframework.web.reactive.result.AbstractHandlerResultHandler
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.server.NotAcceptableStatusException
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.util.HttpRequestPathHelper
;
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java
浏览文件 @
f0be79e0
...
...
@@ -27,6 +27,7 @@ import reactor.test.StepVerifier;
import
org.springframework.http.HttpMethod
;
import
org.springframework.mock.http.server.reactive.test.MockServerHttpRequest
;
import
org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.HandlerResult
;
import
org.springframework.web.reactive.result.ResolvableMethod
;
import
org.springframework.web.server.ServerWebExchange
;
...
...
@@ -36,6 +37,7 @@ import org.springframework.web.server.session.MockWebSessionManager;
import
static
org
.
hamcrest
.
Matchers
.*;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
mockito
.
Mockito
.
any
;
import
static
org
.
mockito
.
Mockito
.*;
/**
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java
浏览文件 @
f0be79e0
...
...
@@ -47,10 +47,11 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.HandlerMapping
;
import
org.springframework.web.reactive.HandlerResult
;
import
org.springframework.web.reactive.result.ResolvableMethod
;
import
org.springframework.web.reactive.result.method.RequestMappingInfo.
BuilderConfiguration
;
import
org.springframework.web.reactive.result.method.RequestMappingInfo.
*
;
import
org.springframework.web.server.MethodNotAllowedException
;
import
org.springframework.web.server.NotAcceptableStatusException
;
import
org.springframework.web.server.ServerWebExchange
;
...
...
@@ -61,16 +62,10 @@ import org.springframework.web.server.session.MockWebSessionManager;
import
org.springframework.web.server.session.WebSessionManager
;
import
org.springframework.web.util.HttpRequestPathHelper
;
import
static
org
.
hamcrest
.
CoreMatchers
.
containsString
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
springframework
.
web
.
bind
.
annotation
.
RequestMethod
.
GET
;
import
static
org
.
springframework
.
web
.
bind
.
annotation
.
RequestMethod
.
HEAD
;
import
static
org
.
springframework
.
web
.
bind
.
annotation
.
RequestMethod
.
OPTIONS
;
import
static
org
.
springframework
.
web
.
reactive
.
result
.
method
.
RequestMappingInfo
.
paths
;
import
static
org
.
hamcrest
.
CoreMatchers
.*;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
springframework
.
web
.
bind
.
annotation
.
RequestMethod
.*;
import
static
org
.
springframework
.
web
.
reactive
.
result
.
method
.
RequestMappingInfo
.*;
/**
* Unit tests for {@link RequestMappingInfoHandlerMapping}.
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/BindingContextFactoryTests.java
浏览文件 @
f0be79e0
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method.annotation
;
import
java.util.Collections
;
...
...
@@ -36,17 +37,16 @@ import org.springframework.web.bind.annotation.InitBinder;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.config.WebReactiveConfigurationSupport
;
import
org.springframework.web.reactive.result.ResolvableMethod
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
import
org.springframework.web.server.session.DefaultWebSessionManager
;
import
org.springframework.web.server.session.WebSessionManager
;
import
static
org
.
junit
.
Assert
.
assertArrayEquals
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
mockito
.
Mockito
.*;
/**
* Unit tests for {@link BindingContextFactory}.
...
...
@@ -77,7 +77,6 @@ public class BindingContextFactoryTests {
@SuppressWarnings
(
"unchecked"
)
@Test
public
void
basic
()
throws
Exception
{
Validator
validator
=
mock
(
Validator
.
class
);
TestController
controller
=
new
TestController
(
validator
);
...
...
@@ -117,12 +116,10 @@ public class BindingContextFactoryTests {
private
Validator
[]
validators
;
public
TestController
(
Validator
...
validators
)
{
this
.
validators
=
validators
;
}
@InitBinder
public
void
initDataBinder
(
WebDataBinder
dataBinder
)
{
if
(!
ObjectUtils
.
isEmpty
(
this
.
validators
))
{
...
...
@@ -161,6 +158,7 @@ public class BindingContextFactoryTests {
public
void
handle
()
{}
}
private
static
class
TestBean
{
private
final
String
name
;
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CookieValueMethodArgumentResolverTests.java
浏览文件 @
f0be79e0
...
...
@@ -32,16 +32,14 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
import
org.springframework.mock.http.server.reactive.test.MockServerHttpRequest
;
import
org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.ServerWebInputException
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
import
org.springframework.web.server.session.MockWebSessionManager
;
import
org.springframework.web.server.session.WebSessionManager
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.*;
/**
* Test fixture with {@link CookieValueMethodArgumentResolver}.
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsArgumentResolverTests.java
浏览文件 @
f0be79e0
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method.annotation
;
import
org.junit.Before
;
...
...
@@ -30,8 +31,8 @@ import org.springframework.validation.BindingResult;
import
org.springframework.validation.Errors
;
import
org.springframework.web.bind.WebExchangeDataBinder
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.ResolvableMethod
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
import
org.springframework.web.server.session.MockWebSessionManager
;
...
...
@@ -40,11 +41,11 @@ import org.springframework.web.server.session.WebSessionManager;
import
static
junit
.
framework
.
TestCase
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertSame
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
springframework
.
core
.
ResolvableType
.
forClass
;
import
static
org
.
springframework
.
core
.
ResolvableType
.
forClassWithGenerics
;
import
static
org
.
springframework
.
core
.
ResolvableType
.*;
/**
* Unit tests for {@link ErrorsMethodArgumentResolver}.
*
* @author Rossen Stoyanchev
*/
public
class
ErrorsArgumentResolverTests
{
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ExpressionValueMethodArgumentResolverTests.java
浏览文件 @
f0be79e0
...
...
@@ -29,15 +29,13 @@ import org.springframework.http.HttpMethod;
import
org.springframework.http.server.reactive.ServerHttpRequest
;
import
org.springframework.mock.http.server.reactive.test.MockServerHttpRequest
;
import
org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
import
org.springframework.web.server.session.MockWebSessionManager
;
import
org.springframework.web.server.session.WebSessionManager
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.*;
/**
* Unit tests for {@link ExpressionValueMethodArgumentResolver}.
...
...
@@ -96,8 +94,7 @@ public class ExpressionValueMethodArgumentResolverTests {
@SuppressWarnings
(
"unused"
)
public
void
params
(
@Value
(
"#{systemProperties.systemProperty}"
)
int
param1
,
String
notSupported
)
{
public
void
params
(
@Value
(
"#{systemProperties.systemProperty}"
)
int
param1
,
String
notSupported
)
{
}
}
\ No newline at end of file
}
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/HttpEntityArgumentResolverTests.java
浏览文件 @
f0be79e0
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method.annotation
;
import
java.nio.ByteBuffer
;
...
...
@@ -46,19 +47,15 @@ import org.springframework.http.codec.DecoderHttpMessageReader;
import
org.springframework.http.codec.HttpMessageReader
;
import
org.springframework.mock.http.server.reactive.test.MockServerHttpRequest
;
import
org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.ResolvableMethod
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.ServerWebInputException
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
import
org.springframework.web.server.session.MockWebSessionManager
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
springframework
.
core
.
ResolvableType
.
forClassWithGenerics
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
springframework
.
core
.
ResolvableType
.*;
/**
* Unit tests for {@link HttpEntityArgumentResolver}.When adding a test also
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/InitBinderBindingContextTests.java
浏览文件 @
f0be79e0
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method.annotation
;
import
java.lang.reflect.Method
;
...
...
@@ -31,18 +32,14 @@ import org.springframework.web.bind.WebDataBinder;
import
org.springframework.web.bind.annotation.InitBinder
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.support.ConfigurableWebBindingInitializer
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver
;
import
org.springframework.web.reactive.result.method.SyncInvocableHandlerMethod
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
import
org.springframework.web.server.session.DefaultWebSessionManager
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertSame
;
import
static
org
.
junit
.
Assert
.*;
/**
* Unit tests for {@link InitBinderBindingContext}.
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/MessageReaderArgumentResolverTests.java
浏览文件 @
f0be79e0
...
...
@@ -52,23 +52,20 @@ import org.springframework.validation.Validator;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.support.ConfigurableWebBindingInitializer
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.ResolvableMethod
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.ServerWebInputException
;
import
org.springframework.web.server.UnsupportedMediaTypeStatusException
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
import
org.springframework.web.server.session.MockWebSessionManager
;
import
static
org
.
junit
.
Assert
.
assertArrayEquals
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
springframework
.
core
.
ResolvableType
.
forClass
;
import
static
org
.
springframework
.
core
.
ResolvableType
.
forClassWithGenerics
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
springframework
.
core
.
ResolvableType
.*;
/**
* Unit tests for {@link AbstractMessageReaderArgumentResolver}.
*
* @author Rossen Stoyanchev
*/
public
class
MessageReaderArgumentResolverTests
{
...
...
@@ -266,7 +263,8 @@ public class MessageReaderArgumentResolverTests {
assertArrayEquals
(
new
TestBean
[]
{
new
TestBean
(
"f1"
,
"b1"
),
new
TestBean
(
"f2"
,
"b2"
)},
value
);
}
@Test
@SuppressWarnings
(
"unchecked"
)
@Test
@SuppressWarnings
(
"unchecked"
)
public
void
validateMonoTestBean
()
throws
Exception
{
String
body
=
"{\"bar\":\"b1\"}"
;
ResolvableType
type
=
forClassWithGenerics
(
Mono
.
class
,
TestBean
.
class
);
...
...
@@ -276,7 +274,8 @@ public class MessageReaderArgumentResolverTests {
StepVerifier
.
create
(
mono
).
expectNextCount
(
0
).
expectError
(
ServerWebInputException
.
class
).
verify
();
}
@Test
@SuppressWarnings
(
"unchecked"
)
@Test
@SuppressWarnings
(
"unchecked"
)
public
void
validateFluxTestBean
()
throws
Exception
{
String
body
=
"[{\"bar\":\"b1\",\"foo\":\"f1\"},{\"bar\":\"b2\"}]"
;
ResolvableType
type
=
forClassWithGenerics
(
Flux
.
class
,
TestBean
.
class
);
...
...
@@ -289,7 +288,7 @@ public class MessageReaderArgumentResolverTests {
.
verify
();
}
@Test
// SPR-9964
@Test
// SPR-9964
public
void
parameterizedMethodArgument
()
throws
Exception
{
Method
method
=
AbstractParameterizedController
.
class
.
getMethod
(
"handleDto"
,
Identifiable
.
class
);
HandlerMethod
handlerMethod
=
new
HandlerMethod
(
new
ConcreteParameterizedController
(),
method
);
...
...
@@ -337,7 +336,8 @@ public class MessageReaderArgumentResolverTests {
List
<
TestBean
>
list
,
Mono
<
List
<
TestBean
>>
monoList
,
Set
<
TestBean
>
set
,
TestBean
[]
array
)
{}
TestBean
[]
array
)
{
}
@XmlRootElement
...
...
@@ -395,6 +395,7 @@ public class MessageReaderArgumentResolverTests {
}
}
private
static
class
TestBeanValidator
implements
Validator
{
@Override
...
...
@@ -411,15 +412,18 @@ public class MessageReaderArgumentResolverTests {
}
}
private
static
abstract
class
AbstractParameterizedController
<
DTO
extends
Identifiable
>
{
@SuppressWarnings
(
"unused"
)
public
void
handleDto
(
DTO
dto
)
{}
}
private
static
class
ConcreteParameterizedController
extends
AbstractParameterizedController
<
SimpleBean
>
{
}
private
interface
Identifiable
extends
Serializable
{
Long
getId
();
...
...
@@ -427,6 +431,7 @@ public class MessageReaderArgumentResolverTests {
void
setId
(
Long
id
);
}
@SuppressWarnings
({
"serial"
})
private
static
class
SimpleBean
implements
Identifiable
{
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolverTests.java
浏览文件 @
f0be79e0
...
...
@@ -39,8 +39,8 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import
org.springframework.web.bind.WebExchangeBindException
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.support.ConfigurableWebBindingInitializer
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.ResolvableMethod
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
...
...
@@ -51,9 +51,8 @@ import static org.junit.Assert.assertEquals;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertSame
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
springframework
.
core
.
ResolvableType
.
forClass
;
import
static
org
.
springframework
.
core
.
ResolvableType
.
forClassWithGenerics
;
import
static
org
.
springframework
.
util
.
Assert
.
isTrue
;
import
static
org
.
springframework
.
core
.
ResolvableType
.*;
import
static
org
.
springframework
.
util
.
Assert
.*;
/**
...
...
@@ -296,6 +295,18 @@ public class ModelAttributeMethodArgumentResolverTests {
}
@SuppressWarnings
(
"unused"
)
void
handle
(
@ModelAttribute
@Validated
Foo
foo
,
@ModelAttribute
@Validated
Mono
<
Foo
>
mono
,
@ModelAttribute
@Validated
Single
<
Foo
>
single
,
Foo
fooNotAnnotated
,
String
stringNotAnnotated
,
Mono
<
Foo
>
monoNotAnnotated
,
Mono
<
String
>
monoStringNotAnnotated
)
{
}
private
static
class
Foo
{
private
String
name
;
...
...
@@ -326,14 +337,4 @@ public class ModelAttributeMethodArgumentResolverTests {
}
}
@SuppressWarnings
(
"unused"
)
void
handle
(
@ModelAttribute
@Validated
Foo
foo
,
@ModelAttribute
@Validated
Mono
<
Foo
>
mono
,
@ModelAttribute
@Validated
Single
<
Foo
>
single
,
Foo
fooNotAnnotated
,
String
stringNotAnnotated
,
Mono
<
Foo
>
monoNotAnnotated
,
Mono
<
String
>
monoStringNotAnnotated
)
{}
}
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolverTests.java
浏览文件 @
f0be79e0
...
...
@@ -31,16 +31,14 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
import
org.springframework.mock.http.server.reactive.test.MockServerHttpRequest
;
import
org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.HandlerMapping
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
import
org.springframework.web.server.session.MockWebSessionManager
;
import
org.springframework.web.server.session.WebSessionManager
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.*;
/**
* Unit tests for {@link PathVariableMapMethodArgumentResolver}.
...
...
@@ -72,6 +70,7 @@ public class PathVariableMapMethodArgumentResolverTests {
this
.
paramMapNoAnnot
=
new
MethodParameter
(
method
,
2
);
}
@Test
public
void
supportsParameter
()
{
assertTrue
(
resolver
.
supportsParameter
(
paramMap
));
...
...
@@ -108,4 +107,4 @@ public class PathVariableMapMethodArgumentResolverTests {
Map
<
String
,
String
>
mapWithoutAnnotat
)
{
}
}
\ No newline at end of file
}
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolverTests.java
浏览文件 @
f0be79e0
...
...
@@ -36,17 +36,15 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.support.ConfigurableWebBindingInitializer
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.HandlerMapping
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.server.ServerErrorException
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
import
org.springframework.web.server.session.MockWebSessionManager
;
import
org.springframework.web.server.session.WebSessionManager
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.*;
/**
* Unit tests for {@link PathVariableMethodArgumentResolver}.
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestAttributeMethodArgumentResolverTests.java
浏览文件 @
f0be79e0
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.reactive.result.method.annotation
;
import
java.lang.reflect.Method
;
...
...
@@ -36,23 +37,18 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.web.bind.annotation.RequestAttribute
;
import
org.springframework.web.bind.support.ConfigurableWebBindingInitializer
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.ServerWebInputException
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
import
org.springframework.web.server.session.MockWebSessionManager
;
import
org.springframework.web.server.session.WebSessionManager
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertSame
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.*;
/**
* Unit tests for {@link RequestAttributeMethodArgumentResolver}.
*
* @author Rossen Stoyanchev
*/
public
class
RequestAttributeMethodArgumentResolverTests
{
...
...
@@ -163,6 +159,7 @@ public class RequestAttributeMethodArgumentResolverTests {
String
notSupported
)
{
}
private
static
class
Foo
{
}
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestBodyArgumentResolverTests.java
浏览文件 @
f0be79e0
...
...
@@ -41,20 +41,15 @@ import org.springframework.http.codec.HttpMessageReader;
import
org.springframework.mock.http.server.reactive.test.MockServerHttpRequest
;
import
org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.ResolvableMethod
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.ServerWebInputException
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
import
org.springframework.web.server.session.MockWebSessionManager
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
springframework
.
core
.
ResolvableType
.
forClass
;
import
static
org
.
springframework
.
core
.
ResolvableType
.
forClassWithGenerics
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
springframework
.
core
.
ResolvableType
.*;
/**
* Unit tests for {@link RequestBodyArgumentResolver}. When adding a test also
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolverTests.java
浏览文件 @
f0be79e0
...
...
@@ -39,17 +39,14 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.support.ConfigurableWebBindingInitializer
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.ServerWebInputException
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
import
org.springframework.web.server.session.MockWebSessionManager
;
import
org.springframework.web.server.session.WebSessionManager
;
import
static
org
.
junit
.
Assert
.
assertArrayEquals
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.*;
/**
* Unit tests for {@link RequestHeaderMethodArgumentResolver}.
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java
浏览文件 @
f0be79e0
...
...
@@ -38,18 +38,14 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.support.ConfigurableWebBindingInitializer
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.ServerWebInputException
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
import
org.springframework.web.server.session.MockWebSessionManager
;
import
org.springframework.web.server.session.WebSessionManager
;
import
static
org
.
junit
.
Assert
.
assertArrayEquals
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.*;
/**
* Unit tests for {@link RequestParamMethodArgumentResolver}.
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeArgumentResolverTests.java
浏览文件 @
f0be79e0
...
...
@@ -26,8 +26,8 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
import
org.springframework.http.server.reactive.ServerHttpResponse
;
import
org.springframework.mock.http.server.reactive.test.MockServerHttpRequest
;
import
org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.result.ResolvableMethod
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.WebSession
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java
浏览文件 @
f0be79e0
...
...
@@ -37,7 +37,7 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.web.bind.annotation.SessionAttribute
;
import
org.springframework.web.bind.support.ConfigurableWebBindingInitializer
;
import
org.springframework.web.reactive.
result.method.
BindingContext
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.ServerWebInputException
;
import
org.springframework.web.server.WebSession
;
...
...
spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/ViewResolutionResultHandlerTests.java
浏览文件 @
f0be79e0
...
...
@@ -50,24 +50,23 @@ import org.springframework.ui.ConcurrentModel;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
import
org.springframework.web.reactive.BindingContext
;
import
org.springframework.web.reactive.HandlerResult
;
import
org.springframework.web.reactive.accept.HeaderContentTypeResolver
;
import
org.springframework.web.reactive.accept.RequestedContentTypeResolver
;
import
org.springframework.web.reactive.result.ResolvableMethod
;
import
org.springframework.web.reactive.result.method.BindingContext
;
import
org.springframework.web.server.NotAcceptableStatusException
;
import
org.springframework.web.server.ServerWebExchange
;
import
org.springframework.web.server.adapter.DefaultServerWebExchange
;
import
org.springframework.web.server.session.DefaultWebSessionManager
;
import
org.springframework.web.server.session.WebSessionManager
;
import
static
java
.
nio
.
charset
.
StandardCharsets
.
UTF_8
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
springframework
.
core
.
ResolvableType
.
forClass
;
import
static
org
.
springframework
.
core
.
ResolvableType
.
forClassWithGenerics
;
import
static
org
.
springframework
.
core
.
io
.
buffer
.
support
.
DataBufferTestUtils
.
dumpString
;
import
static
org
.
springframework
.
http
.
MediaType
.
APPLICATION_JSON
;
import
static
java
.
nio
.
charset
.
StandardCharsets
.*;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
mockito
.
Mockito
.*;
import
static
org
.
springframework
.
core
.
ResolvableType
.*;
import
static
org
.
springframework
.
core
.
io
.
buffer
.
support
.
DataBufferTestUtils
.*;
import
static
org
.
springframework
.
http
.
MediaType
.*;
/**
* Unit tests for {@link ViewResolutionResultHandler}.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录