From 2c745c63d3ad5ac927cab74f88304e46e1041c3c Mon Sep 17 00:00:00 2001 From: jvelilla Date: Tue, 30 Jun 2015 09:21:12 -0300 Subject: [PATCH] Updated workbook: generating response, handling cookies and headers documents. --- .../generating_response.md | 38 ++++--------------- .../handling_cookies/handling_cookies.md | 22 +++-------- doc/workbook/handling_request/headers.md | 6 +-- 3 files changed, 16 insertions(+), 50 deletions(-) diff --git a/doc/workbook/generating_response/generating_response.md b/doc/workbook/generating_response/generating_response.md index 1c2609b3..4d63cdfd 100644 --- a/doc/workbook/generating_response/generating_response.md +++ b/doc/workbook/generating_response/generating_response.md @@ -1,5 +1,5 @@ -Nav: [Workbook](../workbook.md) | [Handling Requests: Header Fields](/workbook/handling_request/headers.md) | [Handling Cookies](/workbook/handling_cookies/handling_cookies.md) +Nav: [Workbook](../workbook.md) | [Handling Requests: Header Fields](/doc/workbook/handling_request/headers.md) | [Handling Cookies](/doc/workbook/handling_cookies/handling_cookies.md) ## EWF Generating Response @@ -164,24 +164,13 @@ Note: use ```res.set_status_code({HTTP_STATUS_CODE}.bad_request)``` rather than Basic Service that builds a simple web page to show the most common status codes ```eiffel class - APPLICATION + APPLICATION_EXECUTION inherit - WSF_DEFAULT_SERVICE - redefine - initialize - end + WSF_EXECUTION create - make_and_launch - -feature {NONE} -- Initialization - - initialize - -- Initialize current service. - do - set_service_option ("port", 9090) - end + make feature -- Basic operations @@ -321,24 +310,13 @@ note revision : "$Revision$" class - APPLICATION + APPLICATION_EXECUTION inherit - WSF_DEFAULT_SERVICE - redefine - initialize - end + WSF_EXECUTION create - make_and_launch - -feature {NONE} -- Initialization - - initialize - -- Initialize current service. - do - set_service_option ("port", 9090) - end + make feature -- Basic operations @@ -1018,4 +996,4 @@ There are four categories for response header fields: -| [Handling Requests: Header Fields](/workbook/handling_request/headers.md) | [Handling Cookies](/workbook/handling_cookies/handling_cookies.md) +Nav: [Workbook](../workbook.md) | [Handling Requests: Header Fields](/doc/workbook/handling_request/headers.md) | [Handling Cookies](/doc/workbook/handling_cookies/handling_cookies.md) diff --git a/doc/workbook/handling_cookies/handling_cookies.md b/doc/workbook/handling_cookies/handling_cookies.md index cfac299d..f1de9bdc 100644 --- a/doc/workbook/handling_cookies/handling_cookies.md +++ b/doc/workbook/handling_cookies/handling_cookies.md @@ -1,4 +1,4 @@ -Nav: [Workbook](../workbook.md) | [Generating Responses](/workbook/generating_response/generating_response.md) +Nav: [Workbook](../workbook.md) | [Generating Responses](/doc/workbook/generating_response/generating_response.md) # Handling Cookies @@ -146,25 +146,13 @@ note revision : "$Revision$" class - APPLICATION + APPLICATION_EXECUTION inherit - WSF_DEFAULT_SERVICE - redefine - initialize - end + WSF_EXECUTION create - make_and_launch - -feature {NONE} -- Initialization - - initialize - -- Initialize current service. - do - set_service_option ("port", 9090) - set_service_option ("verbose",True) - end + make feature -- Basic operations @@ -297,4 +285,4 @@ end ``` -Nav: [Workbook](../workbook.md) | [Generating Responses](/workbook/generating_response/generating_response.md) +Nav: [Workbook](../workbook.md) | [Generating Responses](/doc/workbook/generating_response/generating_response.md) diff --git a/doc/workbook/handling_request/headers.md b/doc/workbook/handling_request/headers.md index a49a7440..bba056ed 100644 --- a/doc/workbook/handling_request/headers.md +++ b/doc/workbook/handling_request/headers.md @@ -170,7 +170,7 @@ included in the Referer header when the browser requests Web page B. #### Building a Table of All Request Headers -The following [EWF service](/doc/workbook/headers/header_fields/application.e) code simply uses an ```html_template``` to fill a table (names and values) with all the headers fields it receives. +The following [EWF service](/doc/workbook/handling_request/headers/header_fields/application.e) code simply uses an ```html_template``` to fill a table (names and values) with all the headers fields it receives. The service accomplishes this task by calling ```req.meta_variables``` feature to get an ```ITERABLE [WSF_STRING]```, an structure that can be iterated over using ```across...loop...end```, then it checks if the name has the prefix ```HTTP_``` and if it is true, put the header name and value in a row. (the name in the left cell, the value in the right cell). @@ -284,7 +284,7 @@ To be completed. #### Detecting Browser Types -The User-Agent header identifies the specific browser/client that is sending the request. The following code shows a [EWF service](/doc/workbook/headers/browser_name/application.e) that sends browser-specific responses. +The User-Agent header identifies the specific browser/client that is sending the request. The following code shows a [EWF service](/doc/workbook/handling_request/headers/browser_name/application.e) that sends browser-specific responses. The examples uses the ideas based on the [Browser detection using the user agent](https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent) article. Basically the code check if the header user_agent exist and then call the ```browser_name (a_user_agent: READABLE_STRING_8): READABLE_STRING_32``` @@ -429,7 +429,7 @@ As an exercise, try to write a similar service to retrieve the OS family using t * [SERVER_SOFTWARE](https://tools.ietf.org/html/rfc3875#section-4.1.16) **Example** -An [EWF service](/doc/workbook/headers/cgi_variables/application.e) that shows the CGI variables, creates a table showing the values of all the CGI variables. +An [EWF service](/doc/workbook/handling_request/headers/cgi_variables/application.e) that shows the CGI variables, creates a table showing the values of all the CGI variables. Nav: [Workbook](../workbook.md) | [Handling Requests: Form/Query parameters] (/doc/workbook/handling_request/form.md) | [Generating Responses](/doc/workbook/generating_response/generating_response.md)