Package org.thymeleaf.context

Examples of org.thymeleaf.context.Context


            + "    <body>"
            + "        <h1>Hello world!</h1>"
            + "    </body>"
            + "</html>";
        String templateMode = StandardTemplateModeHandlers.HTML5.getTemplateModeName();
        Context context = new Context();
        context.setVariable("greeting", "Hello world!");
        StandardMessageResolver messageResolver = new StandardMessageResolver();
        StaticTemplateExecutor executor = new StaticTemplateExecutor(context, messageResolver, templateMode);
        String result = executor.processTemplateCode(simpleTemplate);
        assertEquals(result, expected);
    }
View Full Code Here


        throw new DataFormatException("No narrative template for class " + theResource.getClass().getCanonicalName());
      }
    }

    try {
      Context context = new Context();
      context.setVariable("resource", theResource);

      String result = myProfileTemplateEngine.process(name, context);

      if (myCleanWhitespace) {
        ourLog.trace("Pre-whitespace cleaning: ", result);
View Full Code Here

        throw new DataFormatException("No title template for class " + theResource.getClass().getCanonicalName());
      }
    }

    try {
      Context context = new Context();
      context.setVariable("resource", theResource);

      String result = myTitleTemplateEngine.process(name, context);

      ourLog.trace("Produced {}", result);
View Full Code Here

      if (value == null) {
        return ProcessorResult.ok();
      }

      Context context = new Context();
      context.setVariable("resource", value);

      String name = null;
      if (value != null) {
        Class<? extends Object> nextClass = value.getClass();
        do {
View Full Code Here

    @Override
    public void renderDocument(final Map<String, Object> model, final String templateName, final Writer writer) throws RenderingException {
        String localeString = config.getString(Keys.THYMELEAF_LOCALE);
        Locale locale = localeString != null ? LocaleUtils.toLocale(localeString) : Locale.getDefault();
        Context context = new Context(locale, wrap(model));
        lock.lock();
        try {
          initializeTemplateEngine();
            @SuppressWarnings("unchecked")
            Map<String, Object> config = (Map<String, Object>) model.get("config");
View Full Code Here

        throw new DataFormatException("No narrative template for class " + theResource.getClass().getCanonicalName());
      }
    }

    try {
      Context context = new Context();
      context.setVariable("resource", theResource);

      String result = myProfileTemplateEngine.process(name, context);

      if (myCleanWhitespace) {
        ourLog.trace("Pre-whitespace cleaning: ", result);
View Full Code Here

        throw new DataFormatException("No title template for class " + theResource.getClass().getCanonicalName());
      }
    }

    try {
      Context context = new Context();
      context.setVariable("resource", theResource);

      String result = myTitleTemplateEngine.process(name, context);

      ourLog.trace("Produced {}", result);
View Full Code Here

      if (value == null) {
        return ProcessorResult.ok();
      }

      Context context = new Context();
      context.setVariable("resource", value);

      String name = null;
      if (value != null) {
        Class<? extends Object> nextClass = value.getClass();
        do {
View Full Code Here

        throw new DataFormatException("No narrative template for class " + theResource.getClass().getCanonicalName());
      }
    }

    try {
      Context context = new Context();
      context.setVariable("resource", theResource);
     
      String result = myProfileTemplateEngine.process(name, context);

      if (myCleanWhitespace) {
        ourLog.trace("Pre-whitespace cleaning: ", result);
View Full Code Here


      theElement.removeAttribute(theAttributeName);
      theElement.clearChildren();

      Context context = new Context();
      context.setVariable("resource", value);
     
      String name = myClassToNarrativeName.get(value.getClass());
      if (name == null) {
        if (myIgnoreMissingTemplates) {
          ourLog.debug("No narrative template available for type: {}", value.getClass());
View Full Code Here

TOP

Related Classes of org.thymeleaf.context.Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.