Migrated most of the example and library to new design.
This commit is contained in:
38
library/server/ewsgi/connectors/standalone/dev/app_counter.e
Normal file
38
library/server/ewsgi/connectors/standalone/dev/app_counter.e
Normal file
@@ -0,0 +1,38 @@
|
||||
note
|
||||
description: "Summary description for {APP_COUNTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
APP_COUNTER
|
||||
|
||||
create
|
||||
put
|
||||
|
||||
feature
|
||||
|
||||
item: INTEGER
|
||||
|
||||
put, replace (i: INTEGER)
|
||||
do
|
||||
item := i
|
||||
end
|
||||
|
||||
next_item: INTEGER
|
||||
do
|
||||
Result := item + 1
|
||||
item := Result
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,68 @@
|
||||
note
|
||||
description: "Summary description for {APP_WSF_EXECUTION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
APP_WSF_EXECUTION
|
||||
|
||||
inherit
|
||||
WSF_EXECUTION
|
||||
|
||||
SHARED_EXECUTION_ENVIRONMENT
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute
|
||||
local
|
||||
s: STRING
|
||||
i64: INTEGER_64
|
||||
do
|
||||
s := "Hello Concurrent EWF"
|
||||
s.append (" (counter=")
|
||||
s.append_integer (next_cell_counter_item (counter_cell))
|
||||
s.append (")%N")
|
||||
|
||||
if attached {WSF_STRING} request.query_parameter ("sleep") as p_sleep then
|
||||
if attached p_sleep.value.is_integer then
|
||||
s.append ("sleep for ")
|
||||
i64 := p_sleep.value.to_integer_64 * {INTEGER_64} 1_000_000_000
|
||||
s.append_integer_64 (i64)
|
||||
execution_environment.sleep (i64)
|
||||
end
|
||||
end
|
||||
|
||||
response.set_status_code (200)
|
||||
response.put_header_line ("X-EWF-Dev: v1.0")
|
||||
response.header.put_content_type_text_plain
|
||||
response.header.put_content_length (s.count)
|
||||
|
||||
response.put_string (s)
|
||||
end
|
||||
|
||||
next_cell_counter_item (cl: like counter_cell): INTEGER
|
||||
do
|
||||
Result := cl.next_item
|
||||
end
|
||||
|
||||
counter_cell: separate APP_COUNTER
|
||||
once ("PROCESS")
|
||||
create Result.put (0)
|
||||
end
|
||||
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -0,0 +1,51 @@
|
||||
note
|
||||
description: "[
|
||||
Objects that ...
|
||||
]"
|
||||
author: "$Author$"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
HTTPD_CONNECTOR_DEV
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Initialize `Current'.
|
||||
local
|
||||
conn: WGI_STANDALONE_CONNECTOR [APP_WSF_EXECUTION]
|
||||
do
|
||||
print ("Starting httpd server ...%N")
|
||||
|
||||
create conn.make
|
||||
conn.on_launched_actions.extend (agent on_launched)
|
||||
conn.set_port_number (9090)
|
||||
conn.set_max_concurrent_connections (100)
|
||||
conn.launch
|
||||
end
|
||||
|
||||
on_launched (conn: WGI_STANDALONE_CONNECTOR [WGI_EXECUTION])
|
||||
do
|
||||
print ("Server listening on port " + conn.port.out + "%N")
|
||||
end
|
||||
|
||||
on_stopped (conn: WGI_STANDALONE_CONNECTOR [WGI_EXECUTION])
|
||||
do
|
||||
print ("Server terminated%N")
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
Reference in New Issue
Block a user