From 7be394c6897be9fde2a609142952b922be10f8ff Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Sun, 12 Feb 2017 12:29:58 +0100 Subject: [PATCH] Fixed more markdown syntax usage issue. --- doc/workbook/deployment/readme.md | 17 +++++++++++++---- doc/workbook/handling_request/form.md | 21 ++++++++++++++------- doc/workbook/handling_request/headers.md | 2 +- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/doc/workbook/deployment/readme.md b/doc/workbook/deployment/readme.md index 91a91792..8e8afd6a 100644 --- a/doc/workbook/deployment/readme.md +++ b/doc/workbook/deployment/readme.md @@ -37,7 +37,7 @@ note: on linux (debian), use * 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. @@ -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. +``` /htdocs. = 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 -- Require all granted -- this is required in Apache 2.4.4 +``` Check that you have the following modules enabled +``` LoadModule cgi_module modules/mod_cgi.so LoadModule rewrite_module modules/mod_rewrite.so +``` #### Tip: >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 +``` Options +ExecCGI +Includes +FollowSymLinks -Indexes AddHandler cgi-script exe @@ -90,7 +95,8 @@ Check that you have the following modules enabled RewriteRule ^(.*)$ $service/$1 RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] - +``` >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 - 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. @@ -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 +``` /htdocs. = 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 -- Require all granted -- this is required in Apache 2.4.4 +``` >Check that you have the following modules enabled @@ -158,7 +166,7 @@ http://perishablepress.com/stupid-htaccess-tricks/ ``` #### .htaccess - +``` Options +ExecCGI +Includes +FollowSymLinks -Indexes @@ -182,6 +190,7 @@ http://perishablepress.com/stupid-htaccess-tricks/ RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] +``` 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. diff --git a/doc/workbook/handling_request/form.md b/doc/workbook/handling_request/form.md index 19f9ee2e..8f6ded6d 100644 --- a/doc/workbook/handling_request/form.md +++ b/doc/workbook/handling_request/form.md @@ -41,20 +41,25 @@ EWF `WSF_REQUEST` class, provides features to handling this form parsing automat ### Query Parameters +```eiffel WSF_REQUEST.query_parameters: ITERABLE [WSF_VALUE] -- All query parameters WSF_REQUEST.query_parameter (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE -- Query parameter for name `a_name'. +``` + ### Form Parameters +```eiffel WSF_REQUEST.form_parameters: ITERABLE [WSF_VALUE] -- All form parameters sent by a POST WSF_REQUEST.form_parameter (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE -- Field for name `a_name'. +``` 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 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 -- Variable named `a_name' from any of the variables container -- 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. @@ -119,7 +126,7 @@ Suppose we have the following HTML5 form using method `POST`. This HTML5 form ha ### How to read all parameter names To read all the parameters names we simple call **WSF_REQUEST.form_parameters**. -``` +```eiffel req: WSF_REQUEST 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 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 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 @@ -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) -``` +```eiffel req: WSF_REQUEST idioms: LIST[STRING] -- 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**. -``` +```eiffel if attached {WSF_TABLE} req.query_parameter ("tab") as l_tab then l_parameter_names.append ("
") 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 -``` +```eiffel l_raw_data:STRING 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 -``` +```eiffel WSF_REQUEST.has_uploaded_file: BOOLEAN -- Has any uploaded file? ``` 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] -- uploaded files values --| filename: original path from the user diff --git a/doc/workbook/handling_request/headers.md b/doc/workbook/handling_request/headers.md index 930ecac1..416fdbfd 100644 --- a/doc/workbook/handling_request/headers.md +++ b/doc/workbook/handling_request/headers.md @@ -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. 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 "_". -- 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`.