All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ch.mfrey.thymeleaf.extras.cache.CacheDialect Maven / Gradle / Ivy

Go to download

A dialect for Thymeleaf that allows you to do partial page caching. Some parts of our webpage will never change during the lifetime of the application or a usersession, but the part should still be dynamic in the beginning. Working with Thymeleaf 3.0.0+ (3.0.0.RELEASE and its dependencies included)

There is a newer version: 3.0.1
Show newest version
package ch.mfrey.thymeleaf.extras.cache;

import java.util.HashSet;
import java.util.Set;

import org.thymeleaf.dialect.AbstractProcessorDialect;
import org.thymeleaf.processor.IProcessor;
import org.thymeleaf.standard.processor.StandardXmlNsTagProcessor;
import org.thymeleaf.templatemode.TemplateMode;

public class CacheDialect extends AbstractProcessorDialect {

    public static final String DIALECT_NAMESPACE = "http://www.thymeleaf.org/extras/cache";

    public static final String DIALECT_PREFIX = "cache";

    public CacheDialect() {
        super(DIALECT_NAMESPACE, DIALECT_PREFIX, 0);
    }

    /**
     * {@inheritDoc}
     */
    public Set getProcessors(String dialectPrefix) {
        HashSet processors = new HashSet();
        processors.add(new StandardXmlNsTagProcessor(TemplateMode.HTML, dialectPrefix));
        processors.add(new CacheProcessor(TemplateMode.HTML, dialectPrefix));
        processors.add(new CacheAddProcessor(TemplateMode.HTML, dialectPrefix));
        processors.add(new CacheEvictProcessor(TemplateMode.HTML, dialectPrefix));
        return processors;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy