use of com.blade.mvc.http.RawBody in project blade by biezhi.
the class DefaultExceptionHandler method renderPage.
protected void renderPage(Response response, ModelAndView modelAndView) {
var sw = new StringWriter();
try {
WebContext.blade().templateEngine().render(modelAndView, sw);
ByteBuf buffer = Unpooled.wrappedBuffer(sw.toString().getBytes("utf-8"));
FullHttpResponse fullHttpResponse = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.valueOf(response.statusCode()), buffer);
response.body(new RawBody(fullHttpResponse));
} catch (Exception e) {
log.error("Render view error", e);
}
}
Aggregations