resourceAsStream = getClass().getClassLoader().getResourceAsStream(proctorSpecClassPath);
} else {
resourceAsStream = getServletContext().getResourceAsStream(proctorSpecPath);
}
final SpecificationResult results = new SpecificationResult();
try {
if (resourceAsStream == null) {
throw new ServletException("No resource stream for proctorSpecPath " + proctorSpecPath);
}
final ProctorSpecification specification = OBJECT_MAPPER.readValue(resourceAsStream, ProctorSpecification.class);
results.setSpecification(specification);
} catch (final Throwable t) {
final String message = "Unable to parse specification in " + proctorSpecPath;
LOGGER.error(message, t);
final StringWriter sw = new StringWriter();
final PrintWriter writer = new PrintWriter(sw);
t.printStackTrace(writer);
results.setError(message);
results.setException(sw.toString());
}
final PrintWriter writer = resp.getWriter();
OBJECT_MAPPER.defaultPrettyPrintingWriter().writeValue(writer, results);