-
Notifications
You must be signed in to change notification settings - Fork 682
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #1095 add marker interface for play controllers
it would allow users to use custom implementations of base controller See #1095
- Loading branch information
Showing
13 changed files
with
361 additions
and
22 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package play.mvc; | ||
|
||
/** | ||
* Marker interface for play controllers | ||
* | ||
* This is the class that your controllers should implement. | ||
* In most cases, you can extend play.mvc.Controller that contains all needed methods for controllers. | ||
*/ | ||
public interface PlayController { | ||
} |
23 changes: 23 additions & 0 deletions
23
samples-and-tests/nonstatic-app/app/controllers/Application.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package controllers; | ||
|
||
import play.mvc.PlayController; | ||
import play.mvc.results.RenderTemplate; | ||
import play.mvc.results.RenderText; | ||
import play.mvc.results.Result; | ||
import play.templates.Template; | ||
import play.templates.TemplateLoader; | ||
|
||
import static java.util.Collections.emptyMap; | ||
|
||
public class Application implements PlayController { | ||
|
||
public Result index() { | ||
Template template = TemplateLoader.load("Application/index.html"); | ||
return new RenderTemplate(template, emptyMap()); | ||
} | ||
|
||
public Result hello() { | ||
return new RenderText("Hello world!"); | ||
} | ||
|
||
} |
4 changes: 4 additions & 0 deletions
4
samples-and-tests/nonstatic-app/app/views/Application/index.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#{extends 'main.html' /} | ||
#{set title:'Home' /} | ||
|
||
<h2>Welcome to the non-static world!</h2> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<title>#{get 'title' /}</title> | ||
<meta charset="${_response_encoding}"> | ||
#{get 'moreStyles' /} | ||
</head> | ||
<body> | ||
#{doLayout /} | ||
#{get 'moreScripts' /} | ||
</body> | ||
</html> |
Oops, something went wrong.