Updated EWSGI specification (markdown)

This commit is contained in:
seibo
2011-07-12 16:02:30 -07:00
parent e63553555d
commit e1120040bb

View File

@@ -73,37 +73,34 @@ This is the Eiffel application side. Basically one should be able to write:
Result.set_status (Http_not_found) Result.set_status (Http_not_found)
end end
end end
end` end
Or to register handlers for specific URL paths (or regexp based URL path expressions): Or to register handlers for specific URL paths (or regexp based URL path expressions):
class APPLICATION class APPLICATION
inherit inherit
EW_APPLICATION EW_APPLICATION
creation creation
make make
redefine redefine
make make
features feature
make is
make is do
do register_handler (”/hello”, ~hello_world_handler)
register_handler (”/hello”, ~hello_world_handler) -- The default execute feature will dispatch calls to the appropriate handler!
-- The default execute feature will dispatch calls to the appropriate handler! end
end hello_world_handler (env: ENVIRON): RESPONSE is
do
hello_world_handler (env: ENVIRON): RESPONSE is create Result
do if env.path_info = ”/hello” then
create Result Result.set_status (Http_ok)
if env.path_info = ”/hello” then Result.set_header (”Content-Type”, ”text/html; charset=utf-8”)
Result.set_status (Http_ok) Result.put_contents (”<html><body>Hello World</body></html>”)
Result.set_header (”Content-Type”, ”text/html; charset=utf-8”) else
Result.put_contents (”<html><body>Hello World</body></html>”) Result.set_status (Http_notund)
else end
Result.set_status (Http_notund) end
end
end
end
end end
## Specification Details ## Specification Details