mbknor / gt-engine Goto Github PK
View Code? Open in Web Editor NEWStandalone implementation of the groovy template engine used in Playframework 1.x
Standalone implementation of the groovy template engine used in Playframework 1.x
GTJavaExtensionInvoker uses an old pre-Java5 code from commons-lang's MethodUtils.getMatchingAccessibleMethod to match methods, which doesn't support Java5 features like varargs.
Default play templates call vararg methods properly.
Probably, it would be better to use MethodUtils.getMatchingAccessibleMethod from commons-beanutils or commons-lang3 instead.
I want to add gtengine to the template framework benchmark
So I need to code a simple class that would instantiate a gtengine template engine, give a collection of Item as an input parameter and execute the thing.
Here's an example of code for another template engine
// Some template engine specific code
Properties p = new Properties();
p.put("log.enabled", false);
p.put("feature.smart_escape.enabled", false);
p.put("feature.transform.enabled", false);
// here we go
engine = new RythmEngine(p);
// Parameters
String tmpl = "path/to/my/template.rythm.html" ;
List<Stock> items = ...
OutputStream o1 = ...
// Get the template output in the output stream o1
engine.render(o1, tmpl, items);
o1.close();
Could you help me writing the code for gtengine ?
If you invoke a static method A on a class, and there also exists a JavaExtension method named A, you will get a NoSuchMethodException. This is confirmed.
This works in default play templates:
if you define a local variable and use #{extends 'main.html'/}, then you can use the local variable from inside of main.html
When using fastergt-module, the line number is not shown when you get a "No route found" error.
See stacktrace below.
I believe the problem is that the classname 'play.modules.gtengineplugin' is not seen as "internal" preventing fixStacktrace skipping down to 'at /app/views/mainWithoutCSS.html.(line:64)'
Template execution error (In /app/views/StartController/index.html around line 0)
Execution error occured in template /app/views/StartController/index.html. Exception raised was GTRuntimeException : No route found.
play.exceptions.TemplateExecutionException: No route found
at play.modules.gtengineplugin.GTTemplate.renderGTTemplate(GTTemplate.java:114)
at play.modules.gtengineplugin.GTTemplate.internalGTRender(GTTemplate.java:73)
at play.modules.gtengineplugin.GTTemplate.internalRender(GTTemplate.java:52)
at play.modules.gtengineplugin.GTTemplate.render(GTTemplate.java:124)
at play.mvc.results.RenderTemplate.<init>(RenderTemplate.java:24)
at play.mvc.Controller.renderTemplate(Controller.java:661)
at play.mvc.Controller.renderTemplate(Controller.java:641)
at play.mvc.Controller.render(Controller.java:696)
at controllers.StartController.index(StartController.java:14)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:551)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:502)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
at Invocation.HTTP Request(Play!)
Caused by: play.template2.exceptions.GTRuntimeException: No route found
at play.modules.gtengineplugin.gt_integration.GTGroovyBase1xImpl$ActionBridge.invokeMethod(GTGroovyBase1xImpl.java:159)
at /app/views/mainWithoutCSS.html.(line:64)
at play.template2.GTJavaBase.internalRenderTemplate(GTJavaBase.java:124)
at play.modules.gtengineplugin.gt_integration.GTJavaBase1xImpl.internalRenderTemplate(GTJavaBase1xImpl.java:82)
at play.template2.GTJavaBase.internalRenderTemplate(GTJavaBase.java:139)
at play.modules.gtengineplugin.gt_integration.GTJavaBase1xImpl.internalRenderTemplate(GTJavaBase1xImpl.java:82)
at play.template2.GTJavaBase.internalRenderTemplate(GTJavaBase.java:139)
at play.modules.gtengineplugin.gt_integration.GTJavaBase1xImpl.internalRenderTemplate(GTJavaBase1xImpl.java:82)
at play.template2.GTJavaBase.renderTemplate(GTJavaBase.java:97)
at play.modules.gtengineplugin.GTTemplate.renderGTTemplate(GTTemplate.java:91)
... 14 more
Caused by: play.template2.exceptions.GTRuntimeException: No route found
... 24 more
Caused by: play.exceptions.NoRouteFoundException: No route found
... 24 more
related to mbknor/faster-groovy-templates#13
There was one issue I encountered though:
%{ print 'hello' }%
prints to output stream in play 1.2.3
and with your new version it seems to print to the standard out.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.