ServiceContext context,
HttpServletRequest request,
HttpServletResponse response)
throws IOException {
ProviderManager manager = context.getProviderManager();
Provider provider = manager.getProvider();
RequestContext requestContext = getRequestContext(context,request);
try {
if (preconditions(provider, requestContext, response)) {
output(response,process(provider, requestContext));
}
} catch (Throwable e) {
logger.error("Error producing output", e);
try {
output(response,new EmptyResponseContext(500));
} catch (Exception ex) {
logger.error("Error outputting error", ex);
response.sendError(500);
}
} finally {
manager.release(provider);
}
}