// prepare the response
HtmlResponse htmlResponse = new HtmlResponse();
htmlResponse.setReferer(request.getHeader("referer"));
SlingPostOperation operation = getSlingPostOperation(request);
if (operation == null) {
htmlResponse.setStatus(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Invalid operation specified for POST request");
} else {
final SlingPostProcessor[] processors;
synchronized ( this.delayedPostProcessors ) {
processors = this.cachedPostProcessors;
}
try {
operation.run(request, htmlResponse, processors);
} catch (ResourceNotFoundException rnfe) {
htmlResponse.setStatus(HttpServletResponse.SC_NOT_FOUND,
rnfe.getMessage());
} catch (Throwable throwable) {
log.debug("Exception while handling POST "
+ request.getResource().getPath() + " with "
+ operation.getClass().getName(), throwable);
htmlResponse.setError(throwable);
}
}