I have overrided the method public Result onError(RequestHeader rh, Throwable t)
, but this class RequestHeader
doesn't seems to have request body saved - API
Anybody knows how to get request body in here?
Simple solution - I overrided public Action<?> onRequest(Request request, Method actionMethod)
where I save RequestBody
which I can use in onError
.
:)
private RequestBody lastBody;
@Override
public Action<?> onRequest(Request request, Method actionMethod) {
lastBody = request.body();
return super.onRequest(request, actionMethod);
}
@Override
public Result onError(RequestHeader rh, Throwable t) {
//here i can get the body
System.out.println(lastBody);
return play.mvc.Results.internalServerError(errorPage.render());
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.