mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-07 15:22:31 +01:00
added 18.07
git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@2049 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
[[Property:uuid|5D7CBC54-D97A-4400-9335-9C8FB3CBE004]]
|
||||
[[Property:weight|0]]
|
||||
[[Property:title|EiffelWeb framework]]
|
||||
[[Property:link_title|EiffelWeb]]
|
||||
|
||||
= The EiffelWeb Framework (EWF) =
|
||||
|
||||
The EiffelWeb Framework provides a common framework to build easily web server application in Eiffel (portable on various connectors and platforms).
|
||||
|
||||
* Project on github: [https://github.com/EiffelWebFramework/EWF]
|
||||
* Associated website [http://www.eiffelweb.org/]
|
||||
* Latest documentation [https://github.com/EiffelWebFramework/EWF/blob/master/docs/workbook/workbook.md]
|
||||
* Gitter.im room [https://gitter.im/EiffelWebFramework/EWF]
|
||||
* Forum [https://groups.google.com/forum/#!forum/eiffel-web-framework]
|
||||
@@ -0,0 +1,5 @@
|
||||
[[Property:title|EiffelWeb Class Reference]]
|
||||
[[Property:weight|1]]
|
||||
[[Property:uuid|70bb6b4d-7b0f-6317-4c2b-618a80ef042d]]
|
||||
==View the [[ref:libraries/web/reference/index|EiffelWeb Class Reference]]==
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
[[Property:title|EiffelWeb Basic Sample]]
|
||||
[[Property:weight|0]]
|
||||
[[Property:uuid|da8f72cb-0ecd-464a-a558-cbf7d24301e3]]
|
||||
This sample shows how to retrieve and display information from a basic form on a web page.
|
||||
|
||||
|
||||
{{note|This sample requires a web server supporting CGI in order to be run. Both the Internet Information Services web server from Microsoft and the GNU Apache server may be used. }}
|
||||
|
||||
|
||||
==Compiling==
|
||||
|
||||
To compile the example:
|
||||
* Launch EiffelStudio.
|
||||
* Click '''Add project'''
|
||||
* Browse to ''$ISE_EIFFEL\examples\web\basic\''.
|
||||
* Choose ''web.ecf''
|
||||
* Choose the location where the project will be compiled, by default the same directory containing the configuration file.
|
||||
* Click '''OK'''.
|
||||
|
||||
==Installing==
|
||||
|
||||
You should copy the file ''web_demo.exe'' in the ''cgi_bin'' directory of your web server and the file ''sample.html'' in a directory on the web server.
|
||||
|
||||
==Running==
|
||||
|
||||
To run the example, access the page ''sample.html'' that you copied on the web server with a web browser (typically <nowiki>''http://localhost/sample.html''</nowiki>). Fill in the text field with a username and click ''Submit''. You should see a page displaying the name you just entered. Although not earth-shattering, this sample shows the basis for building more complex forms processing in Eiffel.
|
||||
|
||||
==Under the Hood==
|
||||
|
||||
This basic sample has just one class <eiffel>SAMPLE</eiffel> which inherits from <eiffel>CGI_INTERFACE. SAMPLE</eiffel> implements execute which retrieves the name entered in the form and creates a new <eiffel>HTML</eiffel> page with it.
|
||||
|
||||
|
||||
|
||||
See the EiffelWeb class reference for the class interfaces.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
[[Property:title|EiffelWeb Sample]]
|
||||
[[Property:weight|2]]
|
||||
[[Property:uuid|8d863248-ab60-bf4b-cfd0-f79c63309a1b]]
|
||||
The [[EiffelWeb Basic Sample|basic]] sample will get you started on the development of forms processing in Eiffel.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
[[Property:title|EiffelWeb Content Introduction]]
|
||||
[[Property:weight|0]]
|
||||
[[Property:uuid|df90086d-4265-4451-06bf-5e6e0603036e]]
|
||||
==CGI Applications==
|
||||
|
||||
The way a CGI application communicates with the Web browser is simple: when the user presses a button on an HTML form, with an associated action (such as ''Submit''), the browser starts the application whose path is indicated inside the HTML form declaration. It sends data corresponding to the HTTP request and to the input form information in the usual file descriptor ''In'', stores within environment variables the transaction environment of the request, and waits for the application message, expected in its ''Out'' canal. The ''In'' and '' Out ''canals are accessible via the class CGI_IN_AND_OUT. <br/>
|
||||
<br/>
|
||||
HTML forms are an easy way to collect user entries in a web page, which are sent by the browser to the CGI application. A simple example of a form is:
|
||||
<code>
|
||||
<form action="/cgi-bin/convert.exe" method="post">
|
||||
|
||||
<input type="text" name="Celsius">
|
||||
|
||||
<input type="submit">
|
||||
|
||||
</form >
|
||||
</code>
|
||||
|
||||
|
||||
When the user presses the submit button, the browser will launch the application located at ''/cgi-bin/convert.exe'' on the server, will use the HTTP Post protocol, and will store among others the environment variable ''Celsius'' with the value entered by the user.
|
||||
|
||||
==Advantages of using EiffelWeb==
|
||||
|
||||
With EiffelWeb, you can:
|
||||
* Design object-oriented systems
|
||||
* Access and use the Eiffel libraries
|
||||
* Increase maintainability because your code is reusable and readable
|
||||
* Deal with complexity because you use a language particularly efficient in the Business Modeling.
|
||||
* Use one/a few big Eiffel Web applications, which allow for an easier maintenance and provide better code readability and reusability than having a huge number of scripts.
|
||||
* Use the ''Design by Contract'' methodology, thanks to the debugging facilities provided by EiffelWeb.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
[[Property:title|EiffelWeb Tutorial]]
|
||||
[[Property:weight|0]]
|
||||
[[Property:uuid|e2b93aea-ec1b-5897-0b0a-adc5681a1dcb]]
|
||||
The Common Gateway Interface (CGI) emerged as the first way to present dynamically generated information on the World Wide Web. It allows the computer to process forms filled by the user and return appropriate information. <br/>
|
||||
|
||||
EiffelWeb was developed by Eiffel Software to provide Eiffel developers access to the CGI technology. The library makes it possible to write Eiffel systems that interact directly with the Web.
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
[[Property:title|Processing Requests]]
|
||||
[[Property:weight|1]]
|
||||
[[Property:uuid|f265e0d8-ca0e-8902-712c-1102b2916e9c]]
|
||||
EiffelWeb provides a complete set of features and interface which helps building a wide range of possible requests.
|
||||
|
||||
==Basic CGI Handling==
|
||||
|
||||
===Accessing Environment Variables===
|
||||
|
||||
Much of the information needed by CGI applications is made available via environment variables. Programs using EiffelWeb can access this information through the class CGI_ENVIRONMENT. <br/>
|
||||
These variables are usually used for the following purposes:
|
||||
* Getting information about the server itself
|
||||
* Checking the client browser
|
||||
* Restricting Access for specified Domains
|
||||
* Ensuring User Authentication and Identifications
|
||||
* Dealing with Cookies
|
||||
|
||||
===Accessing Input Values===
|
||||
|
||||
The browser sends in the ''In'' a stream containing the data relative to the user entry and selection at the applications starts. EiffelWeb stores each data element and its associated name within a Hash-Table, the feature <eiffel>form_data</eiffel> of class <eiffel>CGI_INTERFACE</eiffel>. You can access their values from your code with the interface defined in class <eiffel>CGI_FORMS</eiffel>, which allows you to retrieve text entries, to know whether a button was pressed or not, etc.
|
||||
|
||||
===Sending answers to the browser===
|
||||
|
||||
The response has to contain an HTTP header in order to be understood by the browser. Depending on the nature of the reply, an HTML page, a simple re-direction, an error notification, you will select different features and options. Your application must send at least a response header, indicating the status of the request if known. You may want to attach to it the text you wish to send back to the user. This text is usually written in HTML, so that it will display nicely on the user's browser; you can use for this purpose the class <eiffel>HTML_PAGE</eiffel>. You may then send the header followed by your text using the features <eiffel>send_to_browser</eiffel> of classes <eiffel>CGI_RESPONSE_HEADER</eiffel> and <eiffel>HTML_PAGE</eiffel>.
|
||||
|
||||
{{note|You may not write into a file before you have sent the answer to the browser. }}
|
||||
|
||||
===Dealing with Cookies===
|
||||
|
||||
You can access the cookies corresponding to a specific URL/domain thanks to the feature <eiffel>cookies</eiffel>, of class <eiffel>CGI_ENVIRONMENT</eiffel>. It is a hash-table, in which all the data with associated names as keys are stored.
|
||||
|
||||
To store a cookie on a machine, you can use the feature <eiffel>set_cookies</eiffel>, of class <eiffel>CGI_RESPONSE_HEADER</eiffel>.
|
||||
|
||||
==Advanced Topics==
|
||||
|
||||
===EiffelWeb and Security===
|
||||
|
||||
The information the server sends back may be confidential. Follow these steps to protect the page content:
|
||||
# Create an HTML page, for example by using class HTML_PAGE.
|
||||
# Store this page somewhere, with a random name.
|
||||
# Create an instance of class <eiffel>CGI_RESPONSE_HEADER</eiffel> and choose the secure redirect option. Then call <eiffel>send_to_browser</eiffel>.
|
||||
|
||||
===Complex Headers===
|
||||
|
||||
The Eiffel-Web application has the possibility to send a selection of different HTTP headers. They can be found in class <eiffel>CGI_RESPONSE_HEADER</eiffel>. In particular, it is advised to generate a status for each request, the value of the most common ones may be found in class [[ref:libraries/web/reference/cgi_common_status_types_chart|CGI_COMMON_STATUS_TYPES]] .
|
||||
|
||||
===Debugging facilities===
|
||||
|
||||
Design by Contract is one of the greatest strengths of the Eiffel programming language. When you usually run your application from EiffelStudio, you are notified when an assertion is violated and the tool offers different options in order to be able to find out its sources (feature and class tools, object inspectors, etc). However this cannot be applied to an EiffelWeb application, since it has to be run on the server. <br/>
|
||||
Therefore, EiffelWeb provides its own facilities for debugging. To test your classes at run-time, all you need to do is to set the Boolean feature <eiffel>is_debug_mode</eiffel> to <code>True</code> in your root class (which should inherit from <eiffel>CGI_INTERFACE</eiffel>). When your application crashes (because of an assertion or a bug), the exception trace will be displayed on the screen.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
[[Property:link_title|Obsolete EiffelWeb]]
|
||||
[[Property:title|Obsolete EiffelWeb]]
|
||||
[[Property:weight|1]]
|
||||
[[Property:uuid|b8a31d00-8ecb-7e32-df14-d92c91019826]]
|
||||
==EiffelWeb Library==
|
||||
|
||||
Type: Library <br/>
|
||||
Platform: Any <br/>
|
||||
|
||||
Eiffel classes that facilitate processing CGI web forms.
|
||||
|
||||
|
||||
6
documentation/18.07/solutions/web-technology/index.wiki
Normal file
6
documentation/18.07/solutions/web-technology/index.wiki
Normal file
@@ -0,0 +1,6 @@
|
||||
[[Property:title|Web technology]]
|
||||
[[Property:weight|-7]]
|
||||
[[Property:uuid|2b54659c-c982-239b-a9d9-003f3868c49f]]
|
||||
== Web technology solutions==
|
||||
|
||||
|
||||
Reference in New Issue
Block a user