Ich bin usng GWTP Rest dispath mit ResourceDelegate und ich möchte alle Ausnahmen in Client-REST-Anforderungen abfangen. Meine REST-Backend Rückkehr:GWT-Plattform mit REST-Versand: Holen HTTP-Statuscode aus Ausnahmehandler
- 401 oder 403-Statuscodes, wenn keine Genehmigung/verboten
- 500 für andere Fehler
So habe ich gemeinsam Handler RestDispatchAsyncModule hinzugefügt:
new RestDispatchAsyncModule.Builder().exceptionHandler(MyRestExceptionHandler.class);
MyRestExceptionHandler.java:
public class MyRestExceptionHandler implements ExceptionHandler {
@Override
public Status onFailure(Throwable e) {
if (e instanceof ActionException){
ActionException a = (ActionException)e;
// How to get HTTP status code and response body here?
}
return null;
}
}
Ich habe festgestellt, dass alle REST-Ausnahme Instanzen der ActionException-Klasse sind. Wie kann ich HTTP-Statuscode und HTTP-Antwortkörper in MyRestExceptionHandler erhalten?