0
我想了解JAX-RS的逻辑与ExceptionMapperExceptionMapper如何在EVAX中使用JAX-RS工作?
让我们假设我有类
@Provider
@Singleton
public class MyExceptionMapper implements ExceptionMapper<ApiException> {
/**
* check the exception type and build Response with the status body and the type of the error
*/
@Override
public Response toResponse(ApiException exception) {
........
}
}
如何调用这个类? 我看到有类ApplicationPrivderBinder有方法getExceptionMapper
这是逻辑吗?
谁打电话给这个方法?其中是从
interface ExceptionMapper
它如何与everrest合作? – user1365697
“everrest”是指SerfJ(http://serfj.sourceforge.net/),对不对?它确实实现了JAX-RS标准,所以它的行为方式相同,因为异常映射器是由JAX-RS定义的。 – gsl