Files
EWF/examples/tutorial/step_2.wiki
Jocelyn Fiat 0e3e97a7fd Added a few example based on the obsolete libraries (v0).
Updated the tutorial example.
Added WSF_MESSAGE_EXECUTION.
2015-06-10 16:49:23 +02:00

69 lines
2.0 KiB
Plaintext

Back to the [[step_1.wiki|step 1]]
or go to [[step_3.wiki|step 3]]
----
= Tutorial Step 2 =
* '''Goal''': Build a simple Hello World application
* '''Requirements''':
** know how to compile with Eiffel (EiffelStudio).
** [[step_1.wiki|Previous step]] completed
== "hello" project ==
* using the "wsf" library:
** It provides service, request, response, ...
* using the "default_standalone" library
** This is used to build the application in a portable manner, but for this compilation, it uses the standalone web server as connector.
** We use that standalone connection this tutorial, because there is no need to configure any apache, iis, and so on. And it is convenient to execute with EiffelStudio debugger.
* To see the result, you should open http://localhost/ on your web browser. Note if the application is using another port such as 9999, you should open http://localhost:9999/
* You will find inside [[step_2]] the "hello" project
** target "hello" provides a very simple implementation (But by default, it is using port 80 with standalone web server, which might already be busy by other application)
** target "hello_custom" which uses almost the same code, but in addition, you can use the ewf.ini file to precise the port number (9999 for this example)
* To see the result, open http://localhost/ in a web browser.
* Note, if the application is using port different from 80, such as 9999, open http://localhost:9999/
* Eiffel code
class
HELLO_APPLICATION
inherit
WSF_DEFAULT_SERVICE [HELLO_EXECUTION]
create
make_and_launch
end
class
HELLO_EXECUTION
inherit
WSF_EXECUTION
create
make
feature -- Execution
execute
local
msg: WSF_PAGE_RESPONSE
do
create msg.make_with_body ("Hello World")
response.send (msg)
end
end
Note: we could also declare the root class as being "WSF_DEFAULT_SERVICE [HELLO_EXECUTION]" to avoid this HELLO_APPLICATION class.
----
Back to the [[step_1.wiki|step 1]]
or go to [[step_3.wiki|step 3]]