/** * @deprecated Use {@link Environment#toFullTemplateName(String, String)} instead, as that can throw * {@link MalformedTemplateNameException}, and is on a more logical place anyway. * * @throws IllegalArgumentException * If the {@code baseName} or {@code targetName} is malformed according the {@link TemplateNameFormat} * in use. */ @Deprecated public static String getFullTemplatePath(Environment env, String baseName, String targetName) { try { return env.toFullTemplateName(baseName, targetName); } catch (MalformedTemplateNameException e) { throw new IllegalArgumentException(e.getMessage()); } }
static Template getTemplate(String systemId) throws IOException { Environment env = Environment.getCurrentEnvironment(); String encoding = env.getTemplate().getEncoding(); if (encoding == null) { encoding = env.getConfiguration().getEncoding(env.getLocale()); } String templatePath = env.getTemplate().getName(); int lastSlash = templatePath.lastIndexOf('/'); templatePath = lastSlash == -1 ? "" : templatePath.substring(0, lastSlash + 1); systemId = env.toFullTemplateName(templatePath, systemId); Template raw = env.getConfiguration().getTemplate(systemId, env.getLocale(), encoding, false); return raw; }
/** * @param basePath Maybe {@code null} */ private String resolvePath(String basePath) throws TemplateModelException { try { return env.rootBasedToAbsoluteTemplateName(env.toFullTemplateName(basePath, pathToResolve)); } catch (MalformedTemplateNameException e) { throw new _TemplateModelException(e, "Can't resolve ", new _DelayedJQuote(pathToResolve), "to absolute template name using base ", new _DelayedJQuote(basePath), "; see cause exception"); } }
@Override TemplateElement[] accept(Environment env) throws TemplateException, IOException { final String importedTemplateName = importedTemplateNameExp.evalAndCoerceToPlainText(env); final String fullImportedTemplateName; try { fullImportedTemplateName = env.toFullTemplateName(getTemplate().getName(), importedTemplateName); } catch (MalformedTemplateNameException e) { throw new _MiscTemplateException(e, env, "Malformed template name ", new _DelayedJQuote(e.getTemplateName()), ":\n", e.getMalformednessDescription()); } try { env.importLib(fullImportedTemplateName, targetNsVarName); } catch (IOException e) { throw new _MiscTemplateException(e, env, "Template importing failed (for parameter value ", new _DelayedJQuote(importedTemplateName), "):\n", new _DelayedGetMessage(e)); } return null; }
final String fullIncludedTemplateName; try { fullIncludedTemplateName = env.toFullTemplateName(getTemplate().getName(), includedTemplateName); } catch (MalformedTemplateNameException e) { throw new _MiscTemplateException(e, env,
absTemplateName = env.toFullTemplateName(env.getCurrentTemplate().getName(), templateName); } catch (MalformedTemplateNameException e) { throw new _TemplateModelException(
/** * @deprecated Use {@link Environment#toFullTemplateName(String, String)} instead, as that can throw * {@link MalformedTemplateNameException}, and is on a more logical place anyway. * * @throws IllegalArgumentException * If the {@code baseName} or {@code targetName} is malformed according the {@link TemplateNameFormat} * in use. */ @Deprecated public static String getFullTemplatePath(Environment env, String baseName, String targetName) { try { return env.toFullTemplateName(baseName, targetName); } catch (MalformedTemplateNameException e) { throw new IllegalArgumentException(e.getMessage()); } }
/** * @deprecated Use {@link Environment#toFullTemplateName(String, String)} instead, as that can throw * {@link MalformedTemplateNameException}, and is on a more logical place anyway. * * @throws IllegalArgumentException * If the {@code baseName} or {@code targetName} is malformed according the {@link TemplateNameFormat} * in use. */ @Deprecated public static String getFullTemplatePath(Environment env, String baseName, String targetName) { try { return env.toFullTemplateName(baseName, targetName); } catch (MalformedTemplateNameException e) { throw new IllegalArgumentException(e.getMessage()); } }
static Template getTemplate(String systemId) throws IOException { Environment env = Environment.getCurrentEnvironment(); String encoding = env.getTemplate().getEncoding(); if (encoding == null) { encoding = env.getConfiguration().getEncoding(env.getLocale()); } String templatePath = env.getTemplate().getName(); int lastSlash = templatePath.lastIndexOf('/'); templatePath = lastSlash == -1 ? "" : templatePath.substring(0, lastSlash + 1); systemId = env.toFullTemplateName(templatePath, systemId); Template raw = env.getConfiguration().getTemplate(systemId, env.getLocale(), encoding, false); return raw; }
static Template getTemplate(String systemId) throws IOException { Environment env = Environment.getCurrentEnvironment(); String encoding = env.getTemplate().getEncoding(); if (encoding == null) { encoding = env.getConfiguration().getEncoding(env.getLocale()); } String templatePath = env.getTemplate().getName(); int lastSlash = templatePath.lastIndexOf('/'); templatePath = lastSlash == -1 ? "" : templatePath.substring(0, lastSlash + 1); systemId = env.toFullTemplateName(templatePath, systemId); Template raw = env.getConfiguration().getTemplate(systemId, env.getLocale(), encoding, false); return raw; }
/** * @param basePath Maybe {@code null} */ private String resolvePath(String basePath) throws TemplateModelException { try { return env.rootBasedToAbsoluteTemplateName(env.toFullTemplateName(basePath, pathToResolve)); } catch (MalformedTemplateNameException e) { throw new _TemplateModelException(e, "Can't resolve ", new _DelayedJQuote(pathToResolve), "to absolute template name using base ", new _DelayedJQuote(basePath), "; see cause exception"); } }
/** * @param basePath Maybe {@code null} */ private String resolvePath(String basePath) throws TemplateModelException { try { return env.rootBasedToAbsoluteTemplateName(env.toFullTemplateName(basePath, pathToResolve)); } catch (MalformedTemplateNameException e) { throw new _TemplateModelException(e, "Can't resolve ", new _DelayedJQuote(pathToResolve), "to absolute template name using base ", new _DelayedJQuote(basePath), "; see cause exception"); } }
@Override TemplateElement[] accept(Environment env) throws TemplateException, IOException { final String importedTemplateName = importedTemplateNameExp.evalAndCoerceToPlainText(env); final String fullImportedTemplateName; try { fullImportedTemplateName = env.toFullTemplateName(getTemplate().getName(), importedTemplateName); } catch (MalformedTemplateNameException e) { throw new _MiscTemplateException(e, env, "Malformed template name ", new _DelayedJQuote(e.getTemplateName()), ":\n", e.getMalformednessDescription()); } try { env.importLib(fullImportedTemplateName, targetNsVarName); } catch (IOException e) { throw new _MiscTemplateException(e, env, "Template importing failed (for parameter value ", new _DelayedJQuote(importedTemplateName), "):\n", new _DelayedGetMessage(e)); } return null; }
absTemplateName = env.toFullTemplateName(env.getCurrentTemplate().getName(), templateName); } catch (MalformedTemplateNameException e) { throw new _TemplateModelException(
final String fullIncludedTemplateName; try { fullIncludedTemplateName = env.toFullTemplateName(getTemplate().getName(), includedTemplateName); } catch (MalformedTemplateNameException e) { throw new _MiscTemplateException(e, env,
@Override TemplateElement[] accept(Environment env) throws TemplateException, IOException { final String importedTemplateName = importedTemplateNameExp.evalAndCoerceToPlainText(env); final String fullImportedTemplateName; try { fullImportedTemplateName = env.toFullTemplateName(getTemplate().getName(), importedTemplateName); } catch (MalformedTemplateNameException e) { throw new _MiscTemplateException(e, env, "Malformed template name ", new _DelayedJQuote(e.getTemplateName()), ":\n", e.getMalformednessDescription()); } try { env.importLib(fullImportedTemplateName, targetNsVarName); } catch (IOException e) { throw new _MiscTemplateException(e, env, "Template importing failed (for parameter value ", new _DelayedJQuote(importedTemplateName), "):\n", new _DelayedGetMessage(e)); } return null; }
absTemplateName = env.toFullTemplateName(env.getCurrentTemplate().getName(), templateName); } catch (MalformedTemplateNameException e) { throw new _TemplateModelException(
final String fullIncludedTemplateName; try { fullIncludedTemplateName = env.toFullTemplateName(getTemplate().getName(), includedTemplateName); } catch (MalformedTemplateNameException e) { throw new _MiscTemplateException(e, env,