diff --git a/examples/tutorial/README.wiki b/examples/tutorial/README.wiki index 30b3b388..789b4b19 100644 --- a/examples/tutorial/README.wiki +++ b/examples/tutorial/README.wiki @@ -24,36 +24,9 @@ For now, you just need to know EWF is compliant with EWSGI specification. = Tutorial = Now let's discover the Eiffel Web Framework with this tutorial. -1 - You will learn first, how to get and install EWF. -2 - build a simple Hello World application -3 - use the query and form parameter to build dynamic service -4 - And you will learn how to dispatch URL - -== Get EWF package == -=== From the archive === -- to be completed - -=== From the source === -- Requirement: install git on your machine (http://www.git-scm.org/) - - git clone --recursive https://github.com/EiffelWebFramework/EWF.git ewf - -And that's it for now. - -== Install EWF == -For now, there is nothing specific to do. - -(Note: if you want to use the "http_client" library, you will need to do a few extra steps to eventually compile Eiffel Curl.) - -== Step 1 == -[[tutorial_1.wiki|Check the first step]] - -== Step 2 == - -== Step 3 == - -== Step 4 == - - +# [[step_1.wiki|Step #1]]: You will learn first, how to get and install EWF. +# [[step_2.wiki|Step #2]]: build a simple Hello World application +# [[step_3.wiki|Step #3]]: use the query and form parameter to build dynamic service +# [[step_4.wiki|Step #4]]: And you will learn how to dispatch URL diff --git a/examples/tutorial/step_1.wiki b/examples/tutorial/step_1.wiki new file mode 100644 index 00000000..929b79fb --- /dev/null +++ b/examples/tutorial/step_1.wiki @@ -0,0 +1,22 @@ +[[README.wiki|Back to tutorial index]] + += Tutorial Step 1 = +* '''Goal''': learn how to get and install the Eiffel Web Framework +* '''Requirement''': EiffelStudio should be installed + +== Get EWF package == +=== From the archive === +* to be completed + +=== From the source === +* '''Requirement''': install [http://www.git-scm.org/ git] on your machine + + git clone --recursive https://github.com/EiffelWebFramework/EWF.git ewf + +== Install EWF == +For now, there is nothing specific to do. + +(Note: if you want to use the "http_client" library, you will need to do a few extra steps to eventually compile Eiffel Curl.) + +---- +Back to the [[README.wiki|index]] | Go to [[step_2.wiki|step 2]] diff --git a/examples/tutorial/step_2.wiki b/examples/tutorial/step_2.wiki new file mode 100644 index 00000000..6810816d --- /dev/null +++ b/examples/tutorial/step_2.wiki @@ -0,0 +1,27 @@ +[[README.wiki|Back to tutorial index]] + += Tutorial Step 2 = +* '''Goal''': Build a simple Hello World application +* '''Requirements''': +** know how to compile with Eiffel (EiffelStudio). +** [[step_1.wiki|Previous step]] completed + + +== Create "hello" project == +=== From the archive === +- to be completed + +=== From the source === +- Requirement: install git on your machine (http://www.git-scm.org/) + + git clone --recursive https://github.com/EiffelWebFramework/EWF.git ewf + +And that's it for now. + +== Install EWF == +For now, there is nothing specific to do. + +(Note: if you want to use the "http_client" library, you will need to do a few extra steps to eventually compile Eiffel Curl.) + +---- +Previous [[step_1|step 1]] | Go to [[step_3.wiki|step 3]] diff --git a/examples/tutorial/step_2/hello/application.e b/examples/tutorial/step_2/hello/application.e new file mode 100644 index 00000000..cad43e41 --- /dev/null +++ b/examples/tutorial/step_2/hello/application.e @@ -0,0 +1,38 @@ +note + description: "[ + APPLICATION implements the "Hello World" service. + + It inherits from WSF_DEFAULT_SERVICE to get default EWF connector ready + only `execute' needs to be implemented. + + ]" + +class + APPLICATION + +inherit + WSF_DEFAULT_RESPONSE_SERVICE + redefine + initialize + end + +create + make_and_launch + +feature {NONE} -- Initialization + + initialize + do + create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} service_options.make_from_file ("ewf.ini") + Precursor + end + +feature {NONE} -- Initialization + + response (req: WSF_REQUEST): WSF_PAGE_RESPONSE + do + create Result.make + Result.put_string ("Hello World") + end + +end diff --git a/examples/tutorial/step_2/hello/ewf.ini b/examples/tutorial/step_2/hello/ewf.ini new file mode 100644 index 00000000..fad6acb1 --- /dev/null +++ b/examples/tutorial/step_2/hello/ewf.ini @@ -0,0 +1,4 @@ +# For nino connector, use port 9999 +port=9999 + +#verbose=true diff --git a/examples/tutorial/step_2/hello/hello.ecf b/examples/tutorial/step_2/hello/hello.ecf new file mode 100644 index 00000000..92b64bc2 --- /dev/null +++ b/examples/tutorial/step_2/hello/hello.ecf @@ -0,0 +1,20 @@ + + + + + + /EIFGENs$ + /CVS$ + /.svn$ + + + + + + + + + + diff --git a/examples/tutorial/tutorial_3.wiki b/examples/tutorial/step_3.wiki similarity index 100% rename from examples/tutorial/tutorial_3.wiki rename to examples/tutorial/step_3.wiki diff --git a/examples/tutorial/tutorial_4.wiki b/examples/tutorial/step_4.wiki similarity index 100% rename from examples/tutorial/tutorial_4.wiki rename to examples/tutorial/step_4.wiki diff --git a/examples/tutorial/tutorial_1.wiki b/examples/tutorial/tutorial_1.wiki deleted file mode 100644 index adf9bd98..00000000 --- a/examples/tutorial/tutorial_1.wiki +++ /dev/null @@ -1,2 +0,0 @@ -= Tutorial Step 1 = - diff --git a/examples/tutorial/tutorial_2.wiki b/examples/tutorial/tutorial_2.wiki deleted file mode 100644 index f37e3c5e..00000000 --- a/examples/tutorial/tutorial_2.wiki +++ /dev/null @@ -1,2 +0,0 @@ -= Tutorial Step 2 = - diff --git a/library/server/wsf/default/cgi/wsf_default_response_service.e b/library/server/wsf/default/cgi/wsf_default_response_service.e new file mode 100644 index 00000000..0cefc7da --- /dev/null +++ b/library/server/wsf/default/cgi/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/wsf/default/cgi/wsf_default_service_launcher.e b/library/server/wsf/default/cgi/wsf_default_service_launcher.e index 458b736c..9c2df057 100644 --- a/library/server/wsf/default/cgi/wsf_default_service_launcher.e +++ b/library/server/wsf/default/cgi/wsf_default_service_launcher.e @@ -14,8 +14,7 @@ create make, make_and_launch, make_callback, - make_callback_and_launch, - make_and_launch_with_options -- obsolete + make_callback_and_launch note copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" diff --git a/library/server/wsf/default/libfcgi/wsf_default_response_service.e b/library/server/wsf/default/libfcgi/wsf_default_response_service.e new file mode 100644 index 00000000..0cefc7da --- /dev/null +++ b/library/server/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/wsf/default/libfcgi/wsf_default_service_launcher.e b/library/server/wsf/default/libfcgi/wsf_default_service_launcher.e index 1e37410b..82189381 100644 --- a/library/server/wsf/default/libfcgi/wsf_default_service_launcher.e +++ b/library/server/wsf/default/libfcgi/wsf_default_service_launcher.e @@ -14,8 +14,7 @@ create make, make_and_launch, make_callback, - make_callback_and_launch, - make_and_launch_with_options -- obsolete + make_callback_and_launch note copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" diff --git a/library/server/wsf/default/nino/wsf_default_response_service.e b/library/server/wsf/default/nino/wsf_default_response_service.e new file mode 100644 index 00000000..0cefc7da --- /dev/null +++ b/library/server/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/wsf/default/nino/wsf_default_service_launcher.e b/library/server/wsf/default/nino/wsf_default_service_launcher.e index 33961a86..aab44c4f 100644 --- a/library/server/wsf/default/nino/wsf_default_service_launcher.e +++ b/library/server/wsf/default/nino/wsf_default_service_launcher.e @@ -15,8 +15,7 @@ create make, make_and_launch, make_callback, - make_callback_and_launch, - make_and_launch_with_options -- obsolete + make_callback_and_launch note copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" diff --git a/library/server/wsf/src/response/wsf_download_response.e b/library/server/wsf/src/response/wsf_download_response.e index c077bc43..6e35e24d 100644 --- a/library/server/wsf/src/response/wsf_download_response.e +++ b/library/server/wsf/src/response/wsf_download_response.e @@ -104,7 +104,7 @@ feature -- Element change answer_head_request_method := b end -feature -- Basic operations +feature {WSF_SERVICE, WSF_RESPONSE} -- Basic operations send_to (res: WSF_RESPONSE) do diff --git a/library/server/wsf/src/response/wsf_file_response.e b/library/server/wsf/src/response/wsf_file_response.e index 658753ed..7c3d87d1 100644 --- a/library/server/wsf/src/response/wsf_file_response.e +++ b/library/server/wsf/src/response/wsf_file_response.e @@ -150,7 +150,7 @@ feature -- Element change update_content_length end -feature -- Output +feature {WSF_SERVICE, WSF_RESPONSE} -- Output send_to (res: WSF_RESPONSE) local diff --git a/library/server/wsf/src/response/wsf_html_page_response.e b/library/server/wsf/src/response/wsf_html_page_response.e index 0f7de3a1..68edc93d 100644 --- a/library/server/wsf/src/response/wsf_html_page_response.e +++ b/library/server/wsf/src/response/wsf_html_page_response.e @@ -110,7 +110,7 @@ feature -- Element change body := b end -feature -- Output +feature {WSF_SERVICE, WSF_RESPONSE} -- Output send_to (res: WSF_RESPONSE) local diff --git a/library/server/wsf/src/response/wsf_page_response.e b/library/server/wsf/src/response/wsf_page_response.e index 63ce9d16..56f5999b 100644 --- a/library/server/wsf/src/response/wsf_page_response.e +++ b/library/server/wsf/src/response/wsf_page_response.e @@ -79,7 +79,7 @@ feature -- Element change l_body.append (a_string) end -feature -- Output +feature {WSF_SERVICE, WSF_RESPONSE} -- Output send_to (res: WSF_RESPONSE) local diff --git a/library/server/wsf/src/response/wsf_redirection_response.e b/library/server/wsf/src/response/wsf_redirection_response.e index fb4d3035..4bf91f92 100644 --- a/library/server/wsf/src/response/wsf_redirection_response.e +++ b/library/server/wsf/src/response/wsf_redirection_response.e @@ -70,7 +70,7 @@ feature -- Element change content_type := Void end -feature -- Output +feature {WSF_SERVICE, WSF_RESPONSE} -- Output send_to (res: WSF_RESPONSE) local diff --git a/library/server/wsf/src/service/wsf_default_service_i.e b/library/server/wsf/src/service/wsf_default_service_i.e index 3b34d20b..d520a61e 100644 --- a/library/server/wsf/src/service/wsf_default_service_i.e +++ b/library/server/wsf/src/service/wsf_default_service_i.e @@ -11,13 +11,20 @@ inherit feature {NONE} -- Initialization - make_and_launch + frozen make_and_launch local l_launcher: G do + initialize create l_launcher.make_and_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 feature -- Default service options diff --git a/library/server/wsf/src/service/wsf_service_launcher.e b/library/server/wsf/src/service/wsf_service_launcher.e index 6499ae9a..c1d889f2 100644 --- a/library/server/wsf/src/service/wsf_service_launcher.e +++ b/library/server/wsf/src/service/wsf_service_launcher.e @@ -66,13 +66,6 @@ feature {NONE} -- Initialization make (create {WSF_CALLBACK_SERVICE}.make (a_callback), a_options) end - frozen make_and_launch_with_options (a_callback: like {WSF_CALLBACK_SERVICE}.callback; a_options: like options) - obsolete - "[2012-Mars-20] Use make_callback_and_launch (a_callback, a_options)" - do - make_callback_and_launch (a_callback, a_options) - end - initialize -- Initialize Current using `options' if attached -- and build the connector diff --git a/library/server/wsf/src/service/wsf_service_launcher_options.e b/library/server/wsf/src/service/wsf_service_launcher_options.e index 3f31fe73..be89cc4f 100644 --- a/library/server/wsf/src/service/wsf_service_launcher_options.e +++ b/library/server/wsf/src/service/wsf_service_launcher_options.e @@ -14,7 +14,14 @@ note class WSF_SERVICE_LAUNCHER_OPTIONS +inherit + ANY + redefine + default_create + end + create + default_create, make, make_from_array @@ -23,9 +30,15 @@ convert feature {NONE} -- Initialization + default_create + do + Precursor + create options.make (0) + end + make do - create options.make (0) + default_create end make_from_array (a_options: ARRAY [TUPLE [name: READABLE_STRING_GENERAL; value: detachable ANY]]) diff --git a/library/server/wsf/src/service/wsf_service_launcher_options_from_ini.e b/library/server/wsf/src/service/wsf_service_launcher_options_from_ini.e new file mode 100644 index 00000000..a46c84f1 --- /dev/null +++ b/library/server/wsf/src/service/wsf_service_launcher_options_from_ini.e @@ -0,0 +1,62 @@ +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 + +feature {NONE} -- Initialization + + make_from_file (a_filename: READABLE_STRING_32) + -- Initialize `Current'. + do + make + import (a_filename) + end + +feature {NONE} -- Implementation + + import (a_filename: READABLE_STRING_32) + -- Import ini file content + local + f: PLAIN_TEXT_FILE + l,v: STRING_8 + p: INTEGER + do + --FIXME: handle unicode filename here. + create f.make (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 + +end diff --git a/library/server/wsf/src/wsf_response.e b/library/server/wsf/src/wsf_response.e index 146717af..0c90ab7f 100644 --- a/library/server/wsf/src/wsf_response.e +++ b/library/server/wsf/src/wsf_response.e @@ -265,22 +265,6 @@ feature -- Output operation feature -- Response object - put_response (a_message: WSF_RESPONSE_MESSAGE) - -- Set `a_message' as the whole response to the client - --| `a_message' is responsible to sent the status code, the header and the content - obsolete - "[2012-Mars-19] Use `send (a_message)' " - require - header_not_committed: not header_committed - status_not_committed: not status_committed - no_message_committed: not message_committed - do - a_message.send_to (Current) - ensure - status_committed: status_committed - header_committed: header_committed - end - send (a_message: WSF_RESPONSE_MESSAGE) -- Set `a_message' as the whole response to the client --| `a_message' is responsible to sent the status code, the header and the content diff --git a/library/server/wsf/src/wsf_response_message.e b/library/server/wsf/src/wsf_response_message.e index b82e8499..3e5c0300 100644 --- a/library/server/wsf/src/wsf_response_message.e +++ b/library/server/wsf/src/wsf_response_message.e @@ -7,9 +7,11 @@ note deferred class WSF_RESPONSE_MESSAGE -feature -- Output +feature {WSF_SERVICE, WSF_RESPONSE} -- Output send_to (res: WSF_RESPONSE) + -- Send Current message to `res' + --| This should not be called by user's code directly require header_not_committed: not res.header_committed status_not_committed: not res.status_committed