progs/Application0.scala
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Mon, 07 Oct 2013 17:45:12 +0100
changeset 110 fefd78525434
parent 105 40c51038c9e4
child 161 a0aebea668f9
permissions -rw-r--r--
added
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
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
 */