Skip to content

Instantly share code, notes, and snippets.

@basav
Created August 20, 2012 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save basav/3404689 to your computer and use it in GitHub Desktop.
Save basav/3404689 to your computer and use it in GitHub Desktop.
package controllers;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import play.*;
import play.mvc.*;
import views.html.*;
public class Application extends Controller {
public static Result index() {
return ok(index.render("Your new application is ready."));
}
public static Result phones(String phoneId) throws IOException {
File jsonFile = Play.application().getFile("public/phones/"+phoneId);
String json = FileUtils.readFileToString(jsonFile);
return ok(json).as("application/json");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment