new Object[]{TemplateEngine.threadIndex(), templateSpec, context.getLocale()}); new Object[]{TemplateEngine.threadIndex(), templateSpec, context.getLocale()}); new Object[]{ TemplateEngine.threadIndex(), LoggingUtils.loggifyTemplateName(templateSpec.getTemplate()), context.getLocale(), elapsed, elapsedMs, templateSpec, context.getLocale(), elapsed, elapsedMs});
new Object[]{TemplateEngine.threadIndex(), templateSpec, context.getLocale()}); new Object[]{TemplateEngine.threadIndex(), templateSpec, context.getLocale()}); new Object[]{ TemplateEngine.threadIndex(), LoggingUtils.loggifyTemplateName(templateSpec.getTemplate()), context.getLocale(), elapsed, elapsedMs, templateSpec, context.getLocale(), elapsed, elapsedMs});
@Override public Locale getLocale() { return this.context.getLocale(); }
/** {@inheritDoc} */ public MessageResolution resolveMessage(Arguments args, String key, Object[] msgParams) { final Locale locale = args.getContext().getLocale(); String targetMsg = resolveProperties(locale).getProperty(key); if (targetMsg == null) { targetMsg = "<span style=\"color:red\">" + key + " not found</span>"; } else if (msgParams != null && msgParams.length > 0) { targetMsg = new MessageFormat(targetMsg, args.getContext().getLocale()).format(msgParams); } return new MessageResolution(targetMsg); }
/** {@inheritDoc} */ public MessageResolution resolveMessage(Arguments args, String key, Object[] msgParams) { final Locale locale = args.getContext().getLocale(); String targetMsg = resolveProperties(locale).getProperty(key); if (targetMsg == null) { targetMsg = key; } else if (msgParams != null && msgParams.length > 0) { targetMsg = new MessageFormat(targetMsg, args.getContext().getLocale()).format(msgParams); } return new MessageResolution(targetMsg); }
logger.debug("[THYMELEAF][{}] STARTING PROCESS OF TEMPLATE \"{}\" WITH LOCALE {}", new Object[] {TemplateEngine.threadIndex(), templateName, context.getLocale()}); logger.debug("[THYMELEAF][{}] FINISHED PROCESS AND OUTPUT OF TEMPLATE \"{}\" WITH LOCALE {}", new Object[] {TemplateEngine.threadIndex(), templateName, context.getLocale()}); "[THYMELEAF][{}][{}][{}][{}][{}] TEMPLATE \"{}\" WITH LOCALE {} PROCESSED IN {} nanoseconds (approx. {}ms)", new Object[] {TemplateEngine.threadIndex(), templateName, context.getLocale(), elapsed, elapsedMs, templateName, context.getLocale(), elapsed, elapsedMs});
private static Properties loadMessagesForTemplate( final Arguments arguments, final Properties defaultMessages) { Validate.notNull(arguments, "Arguments cannot be null"); Validate.notNull(arguments.getContext().getLocale(), "Locale in context cannot be null"); final String resourceName = arguments.getTemplateResolution().getResourceName(); final IResourceResolver resourceResolver = arguments.getTemplateResolution().getResourceResolver(); final Locale locale = arguments.getContext().getLocale(); final String templateBaseName = getTemplateFileNameBase(resourceName); return MessageResolutionUtils.loadCombinedMessagesFilesFromBaseName( arguments, resourceResolver, templateBaseName, locale, defaultMessages); }
public IEngineContext createEngineContext( final IEngineConfiguration configuration, final TemplateData templateData, final Map<String, Object> templateResolutionAttributes, final IContext context) { Validate.notNull(context, "Context object cannot be null"); final Set<String> variableNames = context.getVariableNames(); if (variableNames == null || variableNames.isEmpty()) { if (context instanceof ISpringWebFluxContext) { final ISpringWebFluxContext srContext = (ISpringWebFluxContext)context; return new SpringWebFluxEngineContext( configuration, templateData, templateResolutionAttributes, srContext.getExchange(), srContext.getLocale(), Collections.EMPTY_MAP); } return new EngineContext( configuration, templateData, templateResolutionAttributes, context.getLocale(), Collections.EMPTY_MAP); } final Map<String,Object> variables = new LinkedHashMap<>(variableNames.size() + 1, 1.0f); for (final String variableName : variableNames) { variables.put(variableName, context.getVariable(variableName)); } if (context instanceof ISpringWebFluxContext) { final ISpringWebFluxContext srContext = (ISpringWebFluxContext)context; return new SpringWebFluxEngineContext( configuration, templateData, templateResolutionAttributes, srContext.getExchange(), srContext.getLocale(), variables); } return new EngineContext( configuration, templateData, templateResolutionAttributes, context.getLocale(), variables); }
TemplateEngine.threadIndex(), throttledProcessor.getProcessorIdentifier(), throttledProcessor.getProcessorIdentifier(), Integer.valueOf(throttledProcessor.getChunkCount()), LoggingUtils.loggifyTemplateName(templateName), context.getLocale()}); TemplateEngine.threadIndex(), throttledProcessor.getProcessorIdentifier(), throttledProcessor.getProcessorIdentifier(), Integer.valueOf(throttledProcessor.getChunkCount()), LoggingUtils.loggifyTemplateName(templateName), context.getLocale(), Integer.valueOf(bytesProduced)}); TemplateEngine.threadIndex(), throttledProcessor.getProcessorIdentifier(), throttledProcessor.getProcessorIdentifier(), LoggingUtils.loggifyTemplateName(templateName), context.getLocale(), Long.valueOf(throttledProcessor.getTotalBytesProduced()), Integer.valueOf(throttledProcessor.getChunkCount() + 1)});
return getAbsentMessageRepresentation(messageKey, arguments.getContext().getLocale());
TemplateEngine.threadIndex(), throttledProcessor.getProcessorIdentifier(), throttledProcessor.getProcessorIdentifier(), Integer.valueOf(throttledProcessor.getChunkCount()), LoggingUtils.loggifyTemplateName(templateName), context.getLocale()}); TemplateEngine.threadIndex(), throttledProcessor.getProcessorIdentifier(), throttledProcessor.getProcessorIdentifier(), Integer.valueOf(throttledProcessor.getChunkCount()), LoggingUtils.loggifyTemplateName(templateName), context.getLocale(), Integer.valueOf(bytesProduced)}); TemplateEngine.threadIndex(), throttledProcessor.getProcessorIdentifier(), throttledProcessor.getProcessorIdentifier(), LoggingUtils.loggifyTemplateName(templateName), context.getLocale(), Long.valueOf(throttledProcessor.getTotalBytesProduced()), Integer.valueOf(throttledProcessor.getChunkCount() + 1)});