diff --git a/examples/restbucksCRUD/src/restbucks_server.e b/examples/restbucksCRUD/src/restbucks_server.e index a8f4c422..21a8921c 100644 --- a/examples/restbucksCRUD/src/restbucks_server.e +++ b/examples/restbucksCRUD/src/restbucks_server.e @@ -14,6 +14,8 @@ inherit WSF_HANDLER_HELPER + WSF_DEFAULT_SERVICE + create make @@ -24,9 +26,11 @@ feature {NONE} -- Initialization s: WSF_DEFAULT_SERVICE_LAUNCHER do initialize_router - create s.make_and_launch_with_options (agent execute, <<["port", 9090]>>) + set_service_option ("port", 9090) + make_and_launch end + create_router do create router.make (2) diff --git a/examples/simple/application.e b/examples/simple/application.e index b98e9562..532ddbfd 100644 --- a/examples/simple/application.e +++ b/examples/simple/application.e @@ -6,19 +6,14 @@ note class APPLICATION +inherit + WSF_DEFAULT_SERVICE + create - make + make_and_launch feature {NONE} -- Initialization - make - -- Run application. - local - s: WSF_DEFAULT_SERVICE_LAUNCHER - do - create s.make_and_launch (agent execute) - end - execute (req: WSF_REQUEST; res: WSF_RESPONSE) do -- To send a response we need to setup, the status code and diff --git a/examples/simple/simple.ecf b/examples/simple/simple.ecf index 9fa7eb30..6dc064b9 100644 --- a/examples/simple/simple.ecf +++ b/examples/simple/simple.ecf @@ -1,20 +1,48 @@ - - + + + + /EIFGENs$ + /CVS$ + /.svn$ + - - - - /EIFGENs$ - /CVS$ - /.svn$ - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/simple_file/service_file.e b/examples/simple_file/service_file.e index 95fd2c43..35189718 100644 --- a/examples/simple_file/service_file.e +++ b/examples/simple_file/service_file.e @@ -6,19 +6,14 @@ note class SERVICE_FILE +inherit + WSF_DEFAULT_SERVICE + create - make + make_and_launch feature {NONE} -- Initialization - make - -- Run application. - local - s: WSF_DEFAULT_SERVICE_LAUNCHER - do - create s.make_and_launch (agent execute) - end - execute (req: WSF_REQUEST; res: WSF_RESPONSE) local f: WSF_FILE_RESPONSE diff --git a/examples/simple_file/service_file.ecf b/examples/simple_file/service_file.ecf index f781a692..8667fb2d 100644 --- a/examples/simple_file/service_file.ecf +++ b/examples/simple_file/service_file.ecf @@ -1,7 +1,7 @@ - + diff --git a/examples/upload_image/src/image_uploader.e b/examples/upload_image/src/image_uploader.e index d4a001db..7b5fc905 100644 --- a/examples/upload_image/src/image_uploader.e +++ b/examples/upload_image/src/image_uploader.e @@ -12,6 +12,8 @@ inherit WSF_URI_TEMPLATE_ROUTED_SERVICE + WSF_DEFAULT_SERVICE + create make @@ -19,13 +21,14 @@ feature {NONE} -- Initialization make -- Initialize Current - local - s: WSF_DEFAULT_SERVICE_LAUNCHER do initialize_router - create s.make_and_launch (agent execute) - -- Use the following line to use particular port number (as 9090) with Nino connector - -- create s.make_and_launch_with_options (agent execute, <<["port", 9090]>>) + + + -- To use particular port number (as 9090) with Nino connector + -- Uncomment the following line +-- set_service_option ("port", 9090) + make_and_launch end create_router @@ -126,7 +129,7 @@ feature -- Execution n := n - 1 end l_body.append (" %N") - page.send_to (res) + res.send (page) else create l_body.make (255) l_body.append ("

EWF: Uploaded files

%N") @@ -154,7 +157,7 @@ feature -- Execution page.set_title ("EWF: uploaded image") page.add_style ("../style.css", "all") page.set_body (l_body) - page.send_to (res) + res.send (page) end end diff --git a/library/server/ewsgi/connectors/cgi/src/wgi_cgi_connector.e b/library/server/ewsgi/connectors/cgi/src/wgi_cgi_connector.e index f8fadccc..0384343f 100644 --- a/library/server/ewsgi/connectors/cgi/src/wgi_cgi_connector.e +++ b/library/server/ewsgi/connectors/cgi/src/wgi_cgi_connector.e @@ -42,7 +42,7 @@ feature -- Execution do if not rescued then create req.make ((create {EXECUTION_ENVIRONMENT}).starting_environment_variables, create {WGI_CGI_INPUT_STREAM}.make, Current) - create res.make (create {WGI_CGI_OUTPUT_STREAM}.make) + create res.make (create {WGI_CGI_OUTPUT_STREAM}.make, create {WGI_CGI_ERROR_STREAM}.make) service.execute (req, res) else if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.exception_trace as l_trace then diff --git a/library/server/ewsgi/connectors/cgi/src/wgi_cgi_error_stream.e b/library/server/ewsgi/connectors/cgi/src/wgi_cgi_error_stream.e new file mode 100644 index 00000000..7494758c --- /dev/null +++ b/library/server/ewsgi/connectors/cgi/src/wgi_cgi_error_stream.e @@ -0,0 +1,57 @@ +note + description: "Summary description for WGI_CGI_ERROR_STREAM." + legal: "See notice at end of class." + status: "See notice at end of class." + date: "$Date$" + revision: "$Revision$" + +class + WGI_CGI_ERROR_STREAM + +inherit + WGI_ERROR_STREAM + + CONSOLE + rename + make as console_make + end + +create + make + +feature {NONE} -- Initialization + + make + do + make_open_stdout ("stderr") + end + +feature -- Error + + put_error (a_message: READABLE_STRING_8) + do + put_readable_string_8 (a_message) + end + + put_readable_string_8 (s: READABLE_STRING_8) + -- Write `s' at end of default output. + local + ext: C_STRING + do + if s.count > 0 then + create ext.make (s) + console_ps (file_pointer, ext.managed_data.item, s.count) + end + end + +note + copyright: "2011-2011, 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/ewsgi/connectors/libfcgi/src/wgi_libfcgi_connector.e b/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_connector.e index c8b94dfb..93f70dab 100644 --- a/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_connector.e +++ b/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_connector.e @@ -20,8 +20,8 @@ feature {NONE} -- Initialization do service := a_service create fcgi.make - create {WGI_LIBFCGI_INPUT_STREAM} input.make (fcgi) - create {WGI_LIBFCGI_OUTPUT_STREAM} output.make (fcgi) + create input.make (fcgi) + create output.make (fcgi) end feature -- Access @@ -63,7 +63,7 @@ feature -- Execution do if not rescued then create req.make (vars, a_input, Current) - create res.make (a_output) + create res.make (a_output, a_output) service.execute (req, res) else if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.exception_trace as l_trace then @@ -84,10 +84,10 @@ feature -- Execution feature -- Input/Output - input: WGI_INPUT_STREAM + input: WGI_LIBFCGI_INPUT_STREAM -- Input from client (from httpd server via FCGI) - output: WGI_OUTPUT_STREAM + output: WGI_LIBFCGI_OUTPUT_STREAM -- Output to client (via httpd server/fcgi) feature {NONE} -- Implementation diff --git a/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_output_stream.e b/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_output_stream.e index 7e01c756..349d2dab 100644 --- a/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_output_stream.e +++ b/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_output_stream.e @@ -11,6 +11,8 @@ class inherit WGI_OUTPUT_STREAM + WGI_ERROR_STREAM + HTTP_STATUS_CODE_MESSAGES export {NONE} all @@ -68,6 +70,12 @@ feature -- Basic operation fcgi.put_string (s) end + put_character (c: CHARACTER_8) + -- Send `c' to http client + do + fcgi.put_string (c.out) + end + feature -- Basic operations flush @@ -75,6 +83,13 @@ feature -- Basic operations do end +feature -- Error + + put_error (a_message: READABLE_STRING_8) + do + fcgi.put_error (a_message) + end + feature {NONE} -- Implementation fcgi: FCGI diff --git a/library/server/ewsgi/connectors/nino/src/nino_service.e b/library/server/ewsgi/connectors/nino/src/nino_service.e index cc3cf14a..7fd57ff5 100644 --- a/library/server/ewsgi/connectors/nino/src/nino_service.e +++ b/library/server/ewsgi/connectors/nino/src/nino_service.e @@ -8,17 +8,33 @@ class create make, - make_custom + make_custom, + make_with_callback, + make_custom_with_callback feature {NONE} -- Implementation - make (a_callback: like {WGI_AGENT_SERVICE}.callback) + make (a_service: WGI_SERVICE) -- Initialize `Current'. do - make_custom (a_callback, Void) + make_custom (a_service, Void) end - make_custom (a_callback: like {WGI_AGENT_SERVICE}.callback; a_base_url: detachable STRING) + 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: like {WGI_AGENT_SERVICE}.callback) + -- Initialize `Current'. + do + make_custom_with_callback (a_callback, Void) + end + + make_custom_with_callback (a_callback: like {WGI_AGENT_SERVICE}.callback; 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 ("/") @@ -26,7 +42,7 @@ feature {NONE} -- Implementation app: WGI_AGENT_SERVICE do create app.make (a_callback) - create connector.make_with_base (app, a_base_url) + make_custom (app, a_base_url) end feature -- Access @@ -88,7 +104,7 @@ feature -- Server end note - copyright: "2011-2011, 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 diff --git a/library/server/ewsgi/connectors/nino/src/wgi_nino_connector.e b/library/server/ewsgi/connectors/nino/src/wgi_nino_connector.e index b379eb5c..4fe70957 100644 --- a/library/server/ewsgi/connectors/nino/src/wgi_nino_connector.e +++ b/library/server/ewsgi/connectors/nino/src/wgi_nino_connector.e @@ -119,7 +119,7 @@ feature -- Server res: detachable WGI_NINO_RESPONSE_STREAM do 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 res.make (create {WGI_NINO_OUTPUT_STREAM}.make (a_socket), Void) req.set_meta_string_variable ("RAW_HEADER_DATA", a_headers_text) service.execute (req, res) res.commit diff --git a/library/server/ewsgi/connectors/nino/src/wgi_nino_output_stream.e b/library/server/ewsgi/connectors/nino/src/wgi_nino_output_stream.e index e672062f..1b84c0ad 100644 --- a/library/server/ewsgi/connectors/nino/src/wgi_nino_output_stream.e +++ b/library/server/ewsgi/connectors/nino/src/wgi_nino_output_stream.e @@ -10,9 +10,6 @@ class inherit WGI_OUTPUT_STREAM - redefine - put_character_8 - end HTTP_STATUS_CODE_MESSAGES export @@ -66,7 +63,7 @@ feature -- Output target.put_readable_string_8 (s) end - put_character_8 (c: CHARACTER_8) + put_character (c: CHARACTER_8) do target.put_character (c) end @@ -86,7 +83,7 @@ feature -- Basic operations end note - copyright: "2011-2011, 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 diff --git a/library/server/ewsgi/connectors/null/src/wgi_null_connector.e b/library/server/ewsgi/connectors/null/src/wgi_null_connector.e index 26614e2e..789c84e4 100644 --- a/library/server/ewsgi/connectors/null/src/wgi_null_connector.e +++ b/library/server/ewsgi/connectors/null/src/wgi_null_connector.e @@ -14,9 +14,8 @@ create feature {NONE} -- Initialization - make (a_service: like service) + make do - service := a_service end feature -- Access @@ -27,42 +26,14 @@ feature -- Access Version: STRING_8 = "0.1" -- Version of Current connector -feature {NONE} -- Access - - service: WGI_SERVICE - -- Gateway Service - feature -- Execution launch - local - req: WGI_REQUEST_FROM_TABLE - res: detachable WGI_RESPONSE_STREAM - rescued: BOOLEAN do - if not rescued then - create req.make ((create {EXECUTION_ENVIRONMENT}).starting_environment_variables, create {WGI_NULL_INPUT_STREAM}.make, Current) - create res.make (create {WGI_NULL_OUTPUT_STREAM}.make) - service.execute (req, res) - 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) - end - if res.message_writable then - res.put_string ("
" + l_trace + "
") - end - end - end - end - rescue - rescued := True - retry end note - copyright: "2011-2011, Eiffel Software and others" + copyright: "2011-2012, 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/ewsgi/specification/response/wgi_response.e b/library/server/ewsgi/specification/response/wgi_response.e index e16e4244..b9b9c7f1 100644 --- a/library/server/ewsgi/specification/response/wgi_response.e +++ b/library/server/ewsgi/specification/response/wgi_response.e @@ -96,6 +96,13 @@ feature -- Header output operation feature -- Output operation + put_character (c: CHARACTER_8) + -- Send the character `c' + require + message_writable: message_writable + deferred + end + put_string (s: READABLE_STRING_8) -- Send the string `s' require @@ -115,6 +122,14 @@ feature -- Output operation deferred end +feature -- Error reporting + + put_error (a_message: READABLE_STRING_8) + -- Report error described by `a_message' + -- This might be used by the underlying connector + deferred + 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)" diff --git a/library/server/ewsgi/specification/stream/wgi_error_stream.e b/library/server/ewsgi/specification/stream/wgi_error_stream.e new file mode 100644 index 00000000..8c06df16 --- /dev/null +++ b/library/server/ewsgi/specification/stream/wgi_error_stream.e @@ -0,0 +1,32 @@ +note + description : "[ + Objects that represents the error stream + ]" + specification: "EWSGI/connector 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_ERROR_STREAM + +feature -- Output + + put_error (a_message: READABLE_STRING_8) + -- Report error described by `a_message' + -- This might be used by the underlying connector + deferred + 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/ewsgi/specification/stream/wgi_output_stream.e b/library/server/ewsgi/specification/stream/wgi_output_stream.e index 9289378e..871de1d9 100644 --- a/library/server/ewsgi/specification/stream/wgi_output_stream.e +++ b/library/server/ewsgi/specification/stream/wgi_output_stream.e @@ -37,13 +37,12 @@ feature -- Output end end - put_character_8 (c: CHARACTER_8) + put_character (c: CHARACTER_8) -- Write `c' to output stream. --| Could be redefined for optimization require is_open_write: is_open_write - do - put_string (c.out) + deferred end feature -- Specific output diff --git a/library/server/ewsgi/src/implementation/wgi_response_stream.e b/library/server/ewsgi/src/implementation/wgi_response_stream.e index bc954efd..82c07f3b 100644 --- a/library/server/ewsgi/src/implementation/wgi_response_stream.e +++ b/library/server/ewsgi/src/implementation/wgi_response_stream.e @@ -17,9 +17,10 @@ create feature {NONE} -- Initialization - make (a_output: like output) + make (a_output: like output; a_error: like error) do output := a_output + error := a_error end feature {WGI_CONNECTOR, WGI_SERVICE} -- Commit @@ -97,6 +98,12 @@ feature -- Header output operation feature -- Output operation + put_character (c: CHARACTER_8) + -- Send the character `c' + do + output.put_character (c) + end + put_string (s: READABLE_STRING_8) -- Send the string `s' do @@ -115,11 +122,25 @@ feature -- Output operation output.flush end +feature -- Error reporting + + put_error (a_message: READABLE_STRING_8) + -- Report error described by `a_message' + -- This might be used by the underlying connector + do + if attached error as err then + err.put_error (a_message) + end + end + feature {NONE} -- Implementation: Access output: WGI_OUTPUT_STREAM -- Server output channel + error: detachable WGI_ERROR_STREAM + -- Server output channel + ;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)" diff --git a/library/server/libfcgi/implementation/fake/fcgi_imp.e b/library/server/libfcgi/implementation/fake/fcgi_imp.e index e7ae9fe6..2bd9c0de 100644 --- a/library/server/libfcgi/implementation/fake/fcgi_imp.e +++ b/library/server/libfcgi/implementation/fake/fcgi_imp.e @@ -55,6 +55,14 @@ feature -- FCGI output io.put_string (a_str) end +feature -- Error + + put_error (a_str: READABLE_STRING_8) + -- Put `a_str' on the FastCGI stdout. + do + io.error.put_string (a_str) + end + feature -- FCGI Input read_from_stdin (n: INTEGER) diff --git a/library/server/libfcgi/implementation/linux/fcgi_c_api.e b/library/server/libfcgi/implementation/linux/fcgi_c_api.e index 68a2a2c9..49cf18cf 100644 --- a/library/server/libfcgi/implementation/linux/fcgi_c_api.e +++ b/library/server/libfcgi/implementation/linux/fcgi_c_api.e @@ -96,6 +96,15 @@ feature -- Output "FCGI_fwrite($v, 1, $n, FCGI_stdout);" end +feature -- Error + + put_error (v: POINTER; n: INTEGER) + external + "C inline use %"fcgi_stdio.h%"" + alias + "FCGI_fwrite($v, 1, $n, FCGI_stderr);" + end + feature -- Access stdout: POINTER @@ -114,6 +123,14 @@ feature -- Access "FCGI_stdin" end + stderr: POINTER + -- FCGI_stderr() return pointer on error FCGI_FILE + external + "C inline use %"fcgi_stdio.h%"" + alias + "FCGI_stderr" + end + note copyright: "Copyright (c) 1984-2011, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" diff --git a/library/server/libfcgi/implementation/linux/fcgi_imp.e b/library/server/libfcgi/implementation/linux/fcgi_imp.e index 70b7436e..d5750f06 100644 --- a/library/server/libfcgi/implementation/linux/fcgi_imp.e +++ b/library/server/libfcgi/implementation/linux/fcgi_imp.e @@ -77,6 +77,18 @@ feature -- FCGI output {FCGI_C_API}.put_string (l_c_str.item, l_c_str.count) end +feature -- Error + + put_error (a_message: READABLE_STRING_8) + -- Put error message `a_message' on the FastCGI stderr + local + l_c_str: C_STRING + do + l_c_str := c_buffer + l_c_str.set_string (a_message) + fcgi.put_error (l_c_str.item, l_c_str.count) + end + feature -- FCGI Input copy_from_stdin (n: INTEGER; tf: FILE) diff --git a/library/server/libfcgi/implementation/windows/fcgi_c_api.e b/library/server/libfcgi/implementation/windows/fcgi_c_api.e index f754ceea..c136f142 100644 --- a/library/server/libfcgi/implementation/windows/fcgi_c_api.e +++ b/library/server/libfcgi/implementation/windows/fcgi_c_api.e @@ -101,6 +101,15 @@ feature -- Output i := fwrite (v, 1, n, stdout) end +feature -- Error + + put_error (v: POINTER; n: INTEGER) + local + i: INTEGER + do + i := fwrite (v, 1, n, stderr) + end + feature {NONE} -- Output fwrite (v: POINTER; a_size: INTEGER; n: INTEGER; fp: POINTER): INTEGER @@ -129,6 +138,15 @@ feature -- Access "FCGI_stdin" end + stderr: POINTER + -- FCGI_stderr() return pointer on error FCGI_FILE + external + "C inline use %"fcgi_stdio.h%"" + alias + "FCGI_stderr" + end + + note copyright: "Copyright (c) 1984-2011, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" diff --git a/library/server/libfcgi/implementation/windows/fcgi_imp.e b/library/server/libfcgi/implementation/windows/fcgi_imp.e index 148357ad..d8e13027 100644 --- a/library/server/libfcgi/implementation/windows/fcgi_imp.e +++ b/library/server/libfcgi/implementation/windows/fcgi_imp.e @@ -136,6 +136,18 @@ feature -- FCGI output fcgi.put_string (l_c_str.item, l_c_str.count) end +feature -- Error + + put_error (a_message: READABLE_STRING_8) + -- Put error message `a_message' on the FastCGI stderr + local + l_c_str: C_STRING + do + l_c_str := c_buffer + l_c_str.set_string (a_message) + fcgi.put_error (l_c_str.item, l_c_str.count) + end + feature -- FCGI input copy_from_stdin (n: INTEGER; f: FILE) diff --git a/library/server/wsf/connector/all-safe.ecf b/library/server/wsf/connector/all-safe.ecf new file mode 100644 index 00000000..7105b665 --- /dev/null +++ b/library/server/wsf/connector/all-safe.ecf @@ -0,0 +1,30 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + + + + + + + + + + + + + diff --git a/library/server/wsf/connector/cgi-safe.ecf b/library/server/wsf/connector/cgi-safe.ecf new file mode 100644 index 00000000..2392fa12 --- /dev/null +++ b/library/server/wsf/connector/cgi-safe.ecf @@ -0,0 +1,22 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + + + + + diff --git a/library/server/wsf/connector/cgi.ecf b/library/server/wsf/connector/cgi.ecf new file mode 100644 index 00000000..50de1ffb --- /dev/null +++ b/library/server/wsf/connector/cgi.ecf @@ -0,0 +1,22 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + + + + + diff --git a/library/server/wsf/connector/cgi/wsf_cgi_service_launcher.e b/library/server/wsf/connector/cgi/wsf_cgi_service_launcher.e new file mode 100644 index 00000000..9d7693af --- /dev/null +++ b/library/server/wsf/connector/cgi/wsf_cgi_service_launcher.e @@ -0,0 +1,64 @@ +note + description: "[ + Component to launch the service using the default connector + + CGI for this class + + How-to: + + s: WSF_SERVICE_CGI_LAUNCHER + create s.make_and_launch (agent execute) + + execute (req: WSF_REQUEST; res: WSF_RESPONSE) + do + -- ... + end + ]" + date: "$Date$" + revision: "$Revision$" + +class + WSF_CGI_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_CGI_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/wsf/connector/libfcgi-safe.ecf b/library/server/wsf/connector/libfcgi-safe.ecf new file mode 100644 index 00000000..9e55d282 --- /dev/null +++ b/library/server/wsf/connector/libfcgi-safe.ecf @@ -0,0 +1,22 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + + + + + diff --git a/library/server/wsf/connector/libfcgi.ecf b/library/server/wsf/connector/libfcgi.ecf new file mode 100644 index 00000000..324ea5cb --- /dev/null +++ b/library/server/wsf/connector/libfcgi.ecf @@ -0,0 +1,22 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + + + + + diff --git a/library/server/wsf/connector/libfcgi/wsf_libfcgi_service_launcher.e b/library/server/wsf/connector/libfcgi/wsf_libfcgi_service_launcher.e new file mode 100644 index 00000000..5eca65f0 --- /dev/null +++ b/library/server/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/wsf/connector/license.lic b/library/server/wsf/connector/license.lic new file mode 100644 index 00000000..d4d72876 --- /dev/null +++ b/library/server/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/wsf/connector/nino-safe.ecf b/library/server/wsf/connector/nino-safe.ecf new file mode 100644 index 00000000..611af8b7 --- /dev/null +++ b/library/server/wsf/connector/nino-safe.ecf @@ -0,0 +1,26 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + + + + + + + + + diff --git a/library/server/wsf/connector/nino.ecf b/library/server/wsf/connector/nino.ecf new file mode 100644 index 00000000..d44407d2 --- /dev/null +++ b/library/server/wsf/connector/nino.ecf @@ -0,0 +1,26 @@ + + + + + + /EIFGENs$ + /\.git$ + /\.svn$ + + + + + + + + + + + + + + + + + diff --git a/library/server/wsf/connector/nino/wsf_nino_service_launcher.e b/library/server/wsf/connector/nino/wsf_nino_service_launcher.e new file mode 100644 index 00000000..a4159e9c --- /dev/null +++ b/library/server/wsf/connector/nino/wsf_nino_service_launcher.e @@ -0,0 +1,128 @@ +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 + do + port_number := 80 --| Default, but quite often, this port is already used ... + base_url := "" + + if attached options as opts then + 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 connector.make (Current) + if attached connector as conn then + conn.set_base (base_url) + if single_threaded then + conn.configuration.set_force_single_threaded (True) + end + conn.configuration.set_is_verbose (verbose) + end + end + +feature -- Execution + + launch + -- + -- using `port_number', `base_url', `verbose' and `single_threaded' + do + if attached connector as conn then + conn.set_base (base_url) + if single_threaded then + conn.configuration.set_force_single_threaded (True) + end + conn.configuration.set_is_verbose (verbose) + debug ("nino") + if verbose then + print ("Example: start a Nino web server on port " + port_number.out + + ", %Nand reply Hello World for any request such as http://localhost:" + port_number.out + "/" + base_url + "%N") + end + end + conn.configuration.http_server_port := port_number + conn.launch + end + end + +feature {NONE} -- Implementation + + port_number: INTEGER + + base_url: READABLE_STRING_8 + + verbose: BOOLEAN + + single_threaded: BOOLEAN + +feature -- Status report + + connector: detachable WGI_NINO_CONNECTOR + -- Default connector + + launchable: BOOLEAN + do + Result := Precursor and port_number > 0 + end + +;note + copyright: "2011-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/default/cgi-safe.ecf b/library/server/wsf/default/cgi-safe.ecf index db7056f7..f10d0274 100644 --- a/library/server/wsf/default/cgi-safe.ecf +++ b/library/server/wsf/default/cgi-safe.ecf @@ -7,16 +7,9 @@ /\.git$ /\.svn$ - - - - +
diff --git a/library/server/wsf/default/cgi.ecf b/library/server/wsf/default/cgi.ecf index e1efa845..6b525b01 100644 --- a/library/server/wsf/default/cgi.ecf +++ b/library/server/wsf/default/cgi.ecf @@ -9,14 +9,8 @@ - - - - - - - + diff --git a/library/server/wsf/default/cgi/wsf_default_service.e b/library/server/wsf/default/cgi/wsf_default_service.e new file mode 100644 index 00000000..dd76ca78 --- /dev/null +++ b/library/server/wsf/default/cgi/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/default/cgi/wsf_default_service_launcher.e b/library/server/wsf/default/cgi/wsf_default_service_launcher.e index f32fe160..458b736c 100644 --- a/library/server/wsf/default/cgi/wsf_default_service_launcher.e +++ b/library/server/wsf/default/cgi/wsf_default_service_launcher.e @@ -1,19 +1,6 @@ note - description: "[ - Component to launch the service using the default connector - - CGI 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 - ]" + description: "Summary description for {WSF_DEFAULT_SERVICE_LAUNCHER}." + author: "" date: "$Date$" revision: "$Revision$" @@ -21,36 +8,17 @@ class WSF_DEFAULT_SERVICE_LAUNCHER inherit - WSF_DEFAULT_SERVICE_LAUNCHER_I + WSF_CGI_SERVICE_LAUNCHER create make, make_and_launch, - make_and_launch_with_options + make_callback, + make_callback_and_launch, + make_and_launch_with_options -- obsolete -feature {NONE} -- Initialization - - initialize - 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_CGI_CONNECTOR - -- Default service name - -;note - copyright: "2011-2011, Eiffel Software and others" +note + copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software @@ -59,4 +27,5 @@ feature -- Status report Website http://www.eiffel.com Customer support http://support.eiffel.com ]" + end diff --git a/library/server/wsf/default/libfcgi-safe.ecf b/library/server/wsf/default/libfcgi-safe.ecf index d645258f..d22c1a37 100644 --- a/library/server/wsf/default/libfcgi-safe.ecf +++ b/library/server/wsf/default/libfcgi-safe.ecf @@ -7,16 +7,9 @@ /\.git$ /\.svn$ - - - - +