Use recent changes from Nino, to get access to the launched and port information.
Quite useful when launching using port=0 to use a random free port. This is great for testing, this way we can run many tests in the same time without any port blocking.
This commit is contained in:
Submodule ext/server/nino updated: cac126f2f1...cef6f30251
@@ -32,6 +32,20 @@ feature {NONE} -- Implementation
|
|||||||
connector: WGI_NINO_CONNECTOR
|
connector: WGI_NINO_CONNECTOR
|
||||||
-- Web server connector
|
-- Web server connector
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
launched: BOOLEAN
|
||||||
|
-- Server launched?
|
||||||
|
do
|
||||||
|
Result := connector.launched
|
||||||
|
end
|
||||||
|
|
||||||
|
port: INTEGER
|
||||||
|
-- Port listened
|
||||||
|
do
|
||||||
|
Result := connector.port
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Status settings
|
feature -- Status settings
|
||||||
|
|
||||||
configuration: HTTP_SERVER_CONFIGURATION
|
configuration: HTTP_SERVER_CONFIGURATION
|
||||||
|
|||||||
@@ -51,6 +51,31 @@ feature -- Access
|
|||||||
base: detachable STRING
|
base: detachable STRING
|
||||||
-- Root url base
|
-- Root url base
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
launched: BOOLEAN
|
||||||
|
-- Server launched and listening on `port'
|
||||||
|
|
||||||
|
port: INTEGER
|
||||||
|
-- Listening port.
|
||||||
|
--| 0: not launched
|
||||||
|
|
||||||
|
feature -- Element change
|
||||||
|
|
||||||
|
on_launched (a_port: INTEGER)
|
||||||
|
-- Server launched
|
||||||
|
do
|
||||||
|
launched := True
|
||||||
|
port := a_port
|
||||||
|
end
|
||||||
|
|
||||||
|
on_stopped
|
||||||
|
-- Server stopped
|
||||||
|
do
|
||||||
|
launched := False
|
||||||
|
port := 0
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
set_base (b: like base)
|
set_base (b: like base)
|
||||||
@@ -68,6 +93,8 @@ feature -- Server
|
|||||||
local
|
local
|
||||||
l_http_handler : HTTP_HANDLER
|
l_http_handler : HTTP_HANDLER
|
||||||
do
|
do
|
||||||
|
launched := False
|
||||||
|
port := 0
|
||||||
create {WGI_NINO_HANDLER} l_http_handler.make_with_callback (server, "NINO_HANDLER", Current)
|
create {WGI_NINO_HANDLER} l_http_handler.make_with_callback (server, "NINO_HANDLER", Current)
|
||||||
if configuration.is_verbose then
|
if configuration.is_verbose then
|
||||||
if attached base as l_base then
|
if attached base as l_base then
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ class
|
|||||||
|
|
||||||
inherit
|
inherit
|
||||||
HTTP_CONNECTION_HANDLER
|
HTTP_CONNECTION_HANDLER
|
||||||
|
redefine
|
||||||
|
on_launched,
|
||||||
|
on_stopped
|
||||||
|
end
|
||||||
|
|
||||||
create
|
create
|
||||||
make_with_callback
|
make_with_callback
|
||||||
@@ -30,6 +34,20 @@ feature -- Access
|
|||||||
base: detachable STRING
|
base: detachable STRING
|
||||||
-- Root url base
|
-- Root url base
|
||||||
|
|
||||||
|
feature -- Element change
|
||||||
|
|
||||||
|
on_launched (a_port: INTEGER)
|
||||||
|
do
|
||||||
|
Precursor (a_port)
|
||||||
|
callback.on_launched (a_port)
|
||||||
|
end
|
||||||
|
|
||||||
|
on_stopped
|
||||||
|
do
|
||||||
|
Precursor
|
||||||
|
callback.on_stopped
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
set_base (a_uri: like base)
|
set_base (a_uri: like base)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ feature {NONE} -- Events
|
|||||||
wt: WORKER_THREAD
|
wt: WORKER_THREAD
|
||||||
e: EXECUTION_ENVIRONMENT
|
e: EXECUTION_ENVIRONMENT
|
||||||
do
|
do
|
||||||
port_number := 8087
|
port_number := 0
|
||||||
base_url := "test/"
|
base_url := "test/"
|
||||||
create app.make_custom (agent wgi_execute, base_url)
|
create app.make_custom (agent wgi_execute, base_url)
|
||||||
web_app := app
|
web_app := app
|
||||||
@@ -46,6 +46,8 @@ feature {NONE} -- Events
|
|||||||
|
|
||||||
create e
|
create e
|
||||||
e.sleep (1_000_000_000 * 5)
|
e.sleep (1_000_000_000 * 5)
|
||||||
|
|
||||||
|
port_number := app.port
|
||||||
end
|
end
|
||||||
|
|
||||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
|
|||||||
Reference in New Issue
Block a user