Created
August 20, 2012 14:24
-
-
Save basav/3404689 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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