{{"); - writer.write(Integer.toString(code)); - writer.write("}}
"); - writer.write("\nProblem accessing "); - write(writer, uri); - writer.write(". Reason:\n
"); - write(writer, message); - writer.write(""); - writer.write("
json
file that matches the given request.
- *
- * @return The associated data.
- * @throws IOException If the file isn't found.
- * @param filename the filename to read
- */
- private Object json(final String filename) throws IOException {
- try {
- String json = read(filename);
- if (json.trim().startsWith("[")) {
- return mapper.readValue(json, List.class);
- }
- return mapper.readValue(json, Map.class);
- } catch (FileNotFoundException ex) {
- return null;
- }
- }
-
- /**
- * Try to load a yml
file that matches the given request.
- *
- * @return A yaml map.
- * @throws IOException If the file isn't found.
- * @param filename the filename to read
- */
- private Object yml(final String filename) throws IOException {
- try {
- String yml = read(filename);
- Object data = yaml.load(yml);
- return data;
- } catch (FileNotFoundException ex) {
- return null;
- }
- }
-
- /**
- * Construct the filename to parse json data from.
- * @param request the current request
- * @return filename to load json from
- */
- private String jsonFilename(final HttpServletRequest request) {
- return dataFilename(request, ".json");
- }
-
- /**
- * Construct the filename to parse yml data from.
- * @param request the current request
- * @return filename to load yml from
- */
- private String ymlFilename(final HttpServletRequest request) {
- return dataFilename(request, ".yml");
- }
-
- /**
- * Construct the filename to parse data from.
- * @param request the current request
- * @param extension the file extension to use, e.g. ".json"
- * @return filename to load data from
- */
- private String dataFilename(final HttpServletRequest request, final String extension) {
- return removeExtension(dataFile(request)) + extension;
- }
-
- /**
- * Read a file from the servlet context.
- *
- * @param uri The requested file.
- * @return The string content.
- * @throws IOException If the file is not found.
- */
- private String read(final String uri) throws IOException {
- InputStream input = null;
- try {
- input = getServletContext().getResourceAsStream(uri);
- if (input == null) {
- throw new FileNotFoundException(args.dir + uri);
- }
- return IOUtils.toString(input);
- } finally {
- IOUtils.closeQuietly(input);
- }
- }
-
- @Override
- protected void doPost(final HttpServletRequest req,
- final HttpServletResponse resp)
- throws ServletException, IOException {
- doGet(req, resp);
- }
-
-}
diff --git a/handlebars-proto/src/main/resources/error-pages/error.hbs b/handlebars-proto/src/main/resources/error-pages/error.hbs
deleted file mode 100644
index 9d8cd831c..000000000
--- a/handlebars-proto/src/main/resources/error-pages/error.hbs
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-