diff --git a/examples/tutorial/step_3/hello/src/hello_application.e b/examples/tutorial/step_3/hello/src/hello_application.e
index 3595eb36..6220e3f7 100644
--- a/examples/tutorial/step_3/hello/src/hello_application.e
+++ b/examples/tutorial/step_3/hello/src/hello_application.e
@@ -22,7 +22,7 @@ inherit
create
make_and_launch
-feature {NONE} -- Initialization
+feature {NONE} -- Execution
response (req: WSF_REQUEST): WSF_HTML_PAGE_RESPONSE
-- Computed response message.
diff --git a/examples/tutorial/step_4/hello/ewf.ini b/examples/tutorial/step_4/hello/ewf.ini
new file mode 100644
index 00000000..fad6acb1
--- /dev/null
+++ b/examples/tutorial/step_4/hello/ewf.ini
@@ -0,0 +1,4 @@
+# For nino connector, use port 9999
+port=9999
+
+#verbose=true
diff --git a/examples/tutorial/step_4/hello/hello.ecf b/examples/tutorial/step_4/hello/hello.ecf
new file mode 100644
index 00000000..1d54ebf1
--- /dev/null
+++ b/examples/tutorial/step_4/hello/hello.ecf
@@ -0,0 +1,19 @@
+
+
Click here to quit.")
+ --| We should html encode this name
+ --| but to keep the example simple, we don't do that for now.
+ else
+ --| Otherwise, ask for name
+ mesg.set_body ("[
+
You will be redirected to " + redir.url_location + " in " + redir.delay.out + " second(s) ...
") + Result := redir + else + create html.make + html.set_title ("Bad request") + html.set_body ("Bad request: missing user parameter") + Result := html + end + end + +feature {NONE} -- Initialization + + initialize + do + --| The following line is to be able to load options from the file ewf.ini + create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} service_options.make_from_file ("ewf.ini") + + --| If you don't need any custom options, you are not obliged to redefine `initialize' + Precursor + + --| Initialize router + initialize_router + end + + +end diff --git a/examples/upload_image/src/image_uploader.e b/examples/upload_image/src/image_uploader.e index 7b5fc905..0517c6a8 100644 --- a/examples/upload_image/src/image_uploader.e +++ b/examples/upload_image/src/image_uploader.e @@ -31,12 +31,6 @@ feature {NONE} -- Initialization make_and_launch end - create_router - -- Create router - do - create router.make (5) - end - setup_router -- Setup router local diff --git a/library/server/wsf/router/uri/default/wsf_uri_routed_service.e b/library/server/wsf/router/uri/default/wsf_uri_routed_service.e index 105421a6..f5ff1015 100644 --- a/library/server/wsf/router/uri/default/wsf_uri_routed_service.e +++ b/library/server/wsf/router/uri/default/wsf_uri_routed_service.e @@ -13,6 +13,14 @@ inherit router end +feature {NONE} -- Initialization + + create_router + -- Create router + --| it can be redefine to create with precise count if needed. + do + create router.make (0) + end feature -- Router router: WSF_URI_ROUTER diff --git a/library/server/wsf/router/uri_template/default/wsf_uri_template_routed_service.e b/library/server/wsf/router/uri_template/default/wsf_uri_template_routed_service.e index bfc06ec3..af11bf51 100644 --- a/library/server/wsf/router/uri_template/default/wsf_uri_template_routed_service.e +++ b/library/server/wsf/router/uri_template/default/wsf_uri_template_routed_service.e @@ -13,6 +13,15 @@ inherit router end +feature {NONE} -- Initialization + + create_router + -- Create router + --| it can be redefine to create with precise count if needed. + do + create router.make (0) + end + feature -- Router router: WSF_URI_TEMPLATE_ROUTER diff --git a/library/server/wsf/src/response/wsf_html_delayed_redirection_response.e b/library/server/wsf/src/response/wsf_html_delayed_redirection_response.e new file mode 100644 index 00000000..231c876c --- /dev/null +++ b/library/server/wsf/src/response/wsf_html_delayed_redirection_response.e @@ -0,0 +1,77 @@ +note + description: "[ + Delayed redirection with HTML content using META tag + ]" + date: "$Date$" + revision: "$Revision$" + +class + WSF_HTML_DELAYED_REDIRECTION_RESPONSE + +inherit + WSF_HTML_PAGE_RESPONSE + rename + make as make_html + redefine + append_html_head_code + end + +create + make + +feature {NONE} -- Initialization + + make (a_url_location: like url_location; a_delay_in_seconds: INTEGER) + do + url_location := a_url_location + delay := a_delay_in_seconds + make_html + set_status_code ({HTTP_STATUS_CODE}.found) + end + +feature -- Header + + url_location: STRING_8 + -- New url location after redirection + + delay: INTEGER + +feature -- Element change + + set_url_location (a_url_location: like url_location) + -- Set `url_location' to `a_url_location' + do + url_location := a_url_location + end + + set_delay (a_seconds: INTEGER) + do + delay := a_seconds + end + +feature {NONE} -- Output + + append_html_head_code (s: STRING_8) + local + h_lines: like head_lines + l_lines: like head_lines + do + h_lines := head_lines + l_lines := head_lines.twin + head_lines := l_lines + add_meta_http_equiv ("refresh", delay.out + ";url=" + url_location) + Precursor (s) + head_lines := h_lines + 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/src/response/wsf_html_page_response.e b/library/server/wsf/src/response/wsf_html_page_response.e index 68edc93d..3c0b33b4 100644 --- a/library/server/wsf/src/response/wsf_html_page_response.e +++ b/library/server/wsf/src/response/wsf_html_page_response.e @@ -114,8 +114,6 @@ feature {WSF_SERVICE, WSF_RESPONSE} -- Output send_to (res: WSF_RESPONSE) local - t: like title - lines: like head_lines b: like body h: like header s: STRING_8 @@ -131,6 +129,32 @@ feature {WSF_SERVICE, WSF_RESPONSE} -- Output end s.append (">%N") + append_html_head_code (s) + append_html_body_code (s) + + + s.append ("