Fixed more markdown syntax usage issue.
This commit is contained in:
@@ -37,7 +37,7 @@ note: on linux (debian), use
|
|||||||
|
|
||||||
* Build EWF application
|
* Build EWF application
|
||||||
|
|
||||||
ec -config [app.ecf] -target [app_cgi] -finalize -c_compile -project_path
|
```ec -config [app.ecf] -target [app_cgi] -finalize -c_compile -project_path```
|
||||||
|
|
||||||
|
|
||||||
>Note: change app.ecf and target app_cgi based on your own configuration.
|
>Note: change app.ecf and target app_cgi based on your own configuration.
|
||||||
@@ -47,6 +47,7 @@ note: on linux (debian), use
|
|||||||
Copy the app.exe and the folder _www_ into a folder served by apache2, for example under.
|
Copy the app.exe and the folder _www_ into a folder served by apache2, for example under.
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
<APACHE_PATH>/htdocs.
|
<APACHE_PATH>/htdocs.
|
||||||
|
|
||||||
<APACHE_PATH> = path to your apache installation
|
<APACHE_PATH> = path to your apache installation
|
||||||
@@ -59,11 +60,14 @@ Copy the app.exe and the folder _www_ into a folder served by apache2, for exam
|
|||||||
AllowOverride All --
|
AllowOverride All --
|
||||||
Require all granted -- this is required in Apache 2.4.4
|
Require all granted -- this is required in Apache 2.4.4
|
||||||
</Directory>
|
</Directory>
|
||||||
|
```
|
||||||
|
|
||||||
Check that you have the following modules enabled
|
Check that you have the following modules enabled
|
||||||
|
|
||||||
|
```
|
||||||
LoadModule cgi_module modules/mod_cgi.so
|
LoadModule cgi_module modules/mod_cgi.so
|
||||||
LoadModule rewrite_module modules/mod_rewrite.so
|
LoadModule rewrite_module modules/mod_rewrite.so
|
||||||
|
```
|
||||||
|
|
||||||
#### Tip:
|
#### Tip:
|
||||||
>To check the syntax of your httpd.conf file. From command line run the following
|
>To check the syntax of your httpd.conf file. From command line run the following
|
||||||
@@ -76,6 +80,7 @@ Check that you have the following modules enabled
|
|||||||
|
|
||||||
#### .htaccess
|
#### .htaccess
|
||||||
|
|
||||||
|
```
|
||||||
Options +ExecCGI +Includes +FollowSymLinks -Indexes
|
Options +ExecCGI +Includes +FollowSymLinks -Indexes
|
||||||
AddHandler cgi-script exe
|
AddHandler cgi-script exe
|
||||||
|
|
||||||
@@ -90,7 +95,8 @@ Check that you have the following modules enabled
|
|||||||
RewriteRule ^(.*)$ $service/$1
|
RewriteRule ^(.*)$ $service/$1
|
||||||
|
|
||||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
|
||||||
</IfModule
|
</IfModule>
|
||||||
|
```
|
||||||
|
|
||||||
>Replace $service with the name of your executable service, for example app_service.exe
|
>Replace $service with the name of your executable service, for example app_service.exe
|
||||||
|
|
||||||
@@ -107,7 +113,7 @@ note: on linux (debian), use
|
|||||||
|
|
||||||
* Build EWF application
|
* Build EWF application
|
||||||
|
|
||||||
ec -config [app.ecf] -target [app_fcgi] -finalize -c_compile -project_path .
|
``` ec -config [app.ecf] -target [app_fcgi] -finalize -c_compile -project_path .```
|
||||||
|
|
||||||
>Note: change app.ecf and target app_fcgi based on your own configuration.
|
>Note: change app.ecf and target app_fcgi based on your own configuration.
|
||||||
|
|
||||||
@@ -115,6 +121,7 @@ note: on linux (debian), use
|
|||||||
|
|
||||||
Copy the app.exe and the folder "www" into a folder served by apache2, for example under
|
Copy the app.exe and the folder "www" into a folder served by apache2, for example under
|
||||||
|
|
||||||
|
```
|
||||||
<APACHE_PATH>/htdocs.
|
<APACHE_PATH>/htdocs.
|
||||||
|
|
||||||
<APACHE_PATH> = path to your apache installation
|
<APACHE_PATH> = path to your apache installation
|
||||||
@@ -127,6 +134,7 @@ Copy the app.exe and the folder "www" into a folder served by apache2, for exam
|
|||||||
AllowOverride All --
|
AllowOverride All --
|
||||||
Require all granted -- this is required in Apache 2.4.4
|
Require all granted -- this is required in Apache 2.4.4
|
||||||
</Directory>
|
</Directory>
|
||||||
|
```
|
||||||
|
|
||||||
>Check that you have the following modules enabled
|
>Check that you have the following modules enabled
|
||||||
|
|
||||||
@@ -158,7 +166,7 @@ http://perishablepress.com/stupid-htaccess-tricks/
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### .htaccess
|
#### .htaccess
|
||||||
|
```
|
||||||
Options +ExecCGI +Includes +FollowSymLinks -Indexes
|
Options +ExecCGI +Includes +FollowSymLinks -Indexes
|
||||||
|
|
||||||
<IfModule mod_fcgid.c>
|
<IfModule mod_fcgid.c>
|
||||||
@@ -182,6 +190,7 @@ http://perishablepress.com/stupid-htaccess-tricks/
|
|||||||
|
|
||||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
```
|
||||||
|
|
||||||
Replace $service with the name of your executable $service, for example app_service.exe
|
Replace $service with the name of your executable $service, for example app_service.exe
|
||||||
You will need to create an service.ews file, this file will be located at the same place where you copy your app service executable.
|
You will need to create an service.ews file, this file will be located at the same place where you copy your app service executable.
|
||||||
|
|||||||
@@ -41,20 +41,25 @@ EWF `WSF_REQUEST` class, provides features to handling this form parsing automat
|
|||||||
|
|
||||||
### Query Parameters
|
### Query Parameters
|
||||||
|
|
||||||
|
```eiffel
|
||||||
WSF_REQUEST.query_parameters: ITERABLE [WSF_VALUE]
|
WSF_REQUEST.query_parameters: ITERABLE [WSF_VALUE]
|
||||||
-- All query parameters
|
-- All query parameters
|
||||||
|
|
||||||
WSF_REQUEST.query_parameter (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE
|
WSF_REQUEST.query_parameter (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE
|
||||||
-- Query parameter for name `a_name'.
|
-- Query parameter for name `a_name'.
|
||||||
|
```
|
||||||
|
|
||||||
<a name="form_parameters"></a>
|
<a name="form_parameters"></a>
|
||||||
|
|
||||||
### Form Parameters
|
### Form Parameters
|
||||||
|
|
||||||
|
```eiffel
|
||||||
WSF_REQUEST.form_parameters: ITERABLE [WSF_VALUE]
|
WSF_REQUEST.form_parameters: ITERABLE [WSF_VALUE]
|
||||||
-- All form parameters sent by a POST
|
-- All form parameters sent by a POST
|
||||||
|
|
||||||
WSF_REQUEST.form_parameter (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE
|
WSF_REQUEST.form_parameter (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE
|
||||||
-- Field for name `a_name'.
|
-- Field for name `a_name'.
|
||||||
|
```
|
||||||
|
|
||||||
The values supplied to `form_parameter` and `query_parameter` are _case_ _sensitive_.
|
The values supplied to `form_parameter` and `query_parameter` are _case_ _sensitive_.
|
||||||
|
|
||||||
@@ -63,9 +68,11 @@ The values supplied to `form_parameter` and `query_parameter` are _case_ _sensit
|
|||||||
### Read Data
|
### Read Data
|
||||||
The previous features, let you read the data one way for `GET` request and a different way for `POST` request. **WSF_REQUEST** provide a feature to read all the data in a uniform way.
|
The previous features, let you read the data one way for `GET` request and a different way for `POST` request. **WSF_REQUEST** provide a feature to read all the data in a uniform way.
|
||||||
|
|
||||||
|
```eiffel
|
||||||
WSF_REQUEST.item (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE
|
WSF_REQUEST.item (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE
|
||||||
-- Variable named `a_name' from any of the variables container
|
-- Variable named `a_name' from any of the variables container
|
||||||
-- and following a specific order: form_, query_ and path_ parameters
|
-- and following a specific order: form_, query_ and path_ parameters
|
||||||
|
```
|
||||||
|
|
||||||
So, you can use **WSF_REQUEST.item** feature exactly the same way for `GET` and `POST` request.
|
So, you can use **WSF_REQUEST.item** feature exactly the same way for `GET` and `POST` request.
|
||||||
|
|
||||||
@@ -119,7 +126,7 @@ Suppose we have the following HTML5 form using method `POST`. This HTML5 form ha
|
|||||||
### How to read all parameter names
|
### How to read all parameter names
|
||||||
To read all the parameters names we simple call **WSF_REQUEST.form_parameters**.
|
To read all the parameters names we simple call **WSF_REQUEST.form_parameters**.
|
||||||
|
|
||||||
```
|
```eiffel
|
||||||
req: WSF_REQUEST
|
req: WSF_REQUEST
|
||||||
across req.form_parameters as ic loop show_parameter_name (ic.item.key) end
|
across req.form_parameters as ic loop show_parameter_name (ic.item.key) end
|
||||||
```
|
```
|
||||||
@@ -127,7 +134,7 @@ To read all the parameters names we simple call **WSF_REQUEST.form_parameters**.
|
|||||||
|
|
||||||
### How to read single values
|
### How to read single values
|
||||||
To read a particular parameter, a single value, for example `given-name`, we simple call **WSF_REQUEST.form_parameter (a_name)** and we check if it's attached to **WSF_STRING** (represents a String parameter)
|
To read a particular parameter, a single value, for example `given-name`, we simple call **WSF_REQUEST.form_parameter (a_name)** and we check if it's attached to **WSF_STRING** (represents a String parameter)
|
||||||
```
|
```eiffel
|
||||||
req: WSF_REQUEST
|
req: WSF_REQUEST
|
||||||
if attached {WSF_STRING} req.form_paramenter ('given-name') as l_given_name then
|
if attached {WSF_STRING} req.form_paramenter ('given-name') as l_given_name then
|
||||||
-- Work with the given parameter, for example populate an USER object
|
-- Work with the given parameter, for example populate an USER object
|
||||||
@@ -142,7 +149,7 @@ To read a particular parameter, a single value, for example `given-name`, we sim
|
|||||||
|
|
||||||
To read multiple values, for example in the case of `languages`, we simple call **WSF_REQUEST.form_parameter (a_name)** and we check if it's attached to **WSF_MULTIPLE_STRING** (represents a String parameter)
|
To read multiple values, for example in the case of `languages`, we simple call **WSF_REQUEST.form_parameter (a_name)** and we check if it's attached to **WSF_MULTIPLE_STRING** (represents a String parameter)
|
||||||
|
|
||||||
```
|
```eiffel
|
||||||
req: WSF_REQUEST
|
req: WSF_REQUEST
|
||||||
idioms: LIST[STRING]
|
idioms: LIST[STRING]
|
||||||
-- the argument is case sensitive
|
-- the argument is case sensitive
|
||||||
@@ -170,7 +177,7 @@ This is particularly useful when you have a request with the following format
|
|||||||
|
|
||||||
To read table values, for example in the case of `tab`, we simple call **WSF_REQUEST.form_parameter (a_name)** and we check if it's attached to **WSF_TABLE**.
|
To read table values, for example in the case of `tab`, we simple call **WSF_REQUEST.form_parameter (a_name)** and we check if it's attached to **WSF_TABLE**.
|
||||||
|
|
||||||
```
|
```eiffel
|
||||||
if attached {WSF_TABLE} req.query_parameter ("tab") as l_tab then
|
if attached {WSF_TABLE} req.query_parameter ("tab") as l_tab then
|
||||||
l_parameter_names.append ("<br>")
|
l_parameter_names.append ("<br>")
|
||||||
l_parameter_names.append (l_tab.name)
|
l_parameter_names.append (l_tab.name)
|
||||||
@@ -197,7 +204,7 @@ You can also access the data in raw format, it means you will need to parse and
|
|||||||
|
|
||||||
To read raw data you need to do this
|
To read raw data you need to do this
|
||||||
|
|
||||||
```
|
```eiffel
|
||||||
l_raw_data:STRING
|
l_raw_data:STRING
|
||||||
|
|
||||||
req.set_raw_input_data_recorded (True)
|
req.set_raw_input_data_recorded (True)
|
||||||
@@ -242,14 +249,14 @@ So supose we have the following form
|
|||||||
|
|
||||||
The class **WSF_REQUEST** has a mechanism to work with uploaded files. We can call the query
|
The class **WSF_REQUEST** has a mechanism to work with uploaded files. We can call the query
|
||||||
|
|
||||||
```
|
```eiffel
|
||||||
WSF_REQUEST.has_uploaded_file: BOOLEAN
|
WSF_REQUEST.has_uploaded_file: BOOLEAN
|
||||||
-- Has any uploaded file?
|
-- Has any uploaded file?
|
||||||
```
|
```
|
||||||
|
|
||||||
to check if the request form parameters has any uploaded file, we can call the feature
|
to check if the request form parameters has any uploaded file, we can call the feature
|
||||||
|
|
||||||
```
|
```eiffel
|
||||||
WSF_REQUEST.uploaded_files: ITERABLE [WSF_UPLOADED_FILE]
|
WSF_REQUEST.uploaded_files: ITERABLE [WSF_UPLOADED_FILE]
|
||||||
-- uploaded files values
|
-- uploaded files values
|
||||||
--| filename: original path from the user
|
--| filename: original path from the user
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ That section explains how to read HTTP information sent by the browser via the r
|
|||||||
The Eiffel Web Framework is using the traditional Common Gateway Interface (CGI) programming interface to access the header fields, query and form parameters.
|
The Eiffel Web Framework is using the traditional Common Gateway Interface (CGI) programming interface to access the header fields, query and form parameters.
|
||||||
Among other, this means the header fields are exposed with associated CGI field names:
|
Among other, this means the header fields are exposed with associated CGI field names:
|
||||||
- the header field name are uppercased, and any dash "-" replaced by underscore "_".
|
- the header field name are uppercased, and any dash "-" replaced by underscore "_".
|
||||||
- and also prefixed by "HTTP_" except for CONTENT_TYPE and CONTENT_LENGTH.
|
- and also prefixed by "HTTP_" except for `CONTENT_TYPE` and `CONTENT_LENGTH`.
|
||||||
- For instance `X-Server` will be known as `HTTP_X_SERVER`.
|
- For instance `X-Server` will be known as `HTTP_X_SERVER`.
|
||||||
|
|
||||||
<a name="read_header"></a>
|
<a name="read_header"></a>
|
||||||
|
|||||||
Reference in New Issue
Block a user