reqGrid = postToGrid(req, res);
if (reqGrid == null)
return;
// figure out best format to use for response
HGridFormat format = toFormat(req);
// send response
res.setStatus(HttpServletResponse.SC_OK);
if (format.mime.startsWith("text/")) {
res.setCharacterEncoding("UTF-8");
res.setContentType(format.mime + "; charset=utf-8");
}
else
res.setContentType(format.mime);
HGridWriter writer = format.makeWriter(res.getOutputStream());
try {
onService(db, reqGrid, writer);
}
catch (Throwable e) {
writeGrid(writer, HGridBuilder.errToGrid(e));