Please enable JavaScript.
Coggle requires JavaScript to display documents.
Play (Action (Response (play.api.mvc.Results contains helper wrappers of…
Play
Action
Basically a function of "req to res"
(play.api.mvc.Request => play.api.mvc.Result)
Action
(parse.json)
(
implicit
request => {
Ok("Got request [" + request + "]")
})
OK("some txt")
constructs a 200 OK response with some txt in response body
body parser
Response
play.api.mvc.Results
contains helper wrappers of common response types
TODO : dummy page as not implemented yet
as(content-type) - change content type of result
Request
Routing
conf/routes
GET /clients/:id controllers.Clients.show(id: Long)
GET /clients/:id controllers.Clients.show(id: Long)
GET /files/*name controllers.Application.download(name)
GET /items/$id<[0-9]+> controllers.Items.show(id: Long)
no auto encode/decode for *name, $id<[0-9]+>
Action function search for arguments in URL path or query
Controller
generates Actions
def hello(name: String) = Action {
OK("Hello"+name)
}
Action can access arguments via closure
define as class to use Dependency Injection