author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Mon, 30 Sep 2013 23:57:44 +0100 | |
changeset 105 | 40c51038c9e4 |
parent 103 | bd6e45c7aa8d |
child 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 |
|
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
3 |
import play.api.mvc._ |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
4 |
|
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
// hello world program: |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
6 |
// 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
|
7 |
|
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
8 |
object Application extends Controller { |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
9 |
|
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
10 |
// answering a GET request |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
11 |
val index = Action { request => |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
12 |
|
105
40c51038c9e4
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
103
diff
changeset
|
13 |
Ok("<H1>Hello world!</H1>").as(HTML) |
103
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
14 |
} |
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 |
* HTML can be returned using |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
20 |
* |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
21 |
* Ok("<H1>Hello world!</H1>").as(HTML) |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
22 |
* |
bd6e45c7aa8d
added applications
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
23 |
*/ |