diff --git a/examples/restbucksCRUD/src/restbucks_server_execution.e b/examples/restbucksCRUD/src/restbucks_server_execution.e index 1637d1c7..6a7af74d 100644 --- a/examples/restbucksCRUD/src/restbucks_server_execution.e +++ b/examples/restbucksCRUD/src/restbucks_server_execution.e @@ -14,7 +14,7 @@ inherit initialize end - WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_EXECUTION + WSF_ROUTED_URI_TEMPLATE_HELPER WSF_HANDLER_HELPER diff --git a/examples/upload_image/src/image_uploader_execution.e b/examples/upload_image/src/image_uploader_execution.e index 68f1d22b..6cfe5184 100644 --- a/examples/upload_image/src/image_uploader_execution.e +++ b/examples/upload_image/src/image_uploader_execution.e @@ -17,7 +17,7 @@ inherit WSF_NO_PROXY_POLICY - WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_EXECUTION + WSF_ROUTED_URI_TEMPLATE_HELPER SHARED_EXECUTION_ENVIRONMENT diff --git a/library/security/openid/consumer/demo/application_execution.e b/library/security/openid/consumer/demo/application_execution.e index bfac0f31..15e9396b 100644 --- a/library/security/openid/consumer/demo/application_execution.e +++ b/library/security/openid/consumer/demo/application_execution.e @@ -13,7 +13,7 @@ inherit requires_proxy end - WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_EXECUTION + WSF_ROUTED_URI_TEMPLATE_HELPER WSF_NO_PROXY_POLICY diff --git a/library/server/obsolete/v0/ewsgi/connectors/libfcgi/libfcgi-safe.ecf b/library/server/obsolete/v0/ewsgi/connectors/libfcgi/libfcgi-safe.ecf new file mode 100644 index 00000000..0178aae0 --- /dev/null +++ b/library/server/obsolete/v0/ewsgi/connectors/libfcgi/libfcgi-safe.ecf @@ -0,0 +1,23 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + /wgi_.*_connector.e$ + + + + + diff --git a/library/server/obsolete/v0/ewsgi/connectors/libfcgi/libfcgi.ecf b/library/server/obsolete/v0/ewsgi/connectors/libfcgi/libfcgi.ecf new file mode 100644 index 00000000..b99fe98b --- /dev/null +++ b/library/server/obsolete/v0/ewsgi/connectors/libfcgi/libfcgi.ecf @@ -0,0 +1,18 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + diff --git a/library/server/obsolete/v0/ewsgi/connectors/libfcgi/license.lic b/library/server/obsolete/v0/ewsgi/connectors/libfcgi/license.lic new file mode 100644 index 00000000..cf2d1ed9 --- /dev/null +++ b/library/server/obsolete/v0/ewsgi/connectors/libfcgi/license.lic @@ -0,0 +1,10 @@ +${NOTE_KEYWORD} + copyright: "2011-${YEAR}, 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 + ]" diff --git a/library/server/obsolete/v0/ewsgi/connectors/libfcgi/src/wgi_libfcgi_connector.e b/library/server/obsolete/v0/ewsgi/connectors/libfcgi/src/wgi_libfcgi_connector.e new file mode 100644 index 00000000..2bb63746 --- /dev/null +++ b/library/server/obsolete/v0/ewsgi/connectors/libfcgi/src/wgi_libfcgi_connector.e @@ -0,0 +1,118 @@ +note + description: "Summary description for {WGI_LIBFCGI_CONNECTOR}." + legal: "See notice at end of class." + status: "See notice at end of class." + date: "$Date$" + revision: "$Revision$" + +class + WGI_LIBFCGI_CONNECTOR + +inherit + WGI_CONNECTOR + +create + make + +feature {NONE} -- Initialization + + make (a_service: like service) + do + service := a_service + create fcgi.make + create input.make (fcgi) + create output.make (fcgi) + end + +feature -- Access + + Name: STRING_8 = "libFCGI" + -- Name of Current connector + + Version: STRING_8 = "0.1" + -- Version of Current connector + +feature {NONE} -- Access + + service: WGI_SERVICE + -- Gateway Service + +feature -- Server + + launch + local + res: INTEGER + do + from + res := fcgi.fcgi_listen + until + res < 0 + loop + process_fcgi_request (fcgi.updated_environ_variables, input, output) + res := fcgi.fcgi_listen + end + end + +feature -- Execution + + process_fcgi_request (vars: STRING_TABLE [READABLE_STRING_8]; a_input: like input; a_output: like output) + local + req: WGI_REQUEST_FROM_TABLE + res: detachable WGI_RESPONSE_STREAM + rescued: BOOLEAN + do + if not rescued then + a_input.reset + create req.make (vars, a_input, Current) + create res.make (a_output, a_output) + service.execute (req, res) + res.push + else + if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.exception_trace as l_trace then + if res /= Void then + if not res.status_is_set then + res.set_status_code ({HTTP_STATUS_CODE}.internal_server_error, Void) + end + if res.message_writable then + res.put_string ("
")
+							res.put_string (l_trace)
+							res.put_string ("
") + end + res.push + end + end + end + rescue + if not rescued then + rescued := True + retry + end + end + +feature -- Input/Output + + input: WGI_LIBFCGI_INPUT_STREAM + -- Input from client (from httpd server via FCGI) + + output: WGI_LIBFCGI_OUTPUT_STREAM + -- Output to client (via httpd server/fcgi) + +feature {NONE} -- Implementation + + fcgi: FCGI + +invariant + fcgi_attached: fcgi /= Void + +note + copyright: "2011-2013, 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 diff --git a/library/server/obsolete/v0/ewsgi/connectors/nino/license.lic b/library/server/obsolete/v0/ewsgi/connectors/nino/license.lic new file mode 100644 index 00000000..d4d72876 --- /dev/null +++ b/library/server/obsolete/v0/ewsgi/connectors/nino/license.lic @@ -0,0 +1,10 @@ +${NOTE_KEYWORD} + copyright: "2011-${YEAR}, 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 + ]" diff --git a/library/server/obsolete/v0/ewsgi/connectors/nino/nino-safe.ecf b/library/server/obsolete/v0/ewsgi/connectors/nino/nino-safe.ecf new file mode 100644 index 00000000..bfcccf72 --- /dev/null +++ b/library/server/obsolete/v0/ewsgi/connectors/nino/nino-safe.ecf @@ -0,0 +1,28 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + + + + /wgi_.*_handler.e$ + /wgi_.*_connector.e$ + /.*_service.e$ + + + + + diff --git a/library/server/obsolete/v0/ewsgi/connectors/nino/nino.ecf b/library/server/obsolete/v0/ewsgi/connectors/nino/nino.ecf new file mode 100644 index 00000000..feee5fa9 --- /dev/null +++ b/library/server/obsolete/v0/ewsgi/connectors/nino/nino.ecf @@ -0,0 +1,28 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + + + + /wgi_.*_handler.e$ + /wgi_.*_connector.e$ + /.*_service.e$ + + + + + diff --git a/library/server/obsolete/v0/ewsgi/connectors/nino/src/nino_service.e b/library/server/obsolete/v0/ewsgi/connectors/nino/src/nino_service.e new file mode 100644 index 00000000..fd020b39 --- /dev/null +++ b/library/server/obsolete/v0/ewsgi/connectors/nino/src/nino_service.e @@ -0,0 +1,116 @@ +note + description: "Summary description for {NINO_SERVICE}." + date: "$Date$" + revision: "$Revision$" + +class + NINO_SERVICE + +create + make, + make_custom, + make_with_callback, + make_custom_with_callback + +feature {NONE} -- Implementation + + make (a_service: WGI_SERVICE) + -- Initialize `Current'. + do + make_custom (a_service, Void) + end + + make_custom (a_service: WGI_SERVICE; a_base_url: detachable STRING) + -- Initialize `Current'. + require + base_url_starts_with_slash: (a_base_url /= Void and then not a_base_url.is_empty) implies a_base_url.starts_with ("/") + do + create connector.make_with_base (a_service, a_base_url) + end + + make_with_callback (a_callback: PROCEDURE [ANY, TUPLE [req: WGI_REQUEST; res: WGI_RESPONSE]]) + -- Initialize `Current'. + do + make_custom_with_callback (a_callback, Void) + end + + make_custom_with_callback (a_callback: PROCEDURE [ANY, TUPLE [req: WGI_REQUEST; res: WGI_RESPONSE]]; a_base_url: detachable STRING) + -- Initialize `Current'. + require + base_url_starts_with_slash: (a_base_url /= Void and then not a_base_url.is_empty) implies a_base_url.starts_with ("/") + local + app: WGI_AGENT_SERVICE + do + create app.make (a_callback) + make_custom (app, a_base_url) + end + +feature -- Access + + connector: WGI_NINO_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 + + configuration: HTTP_SERVER_CONFIGURATION + do + Result := connector.configuration + end + + force_single_threaded + -- Force single threaded behavior + do + configuration.force_single_threaded := True + end + + set_is_verbose (b: BOOLEAN) + -- Set verbose message behavior to `b' + do + configuration.set_is_verbose (b) + end + + set_base_url (s: detachable READABLE_STRING_8) + -- Set base_url to `s' + do + connector.set_base (s) + end + +feature -- Server + + listen (a_port: INTEGER) + do + configuration.http_server_port := a_port + connector.launch + end + + shutdown + -- Shutdown the server + do + connector.server.shutdown_server + end + +note + copyright: "2011-2014, 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 diff --git a/library/server/obsolete/v0/ewsgi/connectors/nino/src/wgi_nino_connector.e b/library/server/obsolete/v0/ewsgi/connectors/nino/src/wgi_nino_connector.e new file mode 100644 index 00000000..431001af --- /dev/null +++ b/library/server/obsolete/v0/ewsgi/connectors/nino/src/wgi_nino_connector.e @@ -0,0 +1,160 @@ +note + description: "Summary description for {WGI_NINO_CONNECTOR}." + date: "$Date$" + revision: "$Revision$" + +class + WGI_NINO_CONNECTOR + +inherit + WGI_CONNECTOR + +create + make, + make_with_base + +feature {NONE} -- Initialization + + make (a_service: like service) + local + cfg: HTTP_SERVER_CONFIGURATION + do + service := a_service + + create cfg.make + create server.make (cfg) + + -- Callbacks + create on_launched_actions + create on_stopped_actions + end + + make_with_base (a_service: like service; a_base: like base) + require + a_base_starts_with_slash: (a_base /= Void and then not a_base.is_empty) implies a_base.starts_with ("/") + do + make (a_service) + set_base (a_base) + end + +feature -- Access + + name: STRING_8 = "Nino" + -- Name of Current connector + + version: STRING_8 = "0.1" + -- Version of Current connector + +feature {NONE} -- Access + + service: WGI_SERVICE + -- Gateway Service + +feature -- Access + + server: HTTP_SERVER + + configuration: HTTP_SERVER_CONFIGURATION + do + Result := server.configuration + end + +feature -- Access + + base: detachable READABLE_STRING_8 + -- Root url base + +feature -- Status report + + launched: BOOLEAN + -- Server launched and listening on `port' + + port: INTEGER + -- Listening port. + --| 0: not launched + +feature -- Callbacks + + on_launched_actions: ACTION_SEQUENCE [TUPLE [WGI_CONNECTOR]] + -- Actions triggered when launched + + on_stopped_actions: ACTION_SEQUENCE [TUPLE [WGI_CONNECTOR]] + -- Actions triggered when stopped + +feature -- Element change + + on_launched (a_port: INTEGER) + -- Server launched + do + launched := True + port := a_port + on_launched_actions.call ([Current]) + end + + on_stopped + -- Server stopped + do + on_stopped_actions.call ([Current]) + launched := False + port := 0 + end + +feature -- Element change + + set_base (b: like base) + require + b_starts_with_slash: (b /= Void and then not b.is_empty) implies b.starts_with ("/") + do + base := b + ensure + valid_base: (attached base as l_base and then not l_base.is_empty) implies l_base.starts_with ("/") + end + +feature -- Server + + launch + local + l_http_handler : HTTP_HANDLER + do + launched := False + port := 0 + create {WGI_NINO_HANDLER} l_http_handler.make_with_callback (server, Current) + if configuration.is_verbose then + if attached base as l_base then + io.error.put_string ("Base=" + l_base + "%N") + end + end + server.setup (l_http_handler) + end + + process_request (env: STRING_TABLE [READABLE_STRING_8]; a_headers_text: STRING; a_socket: TCP_STREAM_SOCKET) + local + req: WGI_REQUEST_FROM_TABLE + res: detachable WGI_NINO_RESPONSE_STREAM + retried: BOOLEAN + do + if not retried then + create req.make (env, create {WGI_NINO_INPUT_STREAM}.make (a_socket), Current) + create res.make (create {WGI_NINO_OUTPUT_STREAM}.make (a_socket), create {WGI_NINO_ERROR_STREAM}.make_stderr (a_socket.descriptor.out)) + req.set_meta_string_variable ("RAW_HEADER_DATA", a_headers_text) + service.execute (req, res) + res.push + end + rescue + if not retried then + retried := True + retry + end + end + +note + copyright: "2011-2013, 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 diff --git a/library/server/obsolete/v0/ewsgi/connectors/nino/src/wgi_nino_handler.e b/library/server/obsolete/v0/ewsgi/connectors/nino/src/wgi_nino_handler.e new file mode 100644 index 00000000..528a48c1 --- /dev/null +++ b/library/server/obsolete/v0/ewsgi/connectors/nino/src/wgi_nino_handler.e @@ -0,0 +1,260 @@ +note + description : "Objects that ..." + author : "$Author$" + date : "$Date$" + revision : "$Revision$" + +class + WGI_NINO_HANDLER + +inherit + HTTP_CONNECTION_HANDLER + redefine + on_launched, + on_stopped + end + +create + make_with_callback + +feature {NONE} -- Initialization + + make_with_callback (a_server: like server; a_callback: like callback) + -- Initialize `Current'. + do + base := a_callback.base + make (a_server) + callback := a_callback + end + + callback: WGI_NINO_CONNECTOR + +feature -- Access + + base: detachable READABLE_STRING_8 + -- 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 + + set_base (a_uri: like base) + -- Set `base' to `a_uri' + do + base := a_uri + end + +feature -- Request processing + + process_request (a_handler: HTTP_CONNECTION_HANDLER; a_socket: TCP_STREAM_SOCKET) + -- Process request ... + local + env: STRING_TABLE [READABLE_STRING_8] + p: INTEGER + l_request_uri, l_script_name, l_query_string, l_path_info: STRING + l_server_name, l_server_port: detachable STRING + l_headers_map: HASH_TABLE [STRING, STRING] + vn: STRING + + e: EXECUTION_ENVIRONMENT + enc: URL_ENCODER + utf: UTF_CONVERTER + do + l_request_uri := a_handler.uri + l_headers_map := a_handler.request_header_map + create e + create enc + if attached e.starting_environment as vars then + create env.make_equal (vars.count) + across + vars as c + loop + env.force (utf.utf_32_string_to_utf_8_string_8 (c.item), utf.utf_32_string_to_utf_8_string_8 (c.key)) + end + else + create env.make (0) + end + + --| for Any Abc-Def-Ghi add (or replace) the HTTP_ABC_DEF_GHI variable to `env' + from + l_headers_map.start + until + l_headers_map.after + loop + create vn.make_from_string (l_headers_map.key_for_iteration.as_upper) + vn.replace_substring_all ("-", "_") + if + vn.starts_with ("CONTENT_") and then + (vn.same_string_general ({WGI_META_NAMES}.content_type) or vn.same_string_general ({WGI_META_NAMES}.content_length)) + then + --| Keep this name + else + vn.prepend ("HTTP_") + end + add_environment_variable (l_headers_map.item_for_iteration, vn, env) + l_headers_map.forth + end + + --| Specific cases + + p := l_request_uri.index_of ('?', 1) + if p > 0 then + l_script_name := l_request_uri.substring (1, p - 1) + l_query_string := l_request_uri.substring (p + 1, l_request_uri.count) + else + l_script_name := l_request_uri.string + l_query_string := "" + end + if attached l_headers_map.item ("Host") as l_host then + check has_host: env.has ("HTTP_HOST") end +-- set_environment_variable (l_host, "HTTP_HOST", env) + p := l_host.index_of (':', 1) + if p > 0 then + l_server_name := l_host.substring (1, p - 1) + l_server_port := l_host.substring (p+1, l_host.count) + else + l_server_name := l_host + l_server_port := "80" -- Default + end + else + check host_available: False end + end + + if attached l_headers_map.item ("Authorization") as l_authorization then + check has_authorization: env.has ("HTTP_AUTHORIZATION") end +-- set_environment_variable (l_authorization, "HTTP_AUTHORIZATION", env) + p := l_authorization.index_of (' ', 1) + if p > 0 then + set_environment_variable (l_authorization.substring (1, p - 1), "AUTH_TYPE", env) + end + end + + set_environment_variable ("CGI/1.1", "GATEWAY_INTERFACE", env) + set_environment_variable (l_query_string, "QUERY_STRING", env) + + if attached a_handler.remote_info as l_remote_info then + set_environment_variable (l_remote_info.addr, "REMOTE_ADDR", env) + set_environment_variable (l_remote_info.hostname, "REMOTE_HOST", env) + set_environment_variable (l_remote_info.port.out, "REMOTE_PORT", env) +-- set_environment_variable (Void, "REMOTE_IDENT", env) +-- set_environment_variable (Void, "REMOTE_USER", env) + end + + set_environment_variable (l_request_uri, "REQUEST_URI", env) + set_environment_variable (a_handler.method, "REQUEST_METHOD", env) + + set_environment_variable (l_script_name, "SCRIPT_NAME", env) + set_environment_variable (l_server_name, "SERVER_NAME", env) + set_environment_variable (l_server_port, "SERVER_PORT", env) + set_environment_variable (a_handler.version, "SERVER_PROTOCOL", env) + set_environment_variable ({HTTP_SERVER_CONFIGURATION}.Server_details, "SERVER_SOFTWARE", env) + + --| Apply `base' value + if attached base as l_base and then l_request_uri /= Void then + if l_request_uri.starts_with (l_base) then + l_path_info := l_request_uri.substring (l_base.count + 1, l_request_uri.count) + p := l_path_info.index_of ('?', 1) + if p > 0 then + l_path_info.keep_head (p - 1) + end + env.force (l_base, "SCRIPT_NAME") + else + -- This should not happen, this means the `base' is not correctly set. + -- It is better to consider base as empty, rather than having empty PATH_INFO + check valid_base_value: False end + + l_path_info := l_request_uri + p := l_request_uri.index_of ('?', 1) + if p > 0 then + l_path_info := l_request_uri.substring (1, p - 1) + else + l_path_info := l_request_uri.string + end + env.force ("", "SCRIPT_NAME") + end + --| In order to have same path value for PATH_INFO on various connectors and servers + --| the multiple slashes must be stripped to single slash. + --| tested with: CGI+apache, libfcgi+apache on Windows and Linux + --| + --| For example: "////abc/def///end////" to "/abc/def/end/" ? + convert_multiple_slashes_to_single (l_path_info) + env.force (enc.decoded_utf_8_string (l_path_info), "PATH_INFO") + end + + callback.process_request (env, a_handler.request_header, a_socket) + end + + add_environment_variable (a_value: detachable STRING; a_var_name: READABLE_STRING_GENERAL; env: STRING_TABLE [READABLE_STRING_8]) + -- Add variable `a_var_name => a_value' to `env' + do + if a_value /= Void then + if env.has_key (a_var_name) and then attached env.found_item as l_existing_value then + --| Check http://www.ietf.org/rfc/rfc3875 4.1.18 + check find_proper_rewrite_for_same_header: False end + env.force (l_existing_value + " " + a_value, a_var_name) + else + env.force (a_value, a_var_name) + end + end + end + + set_environment_variable (a_value: detachable STRING; a_var_name: READABLE_STRING_GENERAL; env: STRING_TABLE [READABLE_STRING_8]) + -- Add variable `a_var_name => a_value' to `env' + do + if a_value /= Void then + env.force (a_value, a_var_name) + end + end + +feature {NONE} -- Implementation + + convert_multiple_slashes_to_single (s: STRING_8) + -- Replace multiple slashes sequence by a single slash character. + local + i,n: INTEGER + do + from + i := 1 + n := s.count + until + i > n + loop + if s[i] = '/' then + -- Remove following slashes '/'. + from + i := i + 1 + until + i > n or s[i] /= '/' + loop + s.remove (i) + n := n - 1 + end + else + i := i + 1 + end + end + end + +note + copyright: "2011-2013, 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 diff --git a/library/server/obsolete/v0/ewsgi/ewsgi-safe.ecf b/library/server/obsolete/v0/ewsgi/ewsgi-safe.ecf new file mode 100644 index 00000000..e1401dba --- /dev/null +++ b/library/server/obsolete/v0/ewsgi/ewsgi-safe.ecf @@ -0,0 +1,26 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + + + + + + + + + diff --git a/library/server/obsolete/v0/ewsgi/ewsgi.ecf b/library/server/obsolete/v0/ewsgi/ewsgi.ecf new file mode 100644 index 00000000..3894be85 --- /dev/null +++ b/library/server/obsolete/v0/ewsgi/ewsgi.ecf @@ -0,0 +1,26 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + + + + + + + + + diff --git a/library/server/obsolete/v0/ewsgi/specification/service/wgi_service.e b/library/server/obsolete/v0/ewsgi/specification/service/wgi_service.e new file mode 100644 index 00000000..910bbc42 --- /dev/null +++ b/library/server/obsolete/v0/ewsgi/specification/service/wgi_service.e @@ -0,0 +1,39 @@ +note + description: "[ + WGI_SERVICE + ]" + specification: "EWSGI specification https://github.com/Eiffel-World/Eiffel-Web-Framework/wiki/EWSGI-specification" + legal: "See notice at end of class." + status: "See notice at end of class." + date: "$Date$" + revision: "$Revision$" + +deferred class + WGI_SERVICE + +feature {WGI_CONNECTOR} -- Execution + + execute (req: WGI_REQUEST; res: WGI_RESPONSE) + -- Execute the request + -- See `req.input' for input stream + -- `req.meta_variables' for the CGI meta variable + -- and `res' for output buffer + require + res_status_unset: not res.status_is_set + deferred + ensure + res_status_set: res.status_is_set + end + +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 diff --git a/library/server/obsolete/v0/ewsgi/src/wgi_agent_service.e b/library/server/obsolete/v0/ewsgi/src/wgi_agent_service.e new file mode 100644 index 00000000..579e5bcf --- /dev/null +++ b/library/server/obsolete/v0/ewsgi/src/wgi_agent_service.e @@ -0,0 +1,48 @@ +note + description: "Summary description for {WGI_AGENT_SERVICE}." + author: "" + date: "$Date$" + revision: "$Revision$" + +class + WGI_AGENT_SERVICE + +inherit + WGI_SERVICE + +create + make + +feature {NONE} -- Implementation + + make (a_callback: like callback) + -- Initialize `Current'. + do + callback := a_callback + end + +feature {NONE} -- Implementation + + callback: PROCEDURE [ANY, TUPLE [req: WGI_REQUEST; res: WGI_RESPONSE]] + -- Procedure called on `execute' + + execute (req: WGI_REQUEST; res: WGI_RESPONSE) + -- Execute the request + do + callback.call ([req, res]) + end + +invariant + callback_attached: callback /= Void + +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 diff --git a/library/server/obsolete/v0/wsf/connector/libfcgi-safe.ecf b/library/server/obsolete/v0/wsf/connector/libfcgi-safe.ecf new file mode 100644 index 00000000..68612d66 --- /dev/null +++ b/library/server/obsolete/v0/wsf/connector/libfcgi-safe.ecf @@ -0,0 +1,22 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + + + + + diff --git a/library/server/obsolete/v0/wsf/connector/libfcgi.ecf b/library/server/obsolete/v0/wsf/connector/libfcgi.ecf new file mode 100644 index 00000000..664ecbd6 --- /dev/null +++ b/library/server/obsolete/v0/wsf/connector/libfcgi.ecf @@ -0,0 +1,22 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + + + + + diff --git a/library/server/obsolete/v0/wsf/connector/libfcgi/wsf_libfcgi_service_launcher.e b/library/server/obsolete/v0/wsf/connector/libfcgi/wsf_libfcgi_service_launcher.e new file mode 100644 index 00000000..5eca65f0 --- /dev/null +++ b/library/server/obsolete/v0/wsf/connector/libfcgi/wsf_libfcgi_service_launcher.e @@ -0,0 +1,64 @@ +note + description: "[ + Component to launch the service using the default connector + + libFCGI for this class + + How-to: + + s: WSF_DEFAULT_SERVICE_LAUNCHER + create s.make_and_launch (agent execute) + + execute (req: WSF_REQUEST; res: WSF_RESPONSE) + do + -- ... + end + ]" + date: "$Date$" + revision: "$Revision$" + +class + WSF_LIBFCGI_SERVICE_LAUNCHER + +inherit + WSF_SERVICE_LAUNCHER + +create + make, + make_and_launch, + make_callback, + make_callback_and_launch + +feature {NONE} -- Initialization + + initialize + do + create connector.make (Current) + end + +feature -- Execution + + launch + do + if attached connector as conn then + conn.launch + end + end + +feature -- Status report + + connector: detachable WGI_LIBFCGI_CONNECTOR + -- Default service name + +;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 diff --git a/library/server/obsolete/v0/wsf/connector/license.lic b/library/server/obsolete/v0/wsf/connector/license.lic new file mode 100644 index 00000000..d4d72876 --- /dev/null +++ b/library/server/obsolete/v0/wsf/connector/license.lic @@ -0,0 +1,10 @@ +${NOTE_KEYWORD} + copyright: "2011-${YEAR}, 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 + ]" diff --git a/library/server/obsolete/v0/wsf/connector/nino-safe.ecf b/library/server/obsolete/v0/wsf/connector/nino-safe.ecf new file mode 100644 index 00000000..359d8833 --- /dev/null +++ b/library/server/obsolete/v0/wsf/connector/nino-safe.ecf @@ -0,0 +1,25 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + + + + + + + + diff --git a/library/server/obsolete/v0/wsf/connector/nino.ecf b/library/server/obsolete/v0/wsf/connector/nino.ecf new file mode 100644 index 00000000..40913165 --- /dev/null +++ b/library/server/obsolete/v0/wsf/connector/nino.ecf @@ -0,0 +1,25 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + + + + + + + + diff --git a/library/server/obsolete/v0/wsf/connector/nino/wsf_nino_service_launcher.e b/library/server/obsolete/v0/wsf/connector/nino/wsf_nino_service_launcher.e new file mode 100644 index 00000000..7fa62a9e --- /dev/null +++ b/library/server/obsolete/v0/wsf/connector/nino/wsf_nino_service_launcher.e @@ -0,0 +1,164 @@ +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_SERVICE_LAUNCHER for more documentation + ]" + date: "$Date$" + revision: "$Revision$" + +class + WSF_NINO_SERVICE_LAUNCHER + +inherit + WSF_SERVICE_LAUNCHER + redefine + launchable + end + +create + make, + make_and_launch, + make_callback, + make_callback_and_launch + +feature {NONE} -- Initialization + + initialize + local + conn: like connector + do + create on_launched_actions + create on_stopped_actions + + port_number := 80 --| Default, but quite often, this port is already used ... + base_url := "" + + if attached options as opts then + if attached {READABLE_STRING_GENERAL} opts.option ("server_name") as l_server_name then + server_name := l_server_name.to_string_8 + end + if attached {INTEGER} opts.option ("port") as l_port then + port_number := l_port + elseif + attached {READABLE_STRING_GENERAL} opts.option ("port") as l_port_str and then + l_port_str.is_integer + then + port_number := l_port_str.as_string_8.to_integer + end + if attached {READABLE_STRING_GENERAL} opts.option ("base") as l_base_str then + base_url := l_base_str.as_string_8 + end + if attached {BOOLEAN} opts.option ("force_single_threaded") as l_single_threaded then + single_threaded := l_single_threaded + elseif attached {READABLE_STRING_GENERAL} opts.option ("force_single_threaded") as l_single_threaded_str then + single_threaded := l_single_threaded_str.as_lower.same_string ("true") + end + if attached {BOOLEAN} opts.option ("verbose") as l_verbose then + verbose := l_verbose + elseif attached {READABLE_STRING_GENERAL} opts.option ("verbose") as l_verbose_str then + verbose := l_verbose_str.as_lower.same_string ("true") + end + end + create conn.make (Current) + conn.on_launched_actions.extend (agent on_launched) + conn.on_stopped_actions.extend (agent on_stopped) + connector := conn + conn.set_base (base_url) + if single_threaded then + conn.configuration.set_force_single_threaded (True) + end + conn.configuration.set_is_verbose (verbose) + end + +feature -- Execution + + launch + -- + -- 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 + io.error.put_string ("Launching Nino web server on port " + port_number.out) + if attached server_name as l_name then + io.error.put_string ("%N http://" + l_name + ":" + port_number.out + "/" + base_url + "%N") + else + io.error.put_string ("%N http://localhost:" + port_number.out + "/" + base_url + "%N") + end + end + end + if attached server_name as l_server_name then + conn.configuration.set_http_server_name (l_server_name) + end + conn.configuration.http_server_port := port_number + conn.launch + end + end + +feature -- Callback + + on_launched_actions: ACTION_SEQUENCE [TUPLE [WGI_CONNECTOR]] + -- Actions triggered when launched + + on_stopped_actions: ACTION_SEQUENCE [TUPLE [WGI_CONNECTOR]] + -- Actions triggered when stopped + +feature {NONE} -- Implementation + + on_launched (conn: WGI_CONNECTOR) + do + on_launched_actions.call ([conn]) + end + + on_stopped (conn: WGI_CONNECTOR) + do + on_stopped_actions.call ([conn]) + end + + port_number: INTEGER + + server_name: detachable READABLE_STRING_8 + + 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-2013, 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 diff --git a/library/server/obsolete/v0/wsf/default/libfcgi-safe.ecf b/library/server/obsolete/v0/wsf/default/libfcgi-safe.ecf new file mode 100644 index 00000000..24a3a7fe --- /dev/null +++ b/library/server/obsolete/v0/wsf/default/libfcgi-safe.ecf @@ -0,0 +1,17 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + diff --git a/library/server/obsolete/v0/wsf/default/libfcgi.ecf b/library/server/obsolete/v0/wsf/default/libfcgi.ecf new file mode 100644 index 00000000..c35cd504 --- /dev/null +++ b/library/server/obsolete/v0/wsf/default/libfcgi.ecf @@ -0,0 +1,17 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + diff --git a/library/server/obsolete/v0/wsf/default/libfcgi/wsf_default_response_service.e b/library/server/obsolete/v0/wsf/default/libfcgi/wsf_default_response_service.e new file mode 100644 index 00000000..0cefc7da --- /dev/null +++ b/library/server/obsolete/v0/wsf/default/libfcgi/wsf_default_response_service.e @@ -0,0 +1,24 @@ +note + description: "Summary description for {WSF_DEFAULT_RESPONSE_SERVICE}." + date: "$Date$" + revision: "$Revision$" + +deferred class + WSF_DEFAULT_RESPONSE_SERVICE + +inherit + WSF_DEFAULT_SERVICE + + WSF_RESPONSE_SERVICE + +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 diff --git a/library/server/obsolete/v0/wsf/default/libfcgi/wsf_default_service.e b/library/server/obsolete/v0/wsf/default/libfcgi/wsf_default_service.e new file mode 100644 index 00000000..dd76ca78 --- /dev/null +++ b/library/server/obsolete/v0/wsf/default/libfcgi/wsf_default_service.e @@ -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 diff --git a/library/server/obsolete/v0/wsf/default/libfcgi/wsf_default_service_launcher.e b/library/server/obsolete/v0/wsf/default/libfcgi/wsf_default_service_launcher.e new file mode 100644 index 00000000..82189381 --- /dev/null +++ b/library/server/obsolete/v0/wsf/default/libfcgi/wsf_default_service_launcher.e @@ -0,0 +1,30 @@ +note + description: "Summary description for {WSF_DEFAULT_SERVICE_LAUNCHER}." + author: "" + date: "$Date$" + revision: "$Revision$" + +class + WSF_DEFAULT_SERVICE_LAUNCHER + +inherit + WSF_LIBFCGI_SERVICE_LAUNCHER + +create + make, + make_and_launch, + make_callback, + make_callback_and_launch + +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 diff --git a/library/server/obsolete/v0/wsf/default/nino-safe.ecf b/library/server/obsolete/v0/wsf/default/nino-safe.ecf new file mode 100644 index 00000000..f9f0aa19 --- /dev/null +++ b/library/server/obsolete/v0/wsf/default/nino-safe.ecf @@ -0,0 +1,17 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + diff --git a/library/server/obsolete/v0/wsf/default/nino.ecf b/library/server/obsolete/v0/wsf/default/nino.ecf new file mode 100644 index 00000000..0157a5a6 --- /dev/null +++ b/library/server/obsolete/v0/wsf/default/nino.ecf @@ -0,0 +1,17 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + diff --git a/library/server/obsolete/v0/wsf/default/nino/wsf_default_response_service.e b/library/server/obsolete/v0/wsf/default/nino/wsf_default_response_service.e new file mode 100644 index 00000000..0cefc7da --- /dev/null +++ b/library/server/obsolete/v0/wsf/default/nino/wsf_default_response_service.e @@ -0,0 +1,24 @@ +note + description: "Summary description for {WSF_DEFAULT_RESPONSE_SERVICE}." + date: "$Date$" + revision: "$Revision$" + +deferred class + WSF_DEFAULT_RESPONSE_SERVICE + +inherit + WSF_DEFAULT_SERVICE + + WSF_RESPONSE_SERVICE + +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 diff --git a/library/server/obsolete/v0/wsf/default/nino/wsf_default_service.e b/library/server/obsolete/v0/wsf/default/nino/wsf_default_service.e new file mode 100644 index 00000000..dd76ca78 --- /dev/null +++ b/library/server/obsolete/v0/wsf/default/nino/wsf_default_service.e @@ -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 diff --git a/library/server/wsf/src/service/wsf_to_wgi_service.e b/library/server/obsolete/v0/wsf/default/nino/wsf_default_service_launcher.e similarity index 57% rename from library/server/wsf/src/service/wsf_to_wgi_service.e rename to library/server/obsolete/v0/wsf/default/nino/wsf_default_service_launcher.e index 10d6d841..aab44c4f 100644 --- a/library/server/wsf/src/service/wsf_to_wgi_service.e +++ b/library/server/obsolete/v0/wsf/default/nino/wsf_default_service_launcher.e @@ -1,20 +1,24 @@ note description: "[ - This class is the link between WGI_SERVICE and WSF_SERVICE - It makes a WSF_SERVICE callable from the WGI_ world. - + Default launcher for WSF_SERVICE based on {WSF_NINO_SERVICE_LAUNCHER} ]" date: "$Date$" revision: "$Revision$" class - WSF_TO_WGI_SERVICE + WSF_DEFAULT_SERVICE_LAUNCHER inherit - WGI_SERVICE + WSF_NINO_SERVICE_LAUNCHER + +create + make, + make_and_launch, + make_callback, + make_callback_and_launch note - copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others" + 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 @@ -23,4 +27,5 @@ note Website http://www.eiffel.com Customer support http://support.eiffel.com ]" + end diff --git a/library/server/obsolete/v0/wsf/router/policy/service/wsf_routed_skeleton_service.e b/library/server/obsolete/v0/wsf/router/policy/service/wsf_routed_skeleton_service.e new file mode 100644 index 00000000..df05e4ea --- /dev/null +++ b/library/server/obsolete/v0/wsf/router/policy/service/wsf_routed_skeleton_service.e @@ -0,0 +1,287 @@ +note + description: "Summary description for {WSF_ROUTED_SKELETON_SERVICE}." + date: "$Date$" + revision: "$Revision$" + +deferred class + WSF_ROUTED_SKELETON_SERVICE + +inherit + WSF_ROUTED_SERVICE + redefine + execute + end + + WSF_SYSTEM_OPTIONS_ACCESS_POLICY + + WSF_PROXY_USE_POLICY + +feature -- Execution + + execute (req: WSF_REQUEST; res: WSF_RESPONSE) + -- If the service is available, and request URI is not too long, dispatch the request + -- and if handler is not found, execute the default procedure `execute_default'. + local + l_sess: WSF_ROUTER_SESSION + do + --| When we reach here, the request has already passed check for 400 (Bad request), + --| which is implemented in WSF_REQUEST.make_from_wgi (when it calls `analyze'). + if unavailable then + handle_unavailable (res) + elseif requires_proxy (req) then + handle_use_proxy (req, res) + elseif + maximum_uri_length > 0 and then + req.request_uri.count.to_natural_32 > maximum_uri_length + then + handle_request_uri_too_long (res) + elseif + req.is_request_method ({HTTP_REQUEST_METHODS}.method_options) and then + req.request_uri.same_string ("*") + then + handle_server_options (req, res) + else + create l_sess + router.dispatch (req, res, l_sess) + if not l_sess.dispatched then + execute_default (req, res) + end + end + end + +feature -- Measurement + + maximum_uri_length: NATURAL + -- Maximum length in characters (or zero for no limit) permitted + -- for {WSF_REQUEST}.request_uri + +feature -- Status report + + unavailable: BOOLEAN + -- Is service currently unavailable? + + unavailablity_message: detachable READABLE_STRING_8 + -- Message to be included as text of response body for {HTTP_STATUS_CODE}.service_unavailable + + unavailability_duration: NATURAL + -- Delta seconds for service unavailability (0 if not known) + + unavailable_until: detachable DATE_TIME + -- Time at which service becomes available again (if known) + +feature -- Status setting + + set_available + -- Set `unavailable' to `False'. + do + unavailable := False + unavailablity_message := Void + unavailable_until := Void + ensure + available: unavailable = False + unavailablity_message_detached: unavailablity_message = Void + unavailable_until_detached: unavailable_until = Void + end + + set_unavailable (a_message: READABLE_STRING_8; a_duration: NATURAL; a_until: detachable DATE_TIME) + -- Set `unavailable' to `True'. + require + a_message_attached: a_message /= Void + a_duration_xor_a_until: a_duration > 0 implies a_until = Void + do + unavailable := True + unavailablity_message := a_message + unavailability_duration := a_duration + ensure + unavailable: unavailable = True + unavailablity_message_aliased: unavailablity_message = a_message + unavailability_duration_set: unavailability_duration = a_duration + unavailable_until_aliased: unavailable_until = a_until + end + + set_maximum_uri_length (a_len: NATURAL) + -- Set `maximum_uri_length' to `a_len'. + -- Can pass zero to mean no restrictions. + do + maximum_uri_length := a_len + ensure + maximum_uri_length_set: maximum_uri_length = a_len + end + +feature {NONE} -- Implementation + + handle_unavailable (res: WSF_RESPONSE) + -- Write "Service unavailable" response to `res'. + require + unavailable: unavailable + res_attached: res /= Void + local + h: HTTP_HEADER + do + create h.make + h.put_content_type_text_plain + check attached unavailablity_message as m then + -- invariant `unavailability_message_attached' plus precondition `unavailable' + h.put_content_length (m.count) + h.put_current_date + res.set_status_code ({HTTP_STATUS_CODE}.service_unavailable) + if unavailability_duration > 0 then + h.put_header_key_value ({HTTP_HEADER_NAMES}.header_retry_after, unavailability_duration.out) + elseif attached unavailable_until as u then + h.put_header_key_value ({HTTP_HEADER_NAMES}.header_retry_after, + h.date_to_rfc1123_http_date_format (u)) + end + res.put_header_text (h.string) + res.put_string (m) + end + ensure + response_status_is_set: res.status_is_set + status_is_service_unavailable: res.status_code = {HTTP_STATUS_CODE}.service_unavailable + body_sent: res.message_committed and then res.transfered_content_length > 0 + body_content_was_unavailablity_message: True -- doesn't seem to be any way to check + end + + handle_request_uri_too_long (res: WSF_RESPONSE) + -- Write "Request URI too long" response into `res'. + require + res_attached: res /= Void + local + h: HTTP_HEADER + m: READABLE_STRING_8 + do + create h.make + h.put_content_type_text_plain + h.put_current_date + m := "Maximum permitted length for request URI is " + maximum_uri_length.out + " characters" + h.put_content_length (m.count) + res.set_status_code ({HTTP_STATUS_CODE}.request_uri_too_long) + res.put_header_text (h.string) + res.put_string (m) + ensure + response_status_is_set: res.status_is_set + status_is_request_uri_too_long: res.status_code = {HTTP_STATUS_CODE}.request_uri_too_long + body_sent: res.message_committed and then res.transfered_content_length > 0 + end + + frozen handle_server_options (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Write response to OPTIONS * into `res'. + require + req_attached: req /= Void + res_attached: res /= Void + method_is_options: req.is_request_method ({HTTP_REQUEST_METHODS}.method_options) + server_options_requested: req.request_uri.same_string ("*") + do + --| First check if forbidden. + --| (N.B. authentication requires an absoluteURI (RFC3617 page 3), and so cannot be used for OPTIONS *. + --| Otherwise construct an Allow response automatically from the router. + if is_system_options_forbidden (req) then + handle_system_options_forbidden (req, res) + else + handle_system_options (req, res) + end + ensure + response_status_is_set: res.status_is_set + valid_response_code: res.status_code = {HTTP_STATUS_CODE}.forbidden or + res.status_code = {HTTP_STATUS_CODE}.not_found or res.status_code = {HTTP_STATUS_CODE}.ok + header_sent: res.header_committed and res.message_committed + end + + frozen handle_system_options_forbidden (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Write a 403 Forbidden or a 404 Not found response into `res'. + require + req_attached: req /= Void + res_attached: res /= Void + method_is_options: req.is_request_method ({HTTP_REQUEST_METHODS}.method_options) + server_options_requested: req.request_uri.same_string ("*") + local + m: detachable READABLE_STRING_8 + h: HTTP_HEADER + do + m := system_options_forbidden_text (req) + if attached {READABLE_STRING_8} m as l_msg then + create h.make + h.put_content_type_text_plain + h.put_current_date + h.put_content_length (l_msg.count) + res.set_status_code ({HTTP_STATUS_CODE}.forbidden) + res.put_header_text (h.string) + res.put_string (l_msg) + else + create h.make + h.put_content_type_text_plain + h.put_current_date + h.put_content_length (0) + res.set_status_code ({HTTP_STATUS_CODE}.not_found) + res.put_header_text (h.string) + end + ensure + response_status_is_set: res.status_is_set + valid_response_code: res.status_code = {HTTP_STATUS_CODE}.forbidden or + res.status_code = {HTTP_STATUS_CODE}.not_found + header_sent: res.header_committed + message_sent: res.message_committed + end + + handle_system_options (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Write response to OPTIONS * into `res'. + -- This may be redefined by the user, but normally this will not be necessary. + require + req_attached: req /= Void + res_attached: res /= Void + method_is_options: req.is_request_method ({HTTP_REQUEST_METHODS}.method_options) + server_options_requested: req.request_uri.same_string ("*") + local + h: HTTP_HEADER + do + create h.make + h.put_content_type_text_plain + h.put_current_date + h.put_allow (router.all_allowed_methods) + h.put_content_length (0) + res.set_status_code ({HTTP_STATUS_CODE}.ok) + res.put_header_text (h.string) + ensure + response_status_is_set: res.status_is_set + response_code_ok: res.status_code = {HTTP_STATUS_CODE}.ok + header_sent: res.header_committed and res.message_committed + empty_body: res.transfered_content_length = 0 + end + + frozen handle_use_proxy (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Write Use Proxy response `res'. + require + res_attached: res /= Void + req_attached: req /= Void + proxy_required: requires_proxy (req) + local + h: HTTP_HEADER + do + create h.make + h.put_content_type_text_plain + h.put_current_date + h.put_location (proxy_server (req).string) + h.put_content_length (0) + res.put_header_lines (h) + res.set_status_code ({HTTP_STATUS_CODE}.use_proxy) + ensure + response_status_is_set: res.status_is_set + response_code_use_proxy: res.status_code = {HTTP_STATUS_CODE}.use_proxy + end + +invariant + + unavailability_message_attached: unavailable implies attached unavailablity_message as m and then + m.count > 0 + unavailability_duration_xor_unavailable_until: unavailability_duration > 0 implies unavailable_until = Void + +;note + copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, 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 diff --git a/library/server/obsolete/v0/wsf/router/wsf_filtered_service.e b/library/server/obsolete/v0/wsf/router/wsf_filtered_service.e new file mode 100644 index 00000000..c4103aaf --- /dev/null +++ b/library/server/obsolete/v0/wsf/router/wsf_filtered_service.e @@ -0,0 +1,29 @@ +note + description: "Summary description for {WSF_FILTERED_SERVICE}." + date: "$Date$" + revision: "$Revision$" + +deferred class + WSF_FILTERED_SERVICE + +inherit + WSF_FILTERED + +feature -- Execution + + execute (req: WSF_REQUEST; res: WSF_RESPONSE) + do + filter.execute (req, res) + end + +;note + copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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 diff --git a/library/server/obsolete/v0/wsf/router/wsf_routed_service.e b/library/server/obsolete/v0/wsf/router/wsf_routed_service.e new file mode 100644 index 00000000..2ed6524d --- /dev/null +++ b/library/server/obsolete/v0/wsf/router/wsf_routed_service.e @@ -0,0 +1,87 @@ +note + description: "Summary description for {WSF_ROUTED_SERVICE}." + author: "" + date: "$Date$" + revision: "$Revision$" + +deferred class + WSF_ROUTED_SERVICE + +inherit + WSF_ROUTED + +feature -- Initialization + + initialize_router + -- Initialize router + do + create_router + setup_router + end + + create_router + -- Create `router' + --| could be redefine to initialize with proper capacity + do + create router.make (10) + ensure + router_created: router /= Void + end + + setup_router + -- Setup `router' + require + router_created: router /= Void + deferred + end + +feature -- Execution + + execute (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Dispatch the request + -- and if handler is not found, execute the default procedure `execute_default'. + require + req_attached: req /= Void + res_attached: res /= Void + local + sess: WSF_ROUTER_SESSION + do + create sess + router.dispatch (req, res, sess) + if not sess.dispatched then + execute_default (req, res) + end + ensure + response_status_is_set: res.status_is_set + end + + execute_default (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Dispatch requests without a matching handler. + require + req_attached: req /= Void + res_attached: res /= Void + local + msg: WSF_DEFAULT_ROUTER_RESPONSE + do + create msg.make_with_router (req, router) + msg.set_documentation_included (True) + res.send (msg) + end + +feature -- Access + + router: WSF_ROUTER + -- Router used to dispatch the request according to the WSF_REQUEST object + -- and associated request methods + +;note + copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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 diff --git a/library/server/wsf/src/service/wsf_callback_service.e b/library/server/obsolete/v0/wsf/src/service/wsf_callback_service.e similarity index 100% rename from library/server/wsf/src/service/wsf_callback_service.e rename to library/server/obsolete/v0/wsf/src/service/wsf_callback_service.e diff --git a/library/server/obsolete/v0/wsf/src/service/wsf_default_service_i.e b/library/server/obsolete/v0/wsf/src/service/wsf_default_service_i.e new file mode 100644 index 00000000..b54b86d6 --- /dev/null +++ b/library/server/obsolete/v0/wsf/src/service/wsf_default_service_i.e @@ -0,0 +1,31 @@ +note + description: "Summary description for {WSF_DEFAULT_SERVICE_I}." + date: "$Date$" + revision: "$Revision$" + +deferred class + WSF_DEFAULT_SERVICE_I [G -> WSF_SERVICE_LAUNCHER create make_and_launch end] + +inherit + WSF_LAUNCHABLE_SERVICE + +feature {NONE} -- Initialization + + launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS) + local + l_launcher: G + do + create l_launcher.make_and_launch (a_service, opts) + end + +note + copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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 diff --git a/library/server/obsolete/v0/wsf/src/service/wsf_launchable_service.e b/library/server/obsolete/v0/wsf/src/service/wsf_launchable_service.e new file mode 100644 index 00000000..fa8aa1d4 --- /dev/null +++ b/library/server/obsolete/v0/wsf/src/service/wsf_launchable_service.e @@ -0,0 +1,59 @@ +note + description: "Summary description for {WSF_LAUNCHABLE_SERVICE}." + date: "$Date$" + revision: "$Revision$" + +deferred class + WSF_LAUNCHABLE_SERVICE + +inherit + WSF_SERVICE + +feature {NONE} -- Initialization + + frozen make_and_launch + do + initialize + launch (Current, service_options) + end + + initialize + -- Initialize current service + --| Could be redefine to set custom service option(s) + do + end + + service_options: detachable WSF_SERVICE_LAUNCHER_OPTIONS + + launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS) + deferred + end + +feature -- Default service options + + set_service_option (a_name: READABLE_STRING_GENERAL; a_value: detachable ANY) + -- Set options related to WSF_SERVICE_LAUNCHER + local + opts: like service_options + do + opts := service_options + if opts = Void then + create opts.make + service_options := opts + end + opts.set_option (a_name, a_value) + ensure + attached service_options as l_options and then l_options.option (a_name) = a_value + end + +note + copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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 diff --git a/library/server/obsolete/v0/wsf/src/service/wsf_response_service.e b/library/server/obsolete/v0/wsf/src/service/wsf_response_service.e new file mode 100644 index 00000000..383d9cdd --- /dev/null +++ b/library/server/obsolete/v0/wsf/src/service/wsf_response_service.e @@ -0,0 +1,41 @@ +note + description: "[ + Inherit from this class to implement the main entry of your web service + You just need to implement `execute', get data from the request `req' + and return a response message + ]" + date: "$Date$" + revision: "$Revision$" + +deferred class + WSF_RESPONSE_SERVICE + +inherit + WSF_SERVICE + +feature -- Response + + response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE + deferred + ensure + Result_attached: Result /= Void + end + +feature -- Execution + + execute (req: WSF_REQUEST; res: WSF_RESPONSE) + do + res.send (response (req)) + end + +note + copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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 diff --git a/library/server/obsolete/v0/wsf/src/service/wsf_service.e b/library/server/obsolete/v0/wsf/src/service/wsf_service.e new file mode 100644 index 00000000..38aef9ac --- /dev/null +++ b/library/server/obsolete/v0/wsf/src/service/wsf_service.e @@ -0,0 +1,41 @@ +note + description: "[ + Inherit from this class to implement the main entry of your web service + You just need to implement `execute', get data from the request `req' + and write the response in `res' + ]" + date: "$Date$" + revision: "$Revision$" + +deferred class + WSF_SERVICE + +feature -- Execution + + execute (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Execute the request + -- See `req.input' for input stream + -- `req.meta_variables' for the CGI meta variable + -- and `res' for output buffer + deferred + end + +feature -- Conversion + + to_wgi_service: WGI_SERVICE + -- Adapt Current WSF Service to plug into WGI component + do + create {WSF_TO_WGI_SERVICE} Result.make_from_service (Current) + end + +note + copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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 diff --git a/library/server/obsolete/v0/wsf/src/service/wsf_service_launcher.e b/library/server/obsolete/v0/wsf/src/service/wsf_service_launcher.e new file mode 100644 index 00000000..bf60ab56 --- /dev/null +++ b/library/server/obsolete/v0/wsf/src/service/wsf_service_launcher.e @@ -0,0 +1,132 @@ +note + description: "[ + Component to launch the service using the default connector + + How-to: + + s: WSF_SERVICE_LAUNCHER + create s.make_and_launch (service) + + `service' can be Current if inherit from WSF_SERVICE + or also `create {WSF_CALLBACK_SERVICE}.make (agent execute)' + + execute (req: WSF_REQUEST; res: WSF_RESPONSE) + do + -- ... + end + + You can also provide specific options that might be relevant + only for specific connectors such as + + + For instance, you can use + create s.make_and_launch_and_options (agent execute, <<["port", 8099]>>) + + And if Nino is the default connector it will support: + port: numeric such as 8099 (or equivalent string as "8099") + base: base_url (very specific to standalone server) + force_single_threaded: use only one thread, useful for Nino + verbose: to display verbose output, useful for Nino + ]" + date: "$Date$" + revision: "$Revision$" + +deferred class + WSF_SERVICE_LAUNCHER + +inherit + WSF_TO_WGI_SERVICE + +feature {NONE} -- Initialization + + frozen make (a_service: like service; a_options: like options) + do + make_from_service (a_service) + options := a_options + initialize + ensure + service_set: service = a_service + options_set: options = a_options + launchable: launchable + end + + frozen make_and_launch (a_service: like service; a_options: like options) + do + make (a_service, a_options) + launch + end + + frozen make_callback (a_callback: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]; a_options: like options) + do + make (create {WSF_CALLBACK_SERVICE}.make (a_callback), a_options) + end + + frozen make_callback_and_launch (a_callback: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]; a_options: like options) + do + make (create {WSF_CALLBACK_SERVICE}.make (a_callback), a_options) + end + + initialize + -- Initialize Current using `options' if attached + -- and build the connector + require + service_set: service /= Void + deferred + ensure + connector_attached: connector /= Void + end + +feature -- Status report + + launchable: BOOLEAN + -- Is default service launchable? + do + Result := connector /= Void + end + + connector: detachable WGI_CONNECTOR + -- Connector associated to current default service + deferred + end + + connector_name: READABLE_STRING_8 + -- Connector's name associated to current default service + do + if attached connector as conn then + Result := conn.name + else + check + connector_attached: False + end + Result := "" + end + end + +feature -- Execution + + launch + -- Launch default service + require + launchable: launchable + deferred + end + +feature {NONE} -- Implementation + + options: detachable WSF_SERVICE_LAUNCHER_OPTIONS + -- Custom options which might be support (or not) by the default service + +invariant + connector_attached: connector /= Void + +note + copyright: "2011-2014, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, 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 diff --git a/library/server/obsolete/v0/wsf/src/service/wsf_service_launcher_options.e b/library/server/obsolete/v0/wsf/src/service/wsf_service_launcher_options.e new file mode 100644 index 00000000..fd690f88 --- /dev/null +++ b/library/server/obsolete/v0/wsf/src/service/wsf_service_launcher_options.e @@ -0,0 +1,124 @@ +note + description: "[ + Options used by WSF_SERVICE_LAUNCHER + + For instance options supported by Nino as default connector:: + port: numeric such as 8099 (or equivalent string as "8099") + base: base_url (very specific to standalone server) + force_single_threaded: use only one thread, useful for Nino + verbose: to display verbose output, useful for Nino + ]" + date: "$Date$" + revision: "$Revision$" + +class + WSF_SERVICE_LAUNCHER_OPTIONS + +inherit + TABLE_ITERABLE [detachable ANY, READABLE_STRING_GENERAL] + redefine + default_create + end + +create + default_create, + make, + make_from_array, + make_from_iterable + +convert + make_from_array ({ARRAY [TUPLE [name: READABLE_STRING_GENERAL; value: detachable ANY]]}) + +feature {NONE} -- Initialization + + default_create + do + Precursor + create options.make (0) + end + + make + do + default_create + end + + make_from_array (a_options: ARRAY [TUPLE [name: READABLE_STRING_GENERAL; value: detachable ANY]]) + do + make + append_array_of_options (a_options) + end + + make_from_iterable (a_options: TABLE_ITERABLE [detachable ANY, READABLE_STRING_GENERAL]) + do + make + append_options (a_options) + end + +feature -- Merging + + append_array_of_options (a_options: ARRAY [TUPLE [name: READABLE_STRING_GENERAL; value: detachable ANY]]) + do + across + a_options as opt + loop + if attached opt.item as o then + set_option (o.name, o.value) + end + end + end + + append_options (a_options: TABLE_ITERABLE [detachable ANY, READABLE_STRING_GENERAL]) + do + across + a_options as o + loop + set_option (o.key, o.item) + end + end + +feature -- Access + + option (a_name: READABLE_STRING_GENERAL): detachable ANY + do + Result := options.item (a_name) + end + +feature -- Access + + new_cursor: TABLE_ITERATION_CURSOR [detachable ANY, READABLE_STRING_GENERAL] + -- Fresh cursor associated with current structure + do + Result := options.new_cursor + end + +feature -- Element change + + set_option (a_name: READABLE_STRING_GENERAL; a_value: detachable ANY) + do + options.force (a_value, a_name) + end + + set_verbose (b: BOOLEAN) + -- Set option "verbose" to `b' + do + set_option ("verbose", b) + end + +feature {NONE} -- Implementation + + options: STRING_TABLE [detachable ANY] + -- Custom options which might be support (or not) by the default service + +invariant + options_attached: options /= Void +note + copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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 diff --git a/library/server/obsolete/v0/wsf/src/service/wsf_service_launcher_options_from_ini.e b/library/server/obsolete/v0/wsf/src/service/wsf_service_launcher_options_from_ini.e new file mode 100644 index 00000000..4b2658c5 --- /dev/null +++ b/library/server/obsolete/v0/wsf/src/service/wsf_service_launcher_options_from_ini.e @@ -0,0 +1,84 @@ +note + description: "[ + Options used by WSF_SERVICE_LAUNCHER + Built from ini configuration file + ]" + +class + WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI + +inherit + WSF_SERVICE_LAUNCHER_OPTIONS + +create + make_from_file, + make_from_file_and_defaults + +feature {NONE} -- Initialization + + make_from_file (a_filename: READABLE_STRING_GENERAL) + -- Initialize `Current'. + do + make + import (a_filename) + end + + make_from_file_and_defaults (a_filename: READABLE_STRING_GENERAL; dft: detachable WSF_SERVICE_LAUNCHER_OPTIONS) + -- Initialize `Current'. + do + make + + if dft /= Void then + append_options (dft) + end + + import (a_filename) + end + +feature {NONE} -- Implementation + + import (a_filename: READABLE_STRING_GENERAL) + -- Import ini file content + local + f: PLAIN_TEXT_FILE + l,v: STRING_8 + p: INTEGER + do + create f.make_with_name (a_filename) + if f.exists and f.is_readable then + f.open_read + from + f.read_line + until + f.exhausted + loop + l := f.last_string + l.left_adjust + if not l.is_empty and then l[1] /= '#' then + p := l.index_of ('=', 1) + if p > 1 then + v := l.substring (p + 1, l.count) + l.keep_head (p - 1) + v.left_adjust + v.right_adjust + l.right_adjust + set_option (l.as_lower, v) + end + end + f.read_line + end + f.close + end + end + +note + copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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 diff --git a/library/server/obsolete/v0/wsf/src/service/wsf_to_wgi_service.e b/library/server/obsolete/v0/wsf/src/service/wsf_to_wgi_service.e new file mode 100644 index 00000000..9bec25fd --- /dev/null +++ b/library/server/obsolete/v0/wsf/src/service/wsf_to_wgi_service.e @@ -0,0 +1,67 @@ +note + description: "[ + This class is the link between WGI_SERVICE and WSF_SERVICE + It makes a WSF_SERVICE callable from the WGI_ world. + + ]" + date: "$Date$" + revision: "$Revision$" + +class + WSF_TO_WGI_SERVICE + +inherit + WGI_SERVICE + + WGI_EXPORTER + +create + make_from_service + +feature {NONE} -- Make + + make_from_service (a_service: like service) + -- Make from WSF_SERVICE `a_service' + do + service := a_service + end + + service: WSF_SERVICE + -- Associated WSF_SERVICE + +feature {WGI_CONNECTOR} -- Implementation: Execution + + execute (req: WGI_REQUEST; res: WGI_RESPONSE) + -- Delegate the WGI processing to the WSF_SERVICE object + -- + local + w_res: detachable WSF_RESPONSE + w_req: detachable WSF_REQUEST + do + create w_res.make_from_wgi (res) + create w_req.make_from_wgi (req) + service.execute (w_req, w_res) + w_req.destroy + rescue + if w_res /= Void then + if not (w_res.status_committed or w_res.header_committed) then + w_res.set_status_code ({HTTP_STATUS_CODE}.internal_server_error) + end + w_res.flush + end + if w_req /= Void then + w_req.destroy + end + end + +note + copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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 diff --git a/library/server/obsolete/v0/wsf/wsf-safe.ecf b/library/server/obsolete/v0/wsf/wsf-safe.ecf new file mode 100644 index 00000000..edd519f2 --- /dev/null +++ b/library/server/obsolete/v0/wsf/wsf-safe.ecf @@ -0,0 +1,37 @@ + + + + + + /.git$ + /EIFGENs$ + /.svn$ + + + + + + + + + + + + + + + + + /policy_driven$ + + + + + + /service$ + + + + + diff --git a/library/server/obsolete/v0/wsf/wsf.ecf b/library/server/obsolete/v0/wsf/wsf.ecf new file mode 100644 index 00000000..3b84f417 --- /dev/null +++ b/library/server/obsolete/v0/wsf/wsf.ecf @@ -0,0 +1,37 @@ + + + + + + /.git$ + /EIFGENs$ + /.svn$ + + + + + + + + + + + + + + + + + /policy_driven$ + + + + + + /service$ + + + + + diff --git a/library/server/obsolete/v0/wsf/wsf_extension-safe.ecf b/library/server/obsolete/v0/wsf/wsf_extension-safe.ecf new file mode 100644 index 00000000..433868dc --- /dev/null +++ b/library/server/obsolete/v0/wsf/wsf_extension-safe.ecf @@ -0,0 +1,20 @@ + + + + + + /.git$ + /EIFGENs$ + /.svn$ + + + + + + + + + + + diff --git a/library/server/obsolete/v0/wsf/wsf_extension.ecf b/library/server/obsolete/v0/wsf/wsf_extension.ecf new file mode 100644 index 00000000..65fe0016 --- /dev/null +++ b/library/server/obsolete/v0/wsf/wsf_extension.ecf @@ -0,0 +1,20 @@ + + + + + + /.git$ + /EIFGENs$ + /.svn$ + + + + + + + + + + + diff --git a/library/server/obsolete/v0/wsf/wsf_policy_driven-safe.ecf b/library/server/obsolete/v0/wsf/wsf_policy_driven-safe.ecf new file mode 100644 index 00000000..d42de944 --- /dev/null +++ b/library/server/obsolete/v0/wsf/wsf_policy_driven-safe.ecf @@ -0,0 +1,22 @@ + + + + + + /.git$ + /EIFGENs$ + /.svn$ + + + + + + + + + + + + + diff --git a/library/server/obsolete/v0/wsf/wsf_policy_driven.ecf b/library/server/obsolete/v0/wsf/wsf_policy_driven.ecf new file mode 100644 index 00000000..ae8e48d8 --- /dev/null +++ b/library/server/obsolete/v0/wsf/wsf_policy_driven.ecf @@ -0,0 +1,22 @@ + + + + + + /.git$ + /EIFGENs$ + /.svn$ + + + + + + + + + + + + + diff --git a/library/server/obsolete/v0/wsf/wsf_router_context-safe.ecf b/library/server/obsolete/v0/wsf/wsf_router_context-safe.ecf new file mode 100644 index 00000000..f55c41ed --- /dev/null +++ b/library/server/obsolete/v0/wsf/wsf_router_context-safe.ecf @@ -0,0 +1,16 @@ + + + + + + /.git$ + /EIFGENs$ + /.svn$ + + + + + + + diff --git a/library/server/obsolete/v0/wsf/wsf_router_context.ecf b/library/server/obsolete/v0/wsf/wsf_router_context.ecf new file mode 100644 index 00000000..ba8138f4 --- /dev/null +++ b/library/server/obsolete/v0/wsf/wsf_router_context.ecf @@ -0,0 +1,16 @@ + + + + + + /.git$ + /EIFGENs$ + /.svn$ + + + + + + + diff --git a/library/server/obsolete/v0/wsf/wsf_session-safe.ecf b/library/server/obsolete/v0/wsf/wsf_session-safe.ecf new file mode 100644 index 00000000..0e713330 --- /dev/null +++ b/library/server/obsolete/v0/wsf/wsf_session-safe.ecf @@ -0,0 +1,3 @@ + + + diff --git a/library/server/obsolete/v0/wsf/wsf_session.ecf b/library/server/obsolete/v0/wsf/wsf_session.ecf new file mode 100644 index 00000000..a138e7a6 --- /dev/null +++ b/library/server/obsolete/v0/wsf/wsf_session.ecf @@ -0,0 +1,3 @@ + + + diff --git a/library/server/wsf/router/filter/wsf_filtered.e b/library/server/wsf/router/filter/wsf_filtered.e new file mode 100644 index 00000000..0ac3c60d --- /dev/null +++ b/library/server/wsf/router/filter/wsf_filtered.e @@ -0,0 +1,63 @@ +note + description: "Object with a `filter: WSF_FILTER' feature." + date: "$Date$" + revision: "$Revision$" + +deferred class + WSF_FILTERED + +feature {NONE} -- Initialization + + initialize_filter + -- Initialize `filter' + do + create_filter + setup_filter + end + + create_filter + -- Create `filter' + deferred + ensure + filter_created: filter /= Void + end + + setup_filter + -- Setup `filter' + require + filter_created: filter /= Void + deferred + end + + append_filters (a_filters: ITERABLE [WSF_FILTER]) + -- Append collection `a_filters' of filters to the end of the `filter' chain. + local + f: like filter + l_next_filter: detachable like filter + do + from + f := filter + l_next_filter := f.next + until + l_next_filter = Void + loop + f := l_next_filter + l_next_filter := f.next + end + check f_attached_without_next: f /= Void and then f.next = Void end + across + a_filters as ic + loop + l_next_filter := ic.item + f.set_next (l_next_filter) + f := l_next_filter + end + end + +feature -- Access + + filter: WSF_FILTER + -- Filter + + +end diff --git a/library/server/wsf/router/filter/wsf_filtered_execution.e b/library/server/wsf/router/filter/wsf_filtered_execution.e index eb2bd534..3de16a50 100644 --- a/library/server/wsf/router/filter/wsf_filtered_execution.e +++ b/library/server/wsf/router/filter/wsf_filtered_execution.e @@ -13,6 +13,8 @@ inherit initialize end + WSF_FILTERED + feature {NONE} -- Initialization initialize @@ -21,57 +23,6 @@ feature {NONE} -- Initialization initialize_filter end - initialize_filter - -- Initialize `filter' - do - create_filter - setup_filter - end - - create_filter - -- Create `filter' - deferred - ensure - filter_created: filter /= Void - end - - setup_filter - -- Setup `filter' - require - filter_created: filter /= Void - deferred - end - - append_filters (a_filters: ITERABLE [WSF_FILTER]) - -- Append collection `a_filters' of filters to the end of the `filter' chain. - local - f: like filter - l_next_filter: detachable like filter - do - from - f := filter - l_next_filter := f.next - until - l_next_filter = Void - loop - f := l_next_filter - l_next_filter := f.next - end - check f_attached_without_next: f /= Void and then f.next = Void end - across - a_filters as ic - loop - l_next_filter := ic.item - f.set_next (l_next_filter) - f := l_next_filter - end - end - -feature -- Access - - filter: WSF_FILTER - -- Filter - feature -- Execution execute diff --git a/library/server/wsf/router/support/uri/helpers/wsf_uri_helper_for_routed_execution.e b/library/server/wsf/router/support/uri/helpers/wsf_routed_uri_helper.e similarity index 73% rename from library/server/wsf/router/support/uri/helpers/wsf_uri_helper_for_routed_execution.e rename to library/server/wsf/router/support/uri/helpers/wsf_routed_uri_helper.e index ee087582..0e1cfd84 100644 --- a/library/server/wsf/router/support/uri/helpers/wsf_uri_helper_for_routed_execution.e +++ b/library/server/wsf/router/support/uri/helpers/wsf_routed_uri_helper.e @@ -1,22 +1,13 @@ note - description: "Facilities inheritance to add URI base routing to a routed execution" + description: "Facilities inheritance to add URI base routing to a routed object." date: "$Date$" revision: "$Revision$" -deferred class WSF_URI_HELPER_FOR_ROUTED_EXECUTION +deferred class WSF_ROUTED_URI_HELPER -feature -- Access - - router: WSF_ROUTER - -- Router used to dispatch the request according to the WSF_REQUEST object - -- and associated request methods; - -- This should not be implemented by descendants. Instead, you gain an effective - -- version by also inheriting from WSF_ROUTED_EXECUTION, or one of it's descendants. - deferred - ensure - router_not_void: Result /= Void - end +inherit + WSF_ROUTED feature -- Mapping helper: uri @@ -47,7 +38,7 @@ feature -- Mapping helper: uri agent end note - copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" + copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software diff --git a/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_helper_for_routed_execution.e b/library/server/wsf/router/support/uri_template/helpers/wsf_routed_uri_template_helper.e similarity index 77% rename from library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_helper_for_routed_execution.e rename to library/server/wsf/router/support/uri_template/helpers/wsf_routed_uri_template_helper.e index 223b8292..7ed42435 100644 --- a/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_helper_for_routed_execution.e +++ b/library/server/wsf/router/support/uri_template/helpers/wsf_routed_uri_template_helper.e @@ -1,23 +1,13 @@ note - description: "Facilities inheritance to add URI template-base routing to a routed execution" - author: "" + description: "Facilities inheritance to add URI template-base routing to a routed object." date: "$Date$" revision: "$Revision$" deferred class - WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_EXECUTION + WSF_ROUTED_URI_TEMPLATE_HELPER -feature -- Access - - router: WSF_ROUTER - -- Router used to dispatch the request according to the WSF_REQUEST object - -- and associated request methods; - -- This should not be implemented by descendants. Instead, you gain an effective - -- version by also inheriting from WSF_ROUTED_SERVICE, or one of it's descendants. - deferred - ensure - router_not_void: Result /= Void - end +inherit + WSF_ROUTED feature -- Mapping helper: uri template @@ -60,7 +50,7 @@ feature -- Mapping helper: uri template agent end note - copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" + copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software diff --git a/library/server/wsf/router/wsf_routed.e b/library/server/wsf/router/wsf_routed.e new file mode 100644 index 00000000..8d92d738 --- /dev/null +++ b/library/server/wsf/router/wsf_routed.e @@ -0,0 +1,31 @@ +note + description: "Object with a `router' feature, used to dispatch url." + date: "$Date$" + revision: "$Revision$" + +deferred class + WSF_ROUTED + +feature -- Access + + router: WSF_ROUTER + -- Router used to dispatch the request according to the WSF_REQUEST object + -- and associated request methods; + -- This should not be implemented by descendants. Instead, you gain an effective + -- version by also inheriting from WSF_ROUTED_EXECUTION, or one of it's descendants. + deferred + ensure + router_not_void: Result /= Void + end + +note + copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, 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 diff --git a/library/server/wsf/router/wsf_routed_execution.e b/library/server/wsf/router/wsf_routed_execution.e index a5bb8f12..cd67f53f 100644 --- a/library/server/wsf/router/wsf_routed_execution.e +++ b/library/server/wsf/router/wsf_routed_execution.e @@ -12,6 +12,8 @@ inherit initialize end + WSF_ROUTED + feature {NONE} -- Initialize initialize diff --git a/library/server/wsf/src/service/wsf_launchable_service.e b/library/server/wsf/src/service/wsf_launchable_service.e index cdc8550e..385ee1fa 100644 --- a/library/server/wsf/src/service/wsf_launchable_service.e +++ b/library/server/wsf/src/service/wsf_launchable_service.e @@ -23,9 +23,15 @@ feature {NONE} -- Initialization do end +feature -- Access + service_options: detachable WSF_SERVICE_LAUNCHER_OPTIONS + -- Optional service options used to configure associated WSF_SERVICE_LAUNCHER. + +feature -- Basic operation launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS) + -- Launch service with optional options `opts'. deferred end diff --git a/library/server/wsf/wsf-safe.ecf b/library/server/wsf/wsf-safe.ecf index 9fd98569..d09d33af 100644 --- a/library/server/wsf/wsf-safe.ecf +++ b/library/server/wsf/wsf-safe.ecf @@ -1,5 +1,5 @@ - + @@ -9,6 +9,8 @@ + +