-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replay-tests: fasttags and gtfasttags on classpath example
- Loading branch information
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
replay-tests/multi-module-app/core/app/hello/fasttags/HelloFromCore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package hello.fasttags; | ||
|
||
import groovy.lang.Closure; | ||
import play.templates.ExecutableTemplate; | ||
import play.templates.FastTags; | ||
import java.io.PrintWriter; | ||
import java.util.Map; | ||
|
||
@FastTags.Namespace("core") | ||
public class HelloFromCore extends FastTags { | ||
|
||
public static void _hello (Map<?, ?> args, Closure<String> body, PrintWriter out, ExecutableTemplate template, int fromLine) { | ||
String name = args.containsKey("name") ? args.get("name").toString() : ""; | ||
if (name.isEmpty()) { | ||
throw new play.exceptions.TagInternalException("name attribute cannot be empty for " + Thread.currentThread().getStackTrace()[1].getMethodName().substring(1) + " tag"); | ||
} | ||
|
||
out.println("Hello, " + name + "!"); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
replay-tests/multi-module-app/core/app/hello/fasttags/HelloFromCoreGT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package hello.fasttags; | ||
|
||
import play.template2.GTContentRenderer; | ||
import play.template2.GTFastTag; | ||
import play.template2.GTJavaBase; | ||
import java.util.Map; | ||
|
||
@GTFastTag.TagNamespace("coreGT") | ||
public class HelloFromCoreGT extends GTFastTag { | ||
public static void tag_hello (GTJavaBase template, Map<String, Object> args, GTContentRenderer content) { | ||
String name = args.containsKey("name") ? args.get("name").toString() : ""; | ||
if (name.isEmpty()) { | ||
throw new play.exceptions.TagInternalException("name attribute cannot be empty for " + Thread.currentThread().getStackTrace()[1].getMethodName().substring(4) + " tag"); | ||
} | ||
|
||
template.out.append("Hello, ").append(name).append("!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters