Added new WSF_STANDALONE_SERVICE_OPTIONS, a descendant of WSF_SERVICE_LAUNCHER_OPTIONS specialized for standalone connectors.
This commit is contained in:
@@ -19,6 +19,24 @@ feature -- Access
|
|||||||
information_level: INTEGER = 32 -- 0010 0000
|
information_level: INTEGER = 32 -- 0010 0000
|
||||||
debug_level: INTEGER = 64 -- 0100 0000
|
debug_level: INTEGER = 64 -- 0100 0000
|
||||||
|
|
||||||
|
feature -- Conversion
|
||||||
|
|
||||||
|
logger_level_representation (a_level: INTEGER): STRING
|
||||||
|
-- String representation of `a_level'.
|
||||||
|
do
|
||||||
|
inspect a_level
|
||||||
|
when alert_level then Result := "alert"
|
||||||
|
when critical_level then Result := "critical"
|
||||||
|
when error_level then Result := "error"
|
||||||
|
when warning_level then Result := "warning"
|
||||||
|
when notice_level then Result := "notice"
|
||||||
|
when information_level then Result := "information"
|
||||||
|
when debug_level then Result := "debug"
|
||||||
|
else
|
||||||
|
Result := "level #" + a_level.out
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ inherit
|
|||||||
|
|
||||||
HTTPD_LOGGER
|
HTTPD_LOGGER
|
||||||
|
|
||||||
|
HTTPD_LOGGER_CONSTANTS
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (a_factory: like factory)
|
make (a_factory: like factory)
|
||||||
@@ -121,7 +123,7 @@ feature -- Execution
|
|||||||
log (" - SSL = not supported")
|
log (" - SSL = not supported")
|
||||||
end
|
end
|
||||||
if configuration.verbose_level > 0 then
|
if configuration.verbose_level > 0 then
|
||||||
log (" - verbose_level = " + configuration.verbose_level.out)
|
log (" - verbose_level = " + logger_level_representation (configuration.verbose_level))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
is_shutdown_requested := False
|
is_shutdown_requested := False
|
||||||
|
|||||||
@@ -0,0 +1,251 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
Options specific to standalone connector.
|
||||||
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
WSF_STANDALONE_SERVICE_OPTIONS
|
||||||
|
|
||||||
|
inherit
|
||||||
|
WSF_SERVICE_LAUNCHER_OPTIONS
|
||||||
|
|
||||||
|
feature -- Access: output
|
||||||
|
|
||||||
|
is_verbose: BOOLEAN
|
||||||
|
-- Send verbose message to the output?
|
||||||
|
do
|
||||||
|
Result := option_boolean_value ("verbose", False)
|
||||||
|
end
|
||||||
|
|
||||||
|
verbose_level: detachable READABLE_STRING_8
|
||||||
|
-- Verbosity of output.
|
||||||
|
do
|
||||||
|
if attached {READABLE_STRING_GENERAL} option ("verbose_level") as l_verbose_level and then l_verbose_level.is_valid_as_string_8 then
|
||||||
|
Result := l_verbose_level.to_string_8
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access: connection
|
||||||
|
|
||||||
|
port: INTEGER
|
||||||
|
-- Listening port number.
|
||||||
|
do
|
||||||
|
Result := option_integer_value ("port", 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
server_name: detachable READABLE_STRING_8
|
||||||
|
-- Listening only for connection on `server_name' if defined.
|
||||||
|
do
|
||||||
|
if attached {READABLE_STRING_GENERAL} option ("server_name") as l_server_name and then l_server_name.is_valid_as_string_8 then
|
||||||
|
Result := l_server_name.to_string_8
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
base_url: detachable READABLE_STRING_8
|
||||||
|
do
|
||||||
|
if attached {READABLE_STRING_GENERAL} option ("base") as l_base and then l_base.is_valid_as_string_8 then
|
||||||
|
Result := l_base.to_string_8
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
max_concurrent_connections: INTEGER
|
||||||
|
-- Maximum of concurrent connections.
|
||||||
|
-- Define the size of the concurrent pool.
|
||||||
|
do
|
||||||
|
Result := option_integer_value ("max_concurrent_connections", 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
max_tcp_clients: INTEGER
|
||||||
|
-- Listen on socket for at most `queue' connections.
|
||||||
|
do
|
||||||
|
Result := option_integer_value ("max_tcp_clients", 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access: network
|
||||||
|
|
||||||
|
socket_timeout: INTEGER
|
||||||
|
-- Amount of seconds that the server waits for receipts and transmissions during communications.
|
||||||
|
-- note: with timeout of 0, socket can wait for ever.
|
||||||
|
-- By default: {HTTPD_CONFIGURATION_I}.default_socket_timeout seconds, which is appropriate for most situations.
|
||||||
|
do
|
||||||
|
Result := option_integer_value ("socket_timeout", 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
socket_recv_timeout: INTEGER
|
||||||
|
-- Amount of seconds that the server waits for receiving data during communications.
|
||||||
|
-- note: with timeout of 0, socket can wait for ever.
|
||||||
|
-- By default: {HTTPD_CONFIGURATION_I}.default_socket_recv_timeout seconds.
|
||||||
|
do
|
||||||
|
Result := option_integer_value ("socket_recv_timeout", 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access: persistent connection
|
||||||
|
|
||||||
|
keep_alive_timeout: INTEGER
|
||||||
|
-- Persistent connection timeout.
|
||||||
|
-- Number of seconds the server waits after a request has been served before it closes the connection.
|
||||||
|
-- Timeout unit in Seconds.
|
||||||
|
-- By default: {HTTPD_CONFIGURATION_I}.default_keep_alive_timeout .
|
||||||
|
do
|
||||||
|
Result := option_integer_value ("keep_alive_timeout", 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
max_keep_alive_requests: INTEGER
|
||||||
|
-- Maximum number of requests allowed per persistent connection.
|
||||||
|
-- Recommended a high setting.
|
||||||
|
-- To disable KeepAlive, set `max_keep_alive_requests' to 0.
|
||||||
|
-- By default: {HTTPD_CONFIGURATION_I}.default_max_keep_alive_requests .
|
||||||
|
do
|
||||||
|
Result := option_integer_value ("max_keep_alive_requests", 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access: SSL
|
||||||
|
|
||||||
|
ssl_enabled: BOOLEAN
|
||||||
|
-- Is SSL/TLS session?
|
||||||
|
do
|
||||||
|
Result := option_boolean_value ("ssl_enabled", False)
|
||||||
|
end
|
||||||
|
|
||||||
|
ssl_protocol: detachable READABLE_STRING_GENERAL
|
||||||
|
-- SSL protocol name, by default TLS 1.2
|
||||||
|
do
|
||||||
|
if attached {READABLE_STRING_GENERAL} option ("ssl_protocol") as l_prot and then l_prot.is_valid_as_string_8 then
|
||||||
|
Result := l_prot.to_string_8
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
ssl_ca_crt: detachable READABLE_STRING_GENERAL
|
||||||
|
-- Signed certificate.
|
||||||
|
do
|
||||||
|
if attached {READABLE_STRING_GENERAL} option ("ssl_ca_crt") as l_ssl_ca_crt then
|
||||||
|
Result := l_ssl_ca_crt
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
ssl_ca_key: detachable READABLE_STRING_GENERAL
|
||||||
|
-- Private key for the certificate.
|
||||||
|
do
|
||||||
|
if attached {READABLE_STRING_GENERAL} option ("ssl_ca_key") as l_ssl_ca_key then
|
||||||
|
Result := l_ssl_ca_key
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Element change
|
||||||
|
|
||||||
|
set_is_verbose (b: BOOLEAN)
|
||||||
|
do
|
||||||
|
set_boolean_option ("verbose", b)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_verbose_level (lev: detachable READABLE_STRING_GENERAL)
|
||||||
|
-- Set `verbose_level' to `lev'.
|
||||||
|
do
|
||||||
|
set_string_option ("verbose_level", lev)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_port (a_port_number: INTEGER)
|
||||||
|
do
|
||||||
|
set_numeric_option ("port", a_port_number)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_server_name (v: detachable READABLE_STRING_8)
|
||||||
|
do
|
||||||
|
set_string_option ("server_name", v)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_max_tcp_clients (v: like max_tcp_clients)
|
||||||
|
-- Set `max_tcp_clients' with `v'.
|
||||||
|
do
|
||||||
|
set_numeric_option ("max_tcp_clients", v)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_max_concurrent_connections (v: like max_concurrent_connections)
|
||||||
|
-- Set `max_concurrent_connections' with `v'.
|
||||||
|
do
|
||||||
|
set_numeric_option ("max_concurrent_connections", v)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_socket_timeout (a_nb_seconds: like socket_timeout)
|
||||||
|
-- Set `socket_timeout' with `a_nb_seconds'
|
||||||
|
do
|
||||||
|
set_numeric_option ("socket_timeout", a_nb_seconds)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_socket_recv_timeout (a_nb_seconds: like socket_recv_timeout)
|
||||||
|
-- Set `socket_recv_timeout' with `a_nb_seconds'
|
||||||
|
do
|
||||||
|
set_numeric_option ("socket_recv_timeout", a_nb_seconds)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_keep_alive_timeout (a_nb_seconds: like keep_alive_timeout)
|
||||||
|
-- Set `keep_alive_timeout' with `a_nb_seconds'
|
||||||
|
do
|
||||||
|
set_numeric_option ("keep_alive_timeout", a_nb_seconds)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_max_keep_alive_requests (nb: like max_keep_alive_requests)
|
||||||
|
-- Set `max_keep_alive_requests' with `nb'
|
||||||
|
do
|
||||||
|
set_numeric_option ("max_keep_alive_requests", nb)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_ssl_enabled (b: BOOLEAN)
|
||||||
|
do
|
||||||
|
set_boolean_option ("ssl_enabled", b)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_ssl_protocol_to_ssl_2_or_3
|
||||||
|
-- Set `ssl_protocol' with `Ssl_23'.
|
||||||
|
do
|
||||||
|
set_ssl_protocol ("ssl_2_3")
|
||||||
|
end
|
||||||
|
|
||||||
|
set_ssl_protocol_to_tls_1_0
|
||||||
|
-- Set `ssl_protocol' with `Tls_1_0'.
|
||||||
|
do
|
||||||
|
set_ssl_protocol ("tls_1_0")
|
||||||
|
end
|
||||||
|
|
||||||
|
set_ssl_protocol_to_tls_1_1
|
||||||
|
-- Set `ssl_protocol' with `Tls_1_1'.
|
||||||
|
do
|
||||||
|
set_ssl_protocol ("tls_1_1")
|
||||||
|
end
|
||||||
|
|
||||||
|
set_ssl_protocol_to_tls_1_2
|
||||||
|
-- Set `ssl_protocol' with `Tls_1_2'.
|
||||||
|
do
|
||||||
|
set_ssl_protocol ("tls_1_2")
|
||||||
|
end
|
||||||
|
|
||||||
|
set_ssl_protocol_to_dtls_1_0
|
||||||
|
-- Set `ssl_protocol' with `Dtls_1_0'.
|
||||||
|
do
|
||||||
|
set_ssl_protocol ("dtls_1_0")
|
||||||
|
end
|
||||||
|
|
||||||
|
set_ssl_protocol (a_prot: detachable READABLE_STRING_GENERAL)
|
||||||
|
-- Set `ssl_protocol' with `a_version'
|
||||||
|
do
|
||||||
|
set_string_option ("ssl_protocol", a_prot)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_ssl_ca_crt (a_value: detachable READABLE_STRING_GENERAL)
|
||||||
|
-- Set `ssl_ca_crt' from `a_value'.
|
||||||
|
do
|
||||||
|
set_string_option ("ssl_ca_crt", a_value)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_ssl_ca_key (a_value: detachable READABLE_STRING_GENERAL)
|
||||||
|
-- Set `ssl_ca_key' with `a_value'.
|
||||||
|
do
|
||||||
|
set_string_option ("ssl_ca_key", a_value)
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2016, Javier Velilla, Jocelyn Fiat and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
end
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
Options specific to websocket standalone connector.
|
||||||
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
WSF_STANDALONE_WEBSOCKET_SERVICE_OPTIONS
|
||||||
|
|
||||||
|
inherit
|
||||||
|
WSF_STANDALONE_SERVICE_OPTIONS
|
||||||
|
|
||||||
|
end
|
||||||
@@ -177,6 +177,34 @@ feature -- Element change
|
|||||||
options.force (a_value, a_name)
|
options.force (a_value, a_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
unset_option (a_name: READABLE_STRING_GENERAL)
|
||||||
|
do
|
||||||
|
options.remove (a_name)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_string_option (a_name: READABLE_STRING_GENERAL; a_value: detachable READABLE_STRING_GENERAL)
|
||||||
|
do
|
||||||
|
if a_value = Void then
|
||||||
|
unset_option (a_name)
|
||||||
|
else
|
||||||
|
set_option (a_name, a_value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
set_numeric_option (a_name: READABLE_STRING_GENERAL; a_value: NUMERIC)
|
||||||
|
do
|
||||||
|
set_option (a_name, a_value)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_boolean_option (a_name: READABLE_STRING_GENERAL; a_value: BOOLEAN)
|
||||||
|
do
|
||||||
|
if a_value then
|
||||||
|
set_option (a_name, "true")
|
||||||
|
else
|
||||||
|
set_option (a_name, "false")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
set_verbose (b: BOOLEAN)
|
set_verbose (b: BOOLEAN)
|
||||||
-- Set option "verbose" to `b'
|
-- Set option "verbose" to `b'
|
||||||
do
|
do
|
||||||
|
|||||||
Reference in New Issue
Block a user