本文整理汇总了Java中org.rythmengine.RythmEngine类的典型用法代码示例。如果您正苦于以下问题:Java RythmEngine类的具体用法?Java RythmEngine怎么用?Java RythmEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RythmEngine类属于org.rythmengine包,在下文中一共展示了RythmEngine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getInternalEngine
import org.rythmengine.RythmEngine; //导入依赖的package包/类
protected RythmEngine getInternalEngine() throws IOException{
Properties props = ConfigUtils.filterWithPrefix("docx4j.rythm.", "docx4j.rythm.", Docx4jProperties.getProperties(), false);
props.put("engine.mode", Rythm.Mode.valueOf(props.getProperty("engine.mode", "dev")));
props.put("log.enabled", false);
props.put("feature.smart_escape.enabled", false);
props.put("feature.transform.enabled", false);
try {
props.put("home.template", Rythm.class.getResource(props.getProperty("home.template")).toURI().toURL().getFile());
} catch (URISyntaxException e) {
// ignore
props.put("home.tmp", "/");
}
props.put("codegen.dynamic_exp.enabled", true);
props.put("built_in.code_type", "false");
props.put("built_in.transformer", "false");
props.put("engine.file_write", "false");
props.put("codegen.compact.enabled", "false");
return new RythmEngine(props);
}
开发者ID:vindell,项目名称:docx4j-template,代码行数:22,代码来源:WordprocessingMLRythmTemplate.java
示例2: TemplateEngineRythm
import org.rythmengine.RythmEngine; //导入依赖的package包/类
@Inject
public TemplateEngineRythm(Messages messages,
Lang lang,
Logger ninjaLogger,
NinjaExceptionHandler exceptionHandler,
RythmHelper rythmHelper,
TemplateEngineManager templateEngineManager,
NinjaProperties ninjaProperties,
RythmEngine engine) throws Exception {
this.messages = messages;
this.lang = lang;
this.logger = ninjaLogger;
this.exceptionHandler = exceptionHandler;
this.rythmHelper = rythmHelper;
this.engine = engine;
}
开发者ID:ninjaframework,项目名称:ninja-rythm,代码行数:18,代码来源:TemplateEngineRythm.java
示例3: init
import org.rythmengine.RythmEngine; //导入依赖的package包/类
@Override
public final void init(Properties properties) throws Exception {
templateUrl = "templates/rythm.html";
Properties p = new Properties();
p.put("log.enabled", false);
p.put("feature.smart_escape.enabled", false);
p.put("feature.transform.enabled", false);
//p.put("codegen.dynamic_exp.enabled", true);
//p.put("built_in.code_type", "false");
//p.put("built_in.transformer", "false");
//p.put("engine.file_write", "false");
//p.put("codegen.compact.enabled", "false");
//p.put("home.template", "p:/template-engine-benchmarks");
//p.put("home.tmp", "c:\\tmp");
//p.put("engine.mode", Rythm.Mode.dev);
engine = new RythmEngine(p);
}
开发者ID:boilit,项目名称:ebm,代码行数:19,代码来源:Rythm.java
示例4: RythmHtmlRenderer
import org.rythmengine.RythmEngine; //导入依赖的package包/类
public RythmHtmlRenderer() {
templateDir = new File(appConfig.getString("dirs.templates"));
templateExtension = appConfig.getString("app.templates.file-type");
Properties p = new Properties();
p.put("rythm.engine.mode", ApplicationStage.DEV.equals(appStage) ? Rythm.Mode.dev : Rythm.Mode.prod);
p.put("rythm.engine.class_loader.parent", Application.getAppClassLoader());
// p.put("rythm.resource.loader", new TemplateResourceLoader());
p.put("rythm.resource.name.suffix", templateExtension);
if (templateDir.exists()) {
p.put("rythm.home.template", templateDir);
}
File rythmHomeTmp = new File(appConfig.getString("dirs.gen-src"));
if (!rythmHomeTmp.exists() && !rythmHomeTmp.mkdirs()) {
throw new RuntimeException("Failed to create temporary directory for Rythm templates.");
}
p.put("rythm.home.tmp", rythmHomeTmp);
engine = new RythmEngine(p);
}
开发者ID:gzlabs,项目名称:hightide,代码行数:20,代码来源:RythmHtmlRenderer.java
示例5: DefaultRythmAPI
import org.rythmengine.RythmEngine; //导入依赖的package包/类
public DefaultRythmAPI(@NotNull final Chatterbox chatterbox) {
Preconditions.checkNotNull(chatterbox, "chatterbox was null");
final Map<String, Object> config = Maps.newHashMap();
config.put("engine.class_loader.parent.impl", new RythmClassLoader(chatterbox.getClass().getClassLoader(), chatterbox));
config.put("feature.type_inference.enabled", true);
this.rythm = new RythmEngine(config);
}
开发者ID:Chatterbox,项目名称:Chatterbox,代码行数:8,代码来源:DefaultRythmAPI.java
示例6: getEngine
import org.rythmengine.RythmEngine; //导入依赖的package包/类
public RythmEngine getEngine(App app) {
RythmEngine engine = engines.get(app);
if (null == engine) {
RythmEngine newEngine = createEngine(app);
engine = engines.putIfAbsent(app, newEngine);
if (null == engine) {
engine = newEngine;
} else {
newEngine.shutdown();
}
}
return engine;
}
开发者ID:actframework,项目名称:actframework,代码行数:14,代码来源:RythmView.java
示例7: find
import org.rythmengine.RythmEngine; //导入依赖的package包/类
public static RythmTemplate find(RythmEngine engine, String path) {
ITemplateResource resource = engine.resourceManager().getResource(path);
if (!resource.isValid()) {
return null;
} else {
return new RythmTemplate(engine, path);
}
}
开发者ID:actframework,项目名称:actframework,代码行数:9,代码来源:RythmTemplate.java
示例8: render
import org.rythmengine.RythmEngine; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void render(Map model, HttpServletRequest req, HttpServletResponse resp) throws Exception {
String root = req.getSession().getServletContext().getRealPath(ctx.getRootDirectory()) + "/";
File f = new File(root + name + ctx.getSuffix());
resp.setContentType("text/html");
RythmEngine eng = RythmEngineFactory.getEngine(req, ctx.getRootDirectory());
model.put("AppRoot", req.getSession().getServletContext().getContextPath());
String s = eng.render(f, model);
resp.getWriter().write(s);
}
开发者ID:jrop,项目名称:spring-mvc-rythm,代码行数:14,代码来源:SimpleRythmView.java
示例9: getMessage
import org.rythmengine.RythmEngine; //导入依赖的package包/类
@Override
public String getMessage(ITemplate template, String key, Object... args) {
Locale locale = null;
if (args.length > 0) {
Object arg0 = args[0];
if (arg0 instanceof Locale) {
locale = (Locale) arg0;
Object[] args0 = new Object[args.length - 1];
System.arraycopy(args, 1, args0, 0, args.length - 1);
args = args0;
}
}
if (locale == null && template != null) {
locale = (template == null) ? RythmEngine.get().renderSettings.locale() : template.__curLocale();
}
Optional<String> lang = Optional.absent();
if (locale != null) {
// to conform to rfc5646 and BCP 47
lang = Optional.of(locale.toString().replace('_', '-'));
}
Optional<String> i18nMessage = Optional.absent();
i18nMessage = messages.get(key, lang, args);
return i18nMessage.or("");
}
开发者ID:ninjaframework,项目名称:ninja-rythm,代码行数:30,代码来源:TemplateEngineRythmI18nMessageResolver.java
示例10: getMessage
import org.rythmengine.RythmEngine; //导入依赖的package包/类
@Override
public String getMessage(ITemplate template, String key, Object... args) {
Locale locale = null;
if (args.length > 0) {
Object arg0 = args[0];
if (arg0 instanceof Locale) {
locale = (Locale)arg0;
Object[] args0 = new Object[args.length - 1];
System.arraycopy(args, 1, args0, 0, args.length - 1);
args = args0;
}
for (int i = 0; i < args.length; ++i) {
Object arg = args[i];
if (arg instanceof String) {
arg = S.i18n(template, (String) arg);
}
args[i] = arg;
}
}
if (null == locale && null != template) {
locale = null == template ? RythmEngine.get().renderSettings.locale() : template.__curLocale();
}
try {
return msgSrc.getMessage(key, args, locale);
} catch (NoSuchMessageException e) {
return key;
}
}
开发者ID:rythmengine,项目名称:spring-rythm,代码行数:29,代码来源:SpringI18nMessageResolver.java
示例11: autodetectRythmEngine
import org.rythmengine.RythmEngine; //导入依赖的package包/类
protected RythmEngine autodetectRythmEngine() throws BeansException {
try {
RythmHolder rythmHolder = BeanFactoryUtils.beanOfTypeIncludingAncestors(
getApplicationContext(), RythmHolder.class, true, false);
return rythmHolder.getRythmEngine();
} catch (NoSuchBeanDefinitionException ex) {
throw new ApplicationContextException(
"Must define a single RythmHolder bean in this web application context " +
"(may be inherited): RythmConfigurer is the usual implementation. " +
"This bean may be given any name.", ex);
}
}
开发者ID:rythmengine,项目名称:spring-rythm,代码行数:13,代码来源:RythmView.java
示例12: postProcessRythmEngine
import org.rythmengine.RythmEngine; //导入依赖的package包/类
@Override
protected void postProcessRythmEngine(RythmEngine engine) throws IOException, RythmException {
engine.setProperty(CONF_USER_CONTEXT, userContext);
setUserContext(CTX_SERVLET_CONTEXT, ctx);
setUserContext(ServletContext.class.getName(), ctx);
engine.setProperty(CONF_OUTOUT_REQ_PARAMS, outputRequestParameters);
engine.setProperty(CONF_UNDERSCORE_IMPLICIT_VAR_NAME, underscoreImplicitVariableName);
engine.setProperty(CONF_ENABLE_SESSION_MANAGER, enableSessionManager);
engine.setProperty(CONF_ENABLE_USER_AGENT_DETECTOR, enableUserAgentDetector);
if (null != csrfHeaderName) engine.setProperty(CONF_CSRF_HEADER_NAME, csrfHeaderName);
if (null != csrfParamName) engine.setProperty(CONF_CSRF_PARAM_NAME, csrfParamName);
}
开发者ID:rythmengine,项目名称:spring-rythm,代码行数:13,代码来源:RythmConfigurer.java
示例13: start
import org.rythmengine.RythmEngine; //导入依赖的package包/类
@Override
public boolean start() {
engine = new RythmEngine(conf);
engine.registerPropertyAccessor(new ActiveRecordPropAccessor());
Constants c = Config.getConstants();
c.setMainRenderFactory(new IMainRenderFactory() {
@Override
public Render getRender(String view) {
return new RythmRender(view);
}
@Override
public String getViewExtension() {
String ext = engine.conf().resourceNameSuffix();
if (S.empty(ext)) {
ext = ".html";
}
return ext;
}
});
if (conf.containsKey("rythm.i18n.enabled")) {
i18n = Boolean.parseBoolean(conf.get("rythm.i18n.enabled").toString());
if (i18n) {
Config.getInterceptors().add(new LocaleManager());
Object o = conf.get("rythm.i18n.param_name");
if (null != o) {
LocaleManager.setLocaleParamName(o.toString());
}
}
}
instance = this;
return true;
}
开发者ID:rythmengine,项目名称:jfinal-rythm,代码行数:34,代码来源:RythmPlugin.java
示例14: getEngine
import org.rythmengine.RythmEngine; //导入依赖的package包/类
public RythmEngine getEngine() throws IOException {
return engine == null ? getInternalEngine() : engine;
}
开发者ID:vindell,项目名称:docx4j-template,代码行数:4,代码来源:WordprocessingMLRythmTemplate.java
示例15: setEngine
import org.rythmengine.RythmEngine; //导入依赖的package包/类
public void setEngine(RythmEngine engine) {
this.engine = engine;
}
开发者ID:vindell,项目名称:docx4j-template,代码行数:4,代码来源:WordprocessingMLRythmTemplate.java
示例16: getRythmEngine
import org.rythmengine.RythmEngine; //导入依赖的package包/类
@Override
@NotNull
public RythmEngine getRythmEngine() {
return this.rythm;
}
开发者ID:Chatterbox,项目名称:Chatterbox,代码行数:6,代码来源:DefaultRythmAPI.java
示例17: register
import org.rythmengine.RythmEngine; //导入依赖的package包/类
public void register(RythmEngine engine) {
for (JavaTagBase tag : fastTags) {
engine.registerFastTag(tag);
}
}
开发者ID:actframework,项目名称:actframework,代码行数:6,代码来源:Tags.java
示例18: loadInlineTemplate
import org.rythmengine.RythmEngine; //导入依赖的package包/类
@Override
protected Template loadInlineTemplate(String content) {
RythmEngine engine = engines.get(Act.app());
return new RythmTemplate(engine, content, true);
}
开发者ID:actframework,项目名称:actframework,代码行数:6,代码来源:RythmView.java
示例19: loadTemplateFromResource
import org.rythmengine.RythmEngine; //导入依赖的package包/类
private Template loadTemplateFromResource(String resourcePath, App app) {
RythmEngine engine = getEngine(app);
return RythmTemplate.find(engine, resourcePath);
}
开发者ID:actframework,项目名称:actframework,代码行数:5,代码来源:RythmView.java
示例20: RythmTemplate
import org.rythmengine.RythmEngine; //导入依赖的package包/类
public RythmTemplate(RythmEngine engine, String literal) {
this(engine, literal, false);
}
开发者ID:actframework,项目名称:actframework,代码行数:4,代码来源:RythmTemplate.java
注:本文中的org.rythmengine.RythmEngine类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论