Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/heuermh/spark-template
Template routes for Spark web framework
https://github.com/heuermh/spark-template
Last synced: 9 days ago
JSON representation
Template routes for Spark web framework
- Host: GitHub
- URL: https://github.com/heuermh/spark-template
- Owner: heuermh
- License: other
- Created: 2013-02-12T22:00:28.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-05-19T17:39:51.000Z (over 10 years ago)
- Last Synced: 2024-05-02T00:31:47.904Z (6 months ago)
- Language: Java
- Size: 200 KB
- Stars: 6
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
spark-template
==============###@Deprecated
__Note__: This repo is not necessarily up-to-date and compatible with the current release of Spark.
It should be considered deprecated in favor of the sparkling-template module merged into the sparkling
fork of Spark at https://github.com/heuermh/sparkling.####Legacy docs
Template routes for Spark web framework:
```java
get(new VelocityTemplateRoute("/hello/:name") {
@Override
public Object handle(final Request request, final Response response) {
Person person = Person.find(request.params("name"));
return template("hello.wm").render("person", person);
}
});
```To build
$ mvn install
To build velocity example
$ cd velocity-example
$ mvn assembly:assemblyTo run velocity example
$ java -jar target/spark-template-velocity-example-0.9.9.5-SNAPSHOT-jar-with-dependencies.jar
== Spark has ignited ...
>> Listening on 0.0.0.0:4567Then open
http://localhost:4567/hello/foo
in a browser.
To add a new Template engine
- Create a new module
- Add dependency to spark-template
- Add dependency to new template engine
- Extend https://github.com/heuermh/spark-template/blob/master/api/src/main/java/spark/template/TemplateRoute.java
- (optional) Create a new example module