@Override
protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response)
throws ServletException, IOException {
ReplicationPackageImporter replicationPackageImporter = request
.getResource()
.adaptTo(ReplicationPackageImporter.class);
boolean success = false;
final long start = System.currentTimeMillis();
response.setContentType("text/plain");
response.setCharacterEncoding("utf-8");
InputStream stream = request.getInputStream();
ResourceResolver resourceResolver = request.getResourceResolver();
try {
ReplicationPackage replicationPackage = replicationPackageImporter.importStream(resourceResolver, stream);
if (replicationPackage != null) {
replicationPackage.delete();
} else {
log.warn("cannot import replication package from request {}", request);
response.setStatus(400);