Implemented WSF_RESPONSE.put_error (...) and related
Added WSF_RESPONSE.put_character Renamed WGI_OUTPUT_STREAM.put_character_8 as put_character to follow style of put_string (and not put_string_8) Refactored the WSF_DEFAULT_SERVICE_LAUNCHER Added WSF_DEFAULT_SERVICE to be more user friendly Splitted the wsf/default/ libraries to have wsf/connector/... and being able to handle more than one connector in the same application
This commit is contained in:
22
library/server/wsf/default/nino/wsf_default_service.e
Normal file
22
library/server/wsf/default/nino/wsf_default_service.e
Normal file
@@ -0,0 +1,22 @@
|
||||
note
|
||||
description: "Summary description for {WSF_DEFAULT_SERVICE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_DEFAULT_SERVICE
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE_I [WSF_DEFAULT_SERVICE_LAUNCHER]
|
||||
|
||||
note
|
||||
copyright: "2011-2012, 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
|
||||
@@ -1,17 +1,6 @@
|
||||
note
|
||||
description: "[
|
||||
Component to launch the service using the default connector
|
||||
|
||||
Eiffel Web Nino for this class
|
||||
|
||||
|
||||
The Nino default connector support options:
|
||||
port: numeric such as 8099 (or equivalent string as "8099")
|
||||
base: base_url (very specific to standalone server)
|
||||
verbose: to display verbose output, useful for Nino
|
||||
force_single_threaded: use only one thread, useful for Nino
|
||||
|
||||
check WSF_DEFAULT_SERVICE_LAUNCHER_I for more documentation
|
||||
Default launcher for WSF_SERVICE based on {WSF_NINO_SERVICE_LAUNCHER}
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
@@ -20,114 +9,17 @@ class
|
||||
WSF_DEFAULT_SERVICE_LAUNCHER
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE_LAUNCHER_I
|
||||
redefine
|
||||
launchable
|
||||
end
|
||||
WSF_NINO_SERVICE_LAUNCHER
|
||||
|
||||
create
|
||||
make,
|
||||
make_and_launch,
|
||||
make_and_launch_with_options
|
||||
make_callback,
|
||||
make_callback_and_launch,
|
||||
make_and_launch_with_options -- obsolete
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
local
|
||||
l_name: detachable READABLE_STRING_GENERAL
|
||||
do
|
||||
port_number := 80 --| Default, but quite often, this port is already used ...
|
||||
base_url := ""
|
||||
if attached options as opts then
|
||||
across
|
||||
opts as opt
|
||||
loop
|
||||
if attached opt.item as l_opt_item then
|
||||
l_name := l_opt_item.name
|
||||
if l_name.same_string ("port") then
|
||||
if attached {INTEGER} l_opt_item.value as l_port then
|
||||
port_number := l_port
|
||||
elseif
|
||||
attached {READABLE_STRING_GENERAL} l_opt_item.value as l_port_str and then
|
||||
l_port_str.is_integer
|
||||
then
|
||||
port_number := l_port_str.as_string_8.to_integer
|
||||
end
|
||||
elseif l_name.same_string ("base") then
|
||||
if attached {READABLE_STRING_GENERAL} l_opt_item.value as l_base_str then
|
||||
base_url := l_base_str.as_string_8
|
||||
end
|
||||
elseif l_name.same_string ("force_single_threaded") then
|
||||
if attached {BOOLEAN} l_opt_item.value as l_single_threaded then
|
||||
single_threaded := l_single_threaded
|
||||
elseif attached {READABLE_STRING_GENERAL} l_opt_item.value as l_single_threaded_str then
|
||||
single_threaded := l_single_threaded_str.as_lower.same_string ("true")
|
||||
end
|
||||
elseif l_name.same_string ("verbose") then
|
||||
if attached {BOOLEAN} l_opt_item.value as l_verbose then
|
||||
verbose := l_verbose
|
||||
elseif attached {READABLE_STRING_GENERAL} l_opt_item.value as l_verbose_str then
|
||||
verbose := l_verbose_str.as_lower.same_string ("true")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
create connector.make (Current)
|
||||
if attached connector as conn then
|
||||
conn.set_base (base_url)
|
||||
if single_threaded then
|
||||
conn.configuration.set_force_single_threaded (True)
|
||||
end
|
||||
conn.configuration.set_is_verbose (verbose)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
launch
|
||||
-- <Precursor/>
|
||||
-- using `port_number', `base_url', `verbose' and `single_threaded'
|
||||
do
|
||||
if attached connector as conn then
|
||||
conn.set_base (base_url)
|
||||
if single_threaded then
|
||||
conn.configuration.set_force_single_threaded (True)
|
||||
end
|
||||
conn.configuration.set_is_verbose (verbose)
|
||||
debug ("nino")
|
||||
if verbose then
|
||||
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 + "/" + base_url + "%N")
|
||||
end
|
||||
end
|
||||
conn.configuration.http_server_port := port_number
|
||||
conn.launch
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
port_number: INTEGER
|
||||
|
||||
base_url: READABLE_STRING_8
|
||||
|
||||
verbose: BOOLEAN
|
||||
|
||||
single_threaded: BOOLEAN
|
||||
|
||||
feature -- Status report
|
||||
|
||||
connector: detachable WGI_NINO_CONNECTOR
|
||||
-- Default connector
|
||||
|
||||
launchable: BOOLEAN
|
||||
do
|
||||
Result := Precursor and port_number > 0
|
||||
end
|
||||
|
||||
;note
|
||||
copyright: "2011-2011, Eiffel Software and others"
|
||||
note
|
||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
@@ -136,4 +28,5 @@ feature -- Status report
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user