/** * Creates a page and sets up the velocity engine to render */ public Page(final HttpServletRequest request, final HttpServletResponse response, final VelocityEngine engine, final String template) { this.request = Utils.nonNull(request); this.response = Utils.nonNull(response); this.engine = Utils.nonNull(engine); this.template = Utils.nonNull(template); this.context = new VelocityContext(); this.context.put("esc", new EscapeTool()); this.context.put("session", request.getSession(true)); this.context.put("context", request.getContextPath()); }
/** * Escapes the characters in a <code>String</code> using java.util.Properties rules for escaping property values. * * @param string the string to escape values, may be null * @return String with escaped values, <code>null</code> if null string input * @see #dumpString(String, boolean) */ public String propertyValue(Object string) { if (string == null) { return null; } return dumpString(String.valueOf(string), false); }
/** * Renders a backslash (\). * @return a backslash (\). * @see #getBackslash() */ public String getB() { return this.getBackslash(); }
/** * Renders a dollar sign ($). * @return a dollar sign ($). * @see #getDollar() */ public String getD() { return this.getDollar(); }
/** * Escapes the characters in a <code>String</code> using java.util.Properties rules for escaping property keys. * * @param string the string to escape values, may be null * @return String with escaped values, <code>null</code> if null string input * @see #dumpString(String, boolean) */ public String propertyKey(Object string) { if (string == null) { return null; } return dumpString(String.valueOf(string), true); }
/** * Gets an instance of the velocity context * * Add the utility instances that are commonly used in many templates. * * @return the instance */ public static VelocityContext getInstance() { final VelocityContext context = new VelocityContext(); context.put("esc", new EscapeTool()); final WebUtils utils = new WebUtils(); context.put("utils", utils); return context; } }
ctx.put("valueSet", theValueSetTm); ctx.put("packageBase", thePackageBase); ctx.put("esc", new EscapeTool());
ctx.put("version", version); ctx.put("package_suffix", packageSuffix); ctx.put("esc", new EscapeTool()); if (BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi()) { ctx.put("resourcePackage", "org.hl7.fhir." + version + ".model");
ctx.put("version", myVersion.replace(".", "")); ctx.put("versionEnumName", determineVersionEnum().name()); ctx.put("esc", new EscapeTool()); ctx.put("isRi", determineVersionEnum().isRi()); ctx.put("package_suffix", packageSuffix);
ctx.put("searchParamsWithoutComposite", (theResource.getSearchParametersWithoutComposite())); ctx.put("includes", (theResource.getIncludes())); ctx.put("esc", new EscapeTool()); ctx.put("isRi", determineVersionEnum().isRi());
ctx.put("version", configuration.getVersion()); ctx.put("package_suffix", configuration.getPackageSuffix()); ctx.put("esc", new EscapeTool());
ctx.put("isRi", BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi()); ctx.put("hash", "#"); ctx.put("esc", new EscapeTool()); if (BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi()) { ctx.put("resourcePackage", "org.hl7.fhir." + version + ".model");
ctx.put("isRi", BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi()); ctx.put("hash", "#"); ctx.put("esc", new EscapeTool()); if (BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi()) { ctx.put("resourcePackage", "org.hl7.fhir." + version + ".model");
public AjaxRequestServiceImpl(Map<String,AjaxAction> objects, VelocityEngine velocityEngine) { this.actions = objects; this.velocityEngine = velocityEngine; this.velocityEscTool = new EscapeTool(); }
public AjaxRequestServiceImpl(Map<String,AjaxAction> objects, VelocityEngine velocityEngine, String urlParameterName) { this.actions = objects; this.velocityEngine = velocityEngine; this.urlParameterName = urlParameterName; this.velocityEscTool = new EscapeTool(); }
private VelocityContext getVelocityContext(MavenProject mavenProject, List<Violation> violations) { VelocityContext context = new VelocityContext(); context.put("project", mavenProject); context.put("violations", violations); context.put("esc", new EscapeTool()); return context; }
private VelocityContext getVelocityContext(HttpServletRequest request, String pageTitle) { final VelocityContext ctx = new VelocityContext(); ctx.put("title", getServletInfo() + " - " + pageTitle); ctx.put("contextPath", request.getContextPath()); ctx.put("cssPath", request.getContextPath() + mountPath + "/benchmark.css"); ctx.put("esc", new EscapeTool()); return ctx; }
/** * Loads the internal {@link #velocityContext} from the * given Map of template objects. * * @param templateObjects Map containing objects to add to the template context. */ private void loadVelocityContext(final Map<String, Object> templateObjects) { if (templateObjects != null) { // copy the templateObjects to the velocityContext for (Map.Entry<String, Object> entry : templateObjects.entrySet()) { this.velocityContext.put(entry.getKey(), entry.getValue()); } } // add velocity tools (Escape tool) this.velocityContext.put("esc", new EscapeTool()); }
protected VelocityContext getVelocityContext( Discovery discovery, List<Action> actions, int version, String filter) { VelocityContext context = new VelocityContext(); ObjectiveCUtil objectiveCUtil = new ObjectiveCUtil(); StringBuilder className = new StringBuilder("LR"); className.append(objectiveCUtil.getServiceClassName(filter)); className.append("_v"); className.append(version); context.put(ACTIONS, actions); context.put(BOOL, ObjectiveCUtil.BOOL); context.put(CLASS_NAME, className.toString()); context.put(DISCOVERY, discovery); context.put(ESCAPE_TOOL, new EscapeTool()); context.put(JSON_OBJECT_WRAPPER, ObjectiveCUtil.LR_JSON_OBJECT_WRAPPER); context.put(LANGUAGE_UTIL, objectiveCUtil); context.put(LR_UPLOAD_DATA, objectiveCUtil.LR_UPLOAD_DATA); context.put(VOID, LanguageUtil.VOID); return context; }
protected VelocityContext getVelocityContext( Discovery discovery, List<Action> actions, String packageName, int version, String filter) { VelocityContext context = new VelocityContext(); JavaUtil javaUtil = new JavaUtil(); StringBuilder sb = new StringBuilder(packageName); sb.append(".v"); sb.append(version); sb.append("."); sb.append(filter); packageName = sb.toString(); String className = javaUtil.getServiceClassName(filter); context.put(BYTE_ARRAY, LanguageUtil.BYTE_ARRAY); context.put(CLASS_NAME, className); context.put(DISCOVERY, discovery); context.put(ACTIONS, excludeMethods(className, actions)); context.put(ESCAPE_TOOL, new EscapeTool()); context.put(UPLOAD_DATA, JavaUtil.UPLOAD_DATA); context.put(INTEGER, JavaUtil.INTEGER); context.put(JSON_OBJECT_WRAPPER, JavaUtil.JSON_OBJECT_WRAPPER); context.put(LANGUAGE_UTIL, javaUtil); context.put(PACKAGE, packageName); context.put(VOID, LanguageUtil.VOID); return context; }