org.ztemplates.render.script.ZCssProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ztemplates Show documentation
Show all versions of ztemplates Show documentation
java web framework - annotations - pojo - NO XML -
state-free - clean, technology agnostic urls - REST -
invisible to the web-client -
JSP, Velocity, FreeMarker (others pluggable) -
annotations for JavaScript/CSS dependencies - create reusable components
The newest version!
package org.ztemplates.render.script;
import java.util.List;
import org.ztemplates.web.script.css.ZICssPreprocessor;
public class ZCssProcessor implements ZICssProcessor
{
private final String contextPath;
private final String ztemplatesCssUrl;
public ZCssProcessor(String contextPath)
{
super();
this.contextPath = contextPath;
this.ztemplatesCssUrl = "/ztemplates.css?ver=" + System.currentTimeMillis();
}
public String computeHtmlTags(List cssExposed, ZICssPreprocessor preprocessor) throws Exception
{
List preprocessed = preprocessor.preprocessCss(cssExposed);
StringBuffer sb = new StringBuffer();
for (String cssPath : cssExposed)
{
if (contextPath != null && cssPath.startsWith("/"))
{
cssPath = contextPath + cssPath;
}
sb.append("");
sb.append('\n');
}
if (contextPath != null)
{
String path = contextPath + ztemplatesCssUrl;
sb.append("\n");
}
else
{
String path = ztemplatesCssUrl;
sb.append("\n");
}
return sb.toString();
}
}