programs/Application0.scala
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 01 Oct 2013 13:15:26 +0100
changeset 108 c3b8432718ed
parent 13 2bd3530c30af
permissions -rw-r--r--
added
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
package controllers
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
import play.api.mvc._
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
// hello world program 
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
// just answers the GET request with a string
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
object Application extends Controller {
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
  // answering a GET request
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
  val index = Action { request =>
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
    
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
    Ok("Hello world!")
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
  }  
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
  
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
}
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
/*
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
 * HTML can be returned using
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
 *
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
 * OK("<H1>Hello world!</H1>").as(HTML)
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
 *
2bd3530c30af added programs
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
 */