Last active
July 17, 2017 07:55
-
-
Save edgarmueller/cef297f778db73a5887f1a01fae7ec80 to your computer and use it in GitHub Desktop.
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
package controllers; | |
import play.cache.SyncCacheApi; | |
import play.mvc.*; | |
import views.html.*; | |
import javax.inject.Inject; | |
/** | |
* This controller contains an action to handle HTTP requests | |
* to the application's home page. | |
*/ | |
public class HomeController extends Controller { | |
private final views.html.index template; | |
@Inject | |
public HomeController(views.html.index template, SyncCacheApi cacheApi) { | |
this.template = template; | |
cacheApi.set("hello", "hello there!"); | |
} | |
/** | |
* An action that renders an HTML page with a welcome message. | |
* The configuration in the <code>routes</code> file means that | |
* this method will be called when the application receives a | |
* <code>GET</code> request with a path of <code>/</code>. | |
*/ | |
public Result index() { | |
return ok(template.render("Your new application is ready.")); | |
} | |
} |
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
@import play.cache.SyncCacheApi | |
@this(cacheApi: SyncCacheApi) | |
@(message: String) | |
@main("Welcome to Play") { | |
@cacheApi.get[String]("hello") | |
@welcome(message, style = "java") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment