playframework - Can someone explain what Ok means in play framework? -
i found documentation here not understand class does. (i'm new scala coming java background explanation helps). "200 ok" response mean shown here
a server receives http request message, interprets , responds http response message.
that action play does, receives request message , responds response message.
the first line of response message status line. ok, badrequest, notfound , many more. full status codes can seen here.
so, how play follows:
def a() = action { request => // `request` optional ok("here's content") // badrequest("you're asking wrong") // notfound("you're asking don't have") // etc } action provides request our code block, can interpret request, , produce response. ok line specifies response message has status code of ok. rest of response in parameters , more - e.g., additional response headers using withheaders. play mvc api follows pattern. example, ok.sendfile(new file("myfile.txt")) sends ok status code file content.
Comments
Post a Comment