author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Tue, 23 Sep 2014 10:31:03 +0100 | |
changeset 168 | 793ae8926a97 |
parent 161 | a0aebea668f9 |
permissions | -rw-r--r-- |
103
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1 |
package controllers |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2 |
|
161
a0aebea668f9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
105
diff
changeset
|
3 |
import play.api._ |
103
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
4 |
import play.api.mvc._ |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
|
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
6 |
// hello world program: |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
7 |
// just answer the GET request with a string |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
8 |
|
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
9 |
object Application extends Controller { |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
10 |
|
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
11 |
// answering a GET request |
161
a0aebea668f9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
105
diff
changeset
|
12 |
def index = Action { |
a0aebea668f9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
105
diff
changeset
|
13 |
Ok(views.html.index("222Your new application is ready.")) |
a0aebea668f9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
105
diff
changeset
|
14 |
//Ok("Hello World") |
103
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
15 |
} |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
16 |
|
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
17 |
} |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
18 |
|
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
19 |
/* |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
20 |
* HTML can be returned using |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
21 |
* |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
22 |
* Ok("<H1>Hello world!</H1>").as(HTML) |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
23 |
* |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
24 |
*/ |