diff --git a/doc/workbook/basics/basics.md b/doc/workbook/basics/basics.md index ce04f31e..2fc0e40f 100644 --- a/doc/workbook/basics/basics.md +++ b/doc/workbook/basics/basics.md @@ -15,7 +15,7 @@ Nav: [Workbook](../workbook.md) :: [Handling Requests: Form/Query Parameter](../ ## EWF service structure -The following code describes the basic structure of an EWF basic service that handles HTTP requests. We will need to define a Service Launcher and a Request Execution implementation. +The following code describes the basic structure of an EWF basic service that handles HTTP requests. We will need to define a `Service Launcher` and a `Request Execution` implementation. ```eiffel class @@ -60,7 +60,7 @@ end ``` When using the "standalone" connector (or the deprecated "nino" connector), by default the service listens on port 80, but often this port is already used by other applications, so it is recommended to use another port. -To define another port, redefine the feature `initialize' and set up a new port number using the service options (see below). +To define another port, redefine the feature `initialize` and set up a new port number using the service options (see below). ```eiffel @@ -90,7 +90,7 @@ The **WSF_REQUEST** gives access to the incoming data; the class provides featur The **WSF_RESPONSE** provides features to define the response with information such as HTTP status codes (10x,20x, 30x, 40x, and 50x), response headers (Content-Type, Content-Length, etc.) and obviously the body of the message itself. -**APPLICATION** is the root class of our example, it launches the application, using the corresponding connector, Which connector? this depends how you want to run it cgi, fcgi,standalone. For development is recommended to use a standalone web server written in Eiffel, and run the execution within the EiffelStudio debugger. For production fcgi (or cgi) using Apache or another popular web server. +**APPLICATION** is the root class of our example, it launches the application, using the corresponding connector, Which connector? this depends how do you want to run it `cgi`, `fcgi`, `standalone`. For development is recommended to use a standalone web server written in Eiffel, and run the execution within the EiffelStudio debugger. For production fcgi (or cgi) using Apache or another popular web server.  @@ -103,11 +103,11 @@ Other connectors: **WSF_CGI_SERVICE_LAUNCHER** **WSF_LIBFCGI_SERVICE_LAUNCHER** -A basic EWF service inherits from **WSF_DEFAULT_SERVICE**, which has a formal generic that should conform to **WSF_EXECUTION** class with a `make' creation procedure, in our case the class **APPLICATION_EXECUTION**. +A basic EWF service inherits from **WSF_DEFAULT_SERVICE**, which has a formal generic that should conform to **WSF_EXECUTION** class with a `make` creation procedure, in our case the class **APPLICATION_EXECUTION**. The **APPLICATION_EXECUTION** class inherits from **WSF_EXECUTION** interface, which is instantiated for each incoming request. **WSF_EXECUTION** inherit from **WGI_EXECUTION** which is the low level entry point in EWF, handling each incoming request with a single procedure ```execute (req: WSF_REQUEST; res: WSF_RESPONSE) ...```. -In the **APPLICATION_EXECUTION** class class you will need to implement implement the **execute** feature, get data from the request *req* and write the response in *res*. +In the **APPLICATION_EXECUTION** class class you will need to implement the **execute** feature, get data from the request *req* and write the response in *res*.  diff --git a/doc/workbook/generating_response/generating_response.md b/doc/workbook/generating_response/generating_response.md index 977daf77..79dace72 100644 --- a/doc/workbook/generating_response/generating_response.md +++ b/doc/workbook/generating_response/generating_response.md @@ -482,6 +482,7 @@ end ``` Using cURL to test the application +--- In the first call we use the ```res.redirect_now (l_engine_url)``` feature ``` @@ -697,7 +698,7 @@ take a look at constants classes such as [HTTP_MIME_TYPES](),[HTTP_HEADER_NAMES] res.put_string (l_msg) end ``` -The class [HTTP_HEADER]() also supplies a number of convenience routines for specifying common headers, in fact the features are inherited from the class [HTTP_HEADER_MODIFIER]. +The class [HTTP_HEADER]() also supplies a number of convenience routines for specifying common headers, in fact the features are inherited from the class [HTTP_HEADER_MODIFIER](). ```eiffel diff --git a/doc/workbook/handling_cookies/handling_cookies.md b/doc/workbook/handling_cookies/handling_cookies.md index 316ba48a..75b62eba 100644 --- a/doc/workbook/handling_cookies/handling_cookies.md +++ b/doc/workbook/handling_cookies/handling_cookies.md @@ -49,8 +49,8 @@ Client send cookies to server ## Write and Read Cookies. -To send a cookie to the client we should use the [HTTP_HEADER] class, and call ```h.put_cookie``` feature or -```h.put_cookie_with_expiration_date``` feature, see [How to set Cookies]() to learn the details, and the set it to response object [WSF_RESPONSE] as we saw previously. +To send a cookie to the client we should use the **HTTP_HEADER** class, and call ```h.put_cookie``` feature or +```h.put_cookie_with_expiration_date``` feature, see [How to set Cookies]() to learn the details, and the set it to response object **WSF_RESPONSE** as we saw previously. We will show an example. diff --git a/doc/workbook/handling_request/form.md b/doc/workbook/handling_request/form.md index f5f7f339..8c07d049 100644 --- a/doc/workbook/handling_request/form.md +++ b/doc/workbook/handling_request/form.md @@ -17,17 +17,17 @@ Nav: [Workbook](../workbook.md) :: [Basic Concepts](../basics/basics.md) :: [Han - [Examples](#examples) -An HTML Form can handle GET and POST requests. -When we use a form with method GET, the data is attached at the end of the url for example: +An HTML Form can handle `GET` and `POST` requests. +When we use a form with method `GET`, the data is attached at the end of the url for example: >http://wwww.example.com?key1=value1&...keyn=valuen -If we use the method POST, the data is sent to the server in a different line. +If we use the method `POST`, the data is sent to the server in a different line. Extracting form data from the server side is one of the most tedious parts. If you do it by hand, you will need to parse the input, you'll have to URL-decode the value. -Here we will show you how to read input submitted by a user using a Form (GET and POST). +Here we will show you how to read input submitted by a user using a Form (`GET` and `POST`). * How to handle missing values: * client side validattion, server side validations, set default if it's a valid option. * How to populate Eiffel objects from the request data. @@ -56,29 +56,29 @@ EWF [WSF_REQUEST]() class, provides features to handling this form parsing autom 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. +The values supplied to `form_parameter` and `query_parameter` are _case_ _sensitive_. ### 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. 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 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. ->Note: if a query parameter has the same name as a form paramenter req.item will retrieve the form paramenter. Remember the precedence: form > query > path +>Note: if a query parameter has the same name as a form paramenter req.item will retrieve the form paramenter. Remember the precedence: `form` > `query` > `path` ## Reading Parameters and Values -Suppose we have the following HTML5 form using Method POST. This HTML5 form has client side form validation using the new HTML5 attribute, you can do the same using Javascript. So in this case if the user does not fill the fields as expected the form will not be submitted to the server. +Suppose we have the following HTML5 form using method `POST`. This HTML5 form has client side form validation using the new HTML5 `attribute`, you can do the same using Javascript. So in this case if the user does not fill the fields as expected the form will not be submitted to the server. ->Note: You want to validate on the server side because you can protect against the malicious user, who can easily bypass your JavaScript and submit dangerous input to the server. +>Note: it is recommended to validate client side input on the server side (as a double check) because you can protect against the malicious user, who can easily bypass your JavaScript and submit dangerous input to the server. ```