diff --git a/library/server/ewsgi/default/nino/default_ewsgi_application.e b/library/server/ewsgi/default/nino/default_ewsgi_application.e index b7dabb28..25f59486 100644 --- a/library/server/ewsgi/default/nino/default_ewsgi_application.e +++ b/library/server/ewsgi/default/nino/default_ewsgi_application.e @@ -13,12 +13,15 @@ feature {NONE} -- Initialization make_and_launch do - print ("Example: start a Nino web server on port " + port_number.out + ", %Nand reply Hello World for any request such as http://localhost:8123/%N") + port_number := 80 + print ("Example: start a Nino web server on port " + port_number.out + ", %Nand reply Hello World for any request such as http://localhost:" + port_number.out + "/%N") (create {NINO_APPLICATION}.make_custom (agent execute, "")).listen (port_number) end - port_number: INTEGER = 80 + port_number: INTEGER +invariant + port_number_valid: port_number > 0 note copyright: "2011-2011, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" diff --git a/library/server/ewsgi/examples/hello_world_with_response/src/hello_world.e b/library/server/ewsgi/examples/hello_world_with_response/src/hello_world.e index 5d574f5c..0e1344c6 100644 --- a/library/server/ewsgi/examples/hello_world_with_response/src/hello_world.e +++ b/library/server/ewsgi/examples/hello_world_with_response/src/hello_world.e @@ -19,7 +19,19 @@ feature -- Response response (request: EWSGI_REQUEST): EWSGI_RESPONSE do - create {HELLO_WORLD_RESPONSE} Result.make + if request.environment.path_info.starts_with ("/streaming/") then + Result := streaming_response (request) + else + create Result.make + Result.set_status (200) + Result.set_header ("Content-Type", "text/html; charset=utf-8") + Result.set_message_body ("
Hello World") + end + end + + streaming_response (request: EWSGI_REQUEST): EWSGI_RESPONSE + do + create {HELLO_WORLD_RESPONSE} Result.make Result.set_status (200) Result.set_header ("Content-Type", "text/html; charset=utf-8") end diff --git a/library/server/ewsgi/examples/hello_world_with_response/src/hello_world_response.e b/library/server/ewsgi/examples/hello_world_with_response/src/hello_world_response.e index 56d64da8..fad48337 100644 --- a/library/server/ewsgi/examples/hello_world_with_response/src/hello_world_response.e +++ b/library/server/ewsgi/examples/hello_world_with_response/src/hello_world_response.e @@ -31,23 +31,26 @@ feature {NONE} -- Entity body local i: INTEGER do - if current_hello >= 100000 then + if current_hello >= 10000 then end_of_blocks := True else if current_hello = 0 then - current_block := "%N" + current_block := "%N" + current_block.append ("Welcome