Merge branch 'master' of github.com:jocelyn/Eiffel-Web-Framework
This commit is contained in:
@@ -1,21 +1,24 @@
|
||||
= Eiffel Web Framework =
|
||||
|
||||
== Why would you use the Eiffel Web Framework ? ==
|
||||
|
||||
To enjoy the advantage of the Eiffel technology (language, DbC, methods, tools)
|
||||
To write once and run on any web server, on any platforms thanks to the notion of connector.
|
||||
|
||||
== What is a connector? ==
|
||||
|
||||
A connector is the layer between the underlying httpd server, and your application based on EWF.
|
||||
Currently, 3 connectors are available within EWF (but others are available outside).
|
||||
CGI: the common CGI application (apache, iis, ...)
|
||||
- FastCGI: on any server supporting libfcgi handling (apache, iis, ...)
|
||||
- Nino: using the standalone Eiffel Web Nino server, you can run anywhere easily, and debug simply with EiffelStudio's debugger
|
||||
* CGI: the common CGI application (apache, iis, ...)
|
||||
* FastCGI: on any server supporting libfcgi handling (apache, iis, ...)
|
||||
* Nino: using the standalone Eiffel Web Nino server, you can run anywhere easily, and debug simply with EiffelStudio's debugger
|
||||
|
||||
Supporting a new connector is fairly simple, it just has to support the simple EWSGI specification which is really small. Then EWF will bring the power on top of it.
|
||||
|
||||
So you can build your application and be sure you will be able to run it ... anywhere thanks to the conceіpt of connectors.
|
||||
|
||||
== EWSGI specification ==
|
||||
|
||||
EWF relies on a small core specification, named EWSGI (Eiffel Web Servєr Gateway Interface).
|
||||
It is very limited on purpose to allow building new connector very easily.
|
||||
|
||||
@@ -23,7 +26,8 @@ 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.
|
||||
Now let's discover the Eiffel Web Framework with this tutorial:
|
||||
|
||||
# [[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 parameter to build dynamic service
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
[[README.wiki|Back to tutorial index]]
|
||||
Back to the [[README.wiki|index]]
|
||||
or go to [[step_2.wiki|step 2]]
|
||||
|
||||
= Tutorial Step 1 =
|
||||
* '''Goal''': learn how to get and install the Eiffel Web Framework
|
||||
@@ -11,12 +12,14 @@
|
||||
=== From the source ===
|
||||
* '''Requirement''': install [http://www.git-scm.org/ git] on your machine
|
||||
|
||||
git clone --recursive https://github.com/EiffelWebFramework/EWF.git ewf
|
||||
$ 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]]
|
||||
Back to the [[README.wiki|index]]
|
||||
or go to [[step_2.wiki|step 2]]
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
[[README.wiki|Back to tutorial index]]
|
||||
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
|
||||
** [[step_1.wiki|Previous step]] completed
|
||||
|
||||
|
||||
== "hello" project ==
|
||||
@@ -18,5 +21,30 @@
|
||||
** target "hello" provides a very simple implementation (But by default, it is using port 80 with Eiffel Web Nino, 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)
|
||||
|
||||
* Eiffel code
|
||||
class
|
||||
HELLO_APPLICATION
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_RESPONSE_SERVICE
|
||||
|
||||
create
|
||||
make_and_launch
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
response (req: WSF_REQUEST): WSF_PAGE_RESPONSE
|
||||
-- Computed response message.
|
||||
do
|
||||
create Result.make
|
||||
Result.put_string ("Hello World")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
----
|
||||
Previous [[step_1|step 1]] | Go to [[step_3.wiki|step 3]]
|
||||
|
||||
Back to the [[step_1.wiki|step 1]]
|
||||
or go to [[step_3.wiki|step 3]]
|
||||
|
||||
|
||||
@@ -1,15 +1,58 @@
|
||||
[[README.wiki|Back to tutorial index]]
|
||||
Back to the [[step_2.wiki|step 2]]
|
||||
or go to [[step_4.wiki|step 4]]
|
||||
|
||||
----
|
||||
|
||||
= Tutorial Step 3 =
|
||||
* '''Goal''': Build Hello $user application using form parameter as input
|
||||
* '''Requirements''':
|
||||
** know how to compile with Eiffel (EiffelStudio).
|
||||
** [[step_2.wiki|Previous step]] completed
|
||||
** [[step_2.wiki|Previous step ]] completed
|
||||
|
||||
== "hello" project ==
|
||||
* Let's start from the "hello_custom" project
|
||||
* you will learn how to use the req: WSF_REQUEST argument
|
||||
* See the hello project from [[step_3|step #3]] folder
|
||||
|
||||
* You can find code in [[step_3]] folder :
|
||||
|
||||
response (req: WSF_REQUEST): WSF_HTML_PAGE_RESPONSE
|
||||
-- Computed response message.
|
||||
do
|
||||
--| It is now returning a WSF_HTML_PAGE_RESPONSE
|
||||
--| Since it is easier for building html page
|
||||
create Result.make
|
||||
Result.set_title ("EWF tutorial / Hello World!")
|
||||
--| Check if the request contains a parameter named "user"
|
||||
--| this could be a query, or a form parameter
|
||||
if attached req.string_item ("user") as l_user then
|
||||
--| If yes, say hello world #name
|
||||
Result.set_body ("Hello " + l_user + "!")
|
||||
--| We should html encode this name
|
||||
--| but to keep the example simple, we don't do that for now.
|
||||
else
|
||||
--| Otherwise, ask for name
|
||||
Result.set_body ("[
|
||||
<form action="/" method="POST">
|
||||
<p>Hello, what is your name?</p>
|
||||
<input type="text" name="user"/>
|
||||
<input type="submit" value="Validate"/>
|
||||
</form>
|
||||
]"
|
||||
)
|
||||
end
|
||||
--| note:
|
||||
--| 1) Source of the parameter, we could have used
|
||||
--| req.query_parameter ("user") to search only in the query string
|
||||
--| req.form_parameter ("user") to search only in the form parameters
|
||||
--| 2) response type
|
||||
--| it could also have used WSF_PAGE_REPONSE, and build the html in the code
|
||||
--|
|
||||
end
|
||||
|
||||
----
|
||||
Previous [[step_2|step 2]] | Go to [[step_4.wiki|step 4]]
|
||||
|
||||
Back to the [[step_2.wiki|step 2]]
|
||||
or go to [[step_4.wiki|step 4]]
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +1,13 @@
|
||||
Back to the [[step_3.wiki|step 3]]
|
||||
or go to the [[README.wiki|index]]
|
||||
|
||||
----
|
||||
|
||||
= Tutorial Step 4 =
|
||||
|
||||
|
||||
----
|
||||
|
||||
Back to the [[step_3.wiki|step 3]]
|
||||
or go to the [[README.wiki|index]]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user