Skip to content

Instantly share code, notes, and snippets.

@mmurray
Created October 6, 2010 20:26
Show Gist options
  • Select an option

  • Save mmurray/614014 to your computer and use it in GitHub Desktop.

Select an option

Save mmurray/614014 to your computer and use it in GitHub Desktop.
// Application.java
public class Application extends Controller {
protected static void respondWith(Object... args){
try {
render(args);
}catch(TemplateNotFoundException e) {
if(request.format == "json") {
renderJSON(args);
}
}
}
public static void index() {
render();
}
}
// Articles.java
public class Articles extends Application {
public static void index() {
render();
}
public static void create() {
}
public static void save() {
String hello = "world";
respondWith(hello);
}
public static void update() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment