/** * Find default status template * * @param statusCode * @return status template */ private StatusTemplate getDefaultStatusTemplate(int statusCode) { String path = statusCode + ".ftl"; String validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, WebScriptResponse.HTML_FORMAT); } path = "status.ftl"; validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, WebScriptResponse.HTML_FORMAT); } throw new WebScriptException("Default status template /status.ftl could not be found"); }
/** * Find default status template * * @param statusCode int * @return status template */ private StatusTemplate getDefaultStatusTemplate(int statusCode) { String path = statusCode + ".ftl"; String validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, WebScriptResponse.HTML_FORMAT); } path = "status.ftl"; validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, WebScriptResponse.HTML_FORMAT); } throw new WebScriptException("Default status template /status.ftl could not be found"); }
/** * Find default status template * * @param statusCode int * @return status template */ private StatusTemplate getDefaultStatusTemplate(int statusCode) { String path = statusCode + ".ftl"; String validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, WebScriptResponse.HTML_FORMAT); } path = "status.ftl"; validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, WebScriptResponse.HTML_FORMAT); } throw new WebScriptException("Default status template /status.ftl could not be found"); }
/** * Render a template (contents as string) * * @param template the template * @param model model * @param writer output writer * @param extension optional template extension type (i.e. ftl, php) */ final protected void renderString(String template, Map<String, Object> model, Writer writer, String extension) { TemplateProcessor processor = container.getTemplateProcessorRegistry().getTemplateProcessorByExtension(extension); if (processor != null) { processor.processString(template, model, writer); } else { throw new WebScriptException("No processor found for extension " + extension); } }
/** * Render a template (contents as string) * * @param template the template * @param model model * @param writer output writer * @param extension optional template extension type (i.e. ftl, php) */ final protected void renderString(String template, Map<String, Object> model, Writer writer, String extension) { TemplateProcessor processor = container.getTemplateProcessorRegistry().getTemplateProcessorByExtension(extension); if (processor != null) { processor.processString(template, model, writer); } else { throw new WebScriptException("No processor found for extension " + extension); } }
/** * Render a template (contents as string) * * @param template the template * @param model model * @param writer output writer * @param extension optional template extension type (i.e. ftl, php) */ final protected void renderString(String template, Map<String, Object> model, Writer writer, String extension) { TemplateProcessor processor = container.getTemplateProcessorRegistry().getTemplateProcessorByExtension(extension); if (processor != null) { processor.processString(template, model, writer); } else { throw new WebScriptException("No processor found for extension " + extension); } }
/** * Find a script specific status template * * @param scriptId String * @param statusCode int * @param format String * @return status template (or null, if not found) */ private StatusTemplate getScriptStatusTemplate(String scriptId, int statusCode, String format) { // look up status code specific status template String validTemplatePath = getContainer().getTemplateProcessorRegistry().findValidTemplatePath(scriptId + "." + format + "." + statusCode); if (validTemplatePath != null) { return new StatusTemplate(scriptId + "." + format + "." + statusCode, format); } // look up general case status template validTemplatePath = getContainer().getTemplateProcessorRegistry().findValidTemplatePath(scriptId + "." + format + ".status"); if (validTemplatePath != null) { return new StatusTemplate(scriptId + "." + format + ".status", format); } return null; }
/** * Find a script specific status template * * @param scriptId * @param statusCode * @param format * @return status template (or null, if not found) */ private StatusTemplate getScriptStatusTemplate(String scriptId, int statusCode, String format) { // look up status code specific status template String validTemplatePath = getContainer().getTemplateProcessorRegistry().findValidTemplatePath(scriptId + "." + format + "." + statusCode); if (validTemplatePath != null) { return new StatusTemplate(scriptId + "." + format + "." + statusCode, format); } // look up general case status template validTemplatePath = getContainer().getTemplateProcessorRegistry().findValidTemplatePath(scriptId + "." + format + ".status"); if (validTemplatePath != null) { return new StatusTemplate(scriptId + "." + format + ".status", format); } return null; }
/** * Find a script specific status template * * @param scriptId String * @param statusCode int * @param format String * @return status template (or null, if not found) */ private StatusTemplate getScriptStatusTemplate(String scriptId, int statusCode, String format) { // look up status code specific status template String validTemplatePath = getContainer().getTemplateProcessorRegistry().findValidTemplatePath(scriptId + "." + format + "." + statusCode); if (validTemplatePath != null) { return new StatusTemplate(scriptId + "." + format + "." + statusCode, format); } // look up general case status template validTemplatePath = getContainer().getTemplateProcessorRegistry().findValidTemplatePath(scriptId + "." + format + ".status"); if (validTemplatePath != null) { return new StatusTemplate(scriptId + "." + format + ".status", format); } return null; }
/** * Find a package specific status template * * @param scriptPath Path * @param statusCode int * @param format String * @return status template (or null, if not found) */ private StatusTemplate getPackageStatusTemplate(Path scriptPath, int statusCode, String format) { while(scriptPath != null) { String path = PathImpl.concatPath(scriptPath.getPath(), format + "." + statusCode + ".ftl"); String validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, format); } path = PathImpl.concatPath(scriptPath.getPath(), format + ".status.ftl"); validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, format); } scriptPath = scriptPath.getParent(); } return null; }
/** * Find a package specific status template * * @param scriptPath Path * @param statusCode int * @param format String * @return status template (or null, if not found) */ private StatusTemplate getPackageStatusTemplate(Path scriptPath, int statusCode, String format) { while(scriptPath != null) { String path = PathImpl.concatPath(scriptPath.getPath(), format + "." + statusCode + ".ftl"); String validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, format); } path = PathImpl.concatPath(scriptPath.getPath(), format + ".status.ftl"); validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, format); } scriptPath = scriptPath.getParent(); } return null; }
/** * Find a package specific status template * * @param scriptPath * @param statusCode * @param format * @return status template (or null, if not found) */ private StatusTemplate getPackageStatusTemplate(Path scriptPath, int statusCode, String format) { while(scriptPath != null) { String path = PathImpl.concatPath(scriptPath.getPath(), format + "." + statusCode + ".ftl"); String validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, format); } path = PathImpl.concatPath(scriptPath.getPath(), format + ".status.ftl"); validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, format); } scriptPath = scriptPath.getParent(); } return null; }
if (debug) start = System.nanoTime(); String validTemplatePath = getContainer().getTemplateProcessorRegistry().findValidTemplatePath(templatePath); if (validTemplatePath != null) TemplateProcessor templateProcessor = container.getTemplateProcessorRegistry().getTemplateProcessor(validTemplatePath); extHandler.setFileBeingProcessed(validTemplatePath); templateProcessor.process(validTemplatePath, model, extModelWriter); String modulePath = container.getTemplateProcessorRegistry().findValidTemplatePath(moduleTemplatePath); if (modulePath != null) TemplateProcessor templateProcessor = getContainer().getTemplateProcessorRegistry().getTemplateProcessor(validTemplatePath); templateProcessor.process(validTemplatePath, model, writer);
if (debug) start = System.nanoTime(); String validTemplatePath = getContainer().getTemplateProcessorRegistry().findValidTemplatePath(templatePath); if (validTemplatePath != null) TemplateProcessor templateProcessor = container.getTemplateProcessorRegistry().getTemplateProcessor(validTemplatePath); extHandler.setFileBeingProcessed(validTemplatePath); templateProcessor.process(validTemplatePath, model, extModelWriter); String modulePath = container.getTemplateProcessorRegistry().findValidTemplatePath(moduleTemplatePath); if (modulePath != null) TemplateProcessor templateProcessor = getContainer().getTemplateProcessorRegistry().getTemplateProcessor(validTemplatePath); templateProcessor.process(validTemplatePath, model, writer);
if (debug) start = System.nanoTime(); String validTemplatePath = getContainer().getTemplateProcessorRegistry().findValidTemplatePath(templatePath); if (validTemplatePath != null) TemplateProcessor templateProcessor = container.getTemplateProcessorRegistry().getTemplateProcessor(validTemplatePath); extHandler.setFileBeingProcessed(validTemplatePath); templateProcessor.process(validTemplatePath, model, extModelWriter); String modulePath = container.getTemplateProcessorRegistry().findValidTemplatePath(moduleTemplatePath); if (modulePath != null) TemplateProcessor templateProcessor = getContainer().getTemplateProcessorRegistry().getTemplateProcessor(validTemplatePath); templateProcessor.process(validTemplatePath, model, writer);