类 ValidationFilter
- java.lang.Object
-
- org.apache.dubbo.validation.filter.ValidationFilter
-
- 所有已实现的接口:
BaseFilter
,Filter
@Activate(group={"consumer","provider"}, value="validation", order=10000) public class ValidationFilter extends Object implements Filter
ValidationFilter invoke the validation by finding the rightValidator
instance based on the configured validation attribute value of invoker url before the actual method invocation.e.g. <dubbo:method name="save" validation="jvalidation" /> In the above configuration a validation has been configured of type jvalidation. On invocation of method save dubbo will invoke
To add a new type of validationJValidator
e.g. <dubbo:method name="save" validation="special" /> where "special" is representing a validator for special character.
developer needs to do
1)Implement a SpecialValidation.java class (package name xxx.yyy.zzz) either by implementingValidation
or extendingAbstractValidation
2)Implement a SpecialValidator.java class (package name xxx.yyy.zzz)
3)Add an entry special=xxx.yyy.zzz.SpecialValidation under META-INF folders org.apache.dubbo.validation.Validation file.- 另请参阅:
Validation
,Validator
,Filter
,AbstractValidation
-
-
嵌套类概要
-
从接口继承的嵌套类/接口 org.apache.dubbo.rpc.BaseFilter
BaseFilter.Listener
-
-
构造器概要
构造器 构造器 说明 ValidationFilter()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Result
invoke(Invoker<?> invoker, Invocation invocation)
Perform the validation of before invoking the actual method based on validation attribute value.void
setValidation(Validation validation)
Sets the validation instance for ValidationFilter
-
-
-
方法详细资料
-
setValidation
public void setValidation(Validation validation)
Sets the validation instance for ValidationFilter- 参数:
validation
- Validation instance injected by dubbo framework based on "validation" attribute value.
-
invoke
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException
Perform the validation of before invoking the actual method based on validation attribute value.- 指定者:
invoke
在接口中BaseFilter
- 参数:
invoker
- serviceinvocation
- invocation.- 返回:
- Method invocation result
- 抛出:
RpcException
- Throws RpcException if validation failed or any other runtime exception occurred.
-
-