nitcorn :: StaticAction :: defaultinit
nitcorn $ StaticAction :: SELF
Type of this instance, automatically specialized in every classnitcorn $ StaticAction :: answer
Prepare aHttpResponse
destined to the client in response to the request
HttpResponse
destined to the client in response to the request
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitcorn :: Action :: defaultinit
nitcorn :: StaticAction :: defaultinit
core :: Object :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: output_class_name
Display class name on stdout (debug only).nitcorn :: Action :: prepare_respond_and_close
Full to arequest
with sending the response and closing of the http_server
# An action that responds by displaying a static html content.
class StaticAction
super Action
redef fun answer(http_request, turi)
do
var response = new HttpResponse(200)
var title = "Hello World from Nitcorn!"
response.body = """
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<title>{{{title}}}</title>
</head>
<body>
<div class="container">
<h1>{{{title}}}</h1>
<p>See also a <a href="/dir/">directory</a>.</p>
</div>
</body>
</html>"""
return response
end
end
lib/nitcorn/examples/src/nitcorn_hello_world.nit:26,1--51,3