Resolver

Resolver是解决者的意思,在AndServer中Resolver注解用来标记某个类是ExceptionResolver的子类,并且作为异常解决者参与到AndServer的运行中。

Resolver注解可以添加到多个类,但是只有其中一个添加了Resolver注解的类参与程序运行,具体是哪个要看编译器先扫描到哪个类,因此建议开发者只为一个类添加Resolver注解

示例

@Resolver
public class AppExceptionResolver implements ExceptionResolver {

    @Override
    public void onResolve(HttpRequest request, HttpResponse response, Throwable e) {
    }
}

注意,添加Resolver注解的类必需是ExceptionResolver的子类,否则编译时将不通过。

results matching ""

    No results matching ""