0
私はExceptionMapperExceptionMapperはJAX-RSでEVERRESTでどのように動作しますか?
で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) {
........
}
}
を持っていることを前提としていますか? メソッドgetExceptionMapperを持つクラスApplicationPrivderBinderがあることがわかりました
ロジックですか?
誰がこのメソッドを呼び出しますか?リソースの方法のうちの伝播:ここで(にApiExceptionここで)指定されたタイプの例外場合JAX-RSフレームワークはこれを自動的に呼び出すん
interface ExceptionMapper
everrestとはどのように動作しますか? – user1365697
「everrest」では、SerfJ(http://serfj.sourceforge.net/)を参照しています。 JAX-RSでは例外マッパーが定義されているため、JAX-RS標準を実装しているため、同じように動作します。 – gsl