Added Java code to sample extension.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@979 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-06-16 00:09:12 +00:00
parent ffbe7c9c76
commit 1f67cca3eb
4 changed files with 14 additions and 3 deletions

View File

@ -2,5 +2,5 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="module/MOD-INF/classes"/> <classpathentry kind="output" path="sample-extension/MOD-INF/classes"/>
</classpath> </classpath>

View File

@ -36,7 +36,10 @@ function process(path, request, response) {
if (path == "/" || path == "") { if (path == "/" || path == "") {
var context = {}; var context = {};
context.someVar = "foo"; // here's how to pass things into the .vt templates // here's how to pass things into the .vt templates
context.someList = ["Superior","Michigan","Huron","Erie","Ontario"];
context.someString = "foo";
context.someInt = Packages.com.metaweb.gridworks.sampleExtension.SampleUtil.stringArrayLength(context.someList);
send(request, response, "index.vt", context); send(request, response, "index.vt", context);
} }

View File

@ -13,7 +13,7 @@
and styles into the /project page. and styles into the /project page.
</p> </p>
<p>Here is someVar: $someVar.</p> <p>Here is someString: $someString, and someInt: $someInt</p>
<p>Here is a sample list using a veloci-macro:</p> <p>Here is a sample list using a veloci-macro:</p>

View File

@ -0,0 +1,8 @@
package com.metaweb.gridworks.sampleExtension;
public class SampleUtil {
static public int stringArrayLength(String[] a) {
return a.length;
}
}