use of org.mycore.frontend.xeditor.tracker.MCRChangeTracker in project mycore by MyCoRe-Org.
the class MCRDebugTarget method handleSubmission.
@Override
public void handleSubmission(ServletContext context, MCRServletJob job, MCREditorSession session, String parameter) throws Exception {
job.getResponse().setContentType("text/html; charset=UTF-8");
PrintWriter out = job.getResponse().getWriter();
out.println("<html><body>");
Map<String, String[]> parameters = job.getRequest().getParameterMap();
session.getSubmission().setSubmittedValues(parameters);
Document result = session.getEditedXML().clone();
MCRChangeTracker tracker = session.getChangeTracker().clone();
List<Step> steps = new ArrayList<>();
for (String label; (label = tracker.undoLastBreakpoint(result)) != null; ) steps.add(0, new Step(label, result.clone()));
result = session.getEditedXML().clone();
result = MCRChangeTracker.removeChangeTracking(result);
result = session.getXMLCleaner().clean(result);
steps.add(new Step("After cleaning", result));
result = session.getPostProcessor().process(result);
steps.add(new Step("After postprocessing", result));
for (int i = 0; i < steps.size(); i++) {
if (i == steps.size() - 3)
outputParameters(parameters, out);
steps.get(i).output(out);
}
out.println("</body></html>");
out.close();
}
Aggregations