}
}
ObjectGraph requestGraph = GLOBAL_GRAPH
.plus(new RequestModule(request, response, registeredAction.getPath()))
.plus(REQUEST_MODULES);
Metrics metrics = requestGraph.get(Metrics.class);
try {
requestGraph.inject(action).run();
} catch (HttpErrorException e) {
metrics.setResponseCode(e.getResponseCode());
metrics.addActivity("error"); // Mark this as user error.
response.sendError(e.getResponseCode(), e.getMessage());
} catch (Exception e) {
logger.log(Level.SEVERE, e.getMessage(), e);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Bad request");
return; // Return without exporting metrics.
}
if (registeredAction.isExportingMetrics()) {
metrics.export();
}
}