Presentation is loading. Please wait.

Presentation is loading. Please wait.

ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 1 Electronic Commerce: Information Publishing Technology.

Similar presentations


Presentation on theme: "ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 1 Electronic Commerce: Information Publishing Technology."— Presentation transcript:

1 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 1 Electronic Commerce: Information Publishing Technology

2 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 2 Common Gateway Interface (CGI) The Common Gateway Interface (CGI) mechanism of the HTTP enables servers to execute the programs, obtain results and send the results to the requesting browser. The Common Gateway Interface (CGI) mechanism of the HTTP enables servers to execute the programs, obtain results and send the results to the requesting browser. The program executed by the HTTP servers can be compiled C, C++ programs or in scripting languages such as Unix Shell (sh) or Perl. The program executed by the HTTP servers can be compiled C, C++ programs or in scripting languages such as Unix Shell (sh) or Perl. These CGI programs also referred as gateway programs/scripts act as bridge between the HTTP server and other programs such as DBMS. These CGI programs also referred as gateway programs/scripts act as bridge between the HTTP server and other programs such as DBMS. The CGI is an interface that specifies how the browser input entered through the tags is passed to the gateway programs/scripts and the expected format of the output from these gateway programs that can be passed to the browser by the web server. The CGI is an interface that specifies how the browser input entered through the tags is passed to the gateway programs/scripts and the expected format of the output from these gateway programs that can be passed to the browser by the web server.

3 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 3 Common Gateway Interface Web Browser Web Server CGI ScriptDBMS

4 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 4 CGI: Identifying and Invoking programs The CGI programs are triggered by the browser requests and executed by servers. The CGI programs are triggered by the browser requests and executed by servers. The web server distinguishes between the document requests and the CGI scripts/program execution requests based on the directives in the configuration file. The web server distinguishes between the document requests and the CGI scripts/program execution requests based on the directives in the configuration file. The web server configuration directive can be set so that a particular extension (e.g.,.cgi or.exe) implies an executable program rather than the document. Or, the web server can be configured in such a way that it treats all the files in particular sub directories (e.g., cgi-bin/) as the executable CGI programs /scripts. The web server configuration directive can be set so that a particular extension (e.g.,.cgi or.exe) implies an executable program rather than the document. Or, the web server can be configured in such a way that it treats all the files in particular sub directories (e.g., cgi-bin/) as the executable CGI programs /scripts. A browser can trigger a CGI program in one of the two ways. In the first case, the browser requests a CGI program as a regular URL mechanism. The server on receiving the URL examines the path name and/or the file extension of the URL, and identifies whether it is an HTML or an executable script/program, based on the file extension or location, that requires to be executed. A browser can trigger a CGI program in one of the two ways. In the first case, the browser requests a CGI program as a regular URL mechanism. The server on receiving the URL examines the path name and/or the file extension of the URL, and identifies whether it is an HTML or an executable script/program, based on the file extension or location, that requires to be executed. In the second case, the CGI program/script (URL) name appears as the action attribute of the tag. The forms are used for accepting user input In the second case, the CGI program/script (URL) name appears as the action attribute of the tag. The forms are used for accepting user input

5 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 5 CGI: Output Specifications CGI Program/Script output CGI Program/Script output –The program on execution puts the output on to stdout. Parsed and Non-Parsed Header CGI Scripts Parsed and Non-Parsed Header CGI Scripts –The CGI program/script usually produce output that is parsed by the Server and sent back to the client with completed header information. In this approach the programs/scripts do not need to generate full HTTP header for every request. –In some cases, the programs may want to bypass the parsing of the output by server, and talk directly to the client. In this case, it is programs responsibility to generate the valid HTTP header information. To distinguish these scripts, CGI requires that the script name begins with nph-.

6 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 6 CGI: Output Specifications Parsed headers Parsed headers –In this case, the header information consists of text lines, terminated by a blank line (a line with only a linefeed or CR/LF). –Headers that are not server directives are sent directly back to the client. The commonly used directives are: Content-type: the MIME type of the document you are returning. Content-type: the MIME type of the document you are returning. Location: Used to specify to the server that a reference to a document is being returned instead of actual document. Usually, it is a URL, and the server issues a redirect to the client. Location: Used to specify to the server that a reference to a document is being returned instead of actual document. Usually, it is a URL, and the server issues a redirect to the client. Status: It gives the server an HTTP Status Information for sending to the client. The format is nnn xxxxx, where nnn is the 3-digit status code, and xxxxx is the reason string, such as "Forbidden". Status: It gives the server an HTTP Status Information for sending to the client. The format is nnn xxxxx, where nnn is the 3-digit status code, and xxxxx is the reason string, such as "Forbidden".

7 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 7 CGI: Invoking the Programs/Script The following HTML document references a hyperlink. This hyperlink points to a CGI program/script. The following HTML document references a hyperlink. This hyperlink points to a CGI program/script. The browser rendition of this document is shown in next slide. The browser rendition of this document is shown in next slide.<html><head> Example of a CGI Script Example of a CGI Script </head><body> The following example demonstrates the use CGI script. This script, on execution, lists all the users logged on the system. The following example demonstrates the use CGI script. This script, on execution, lists all the users logged on the system. List People Logged on to ICRC List People Logged on to ICRC </body></html>

8 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 8 CGI: Invoking programs/Scripts

9 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 9 CGI: Identifying and Invoking programs If user clicks on hyper link. The web server running at icrc.iiml.ac.in receives the request for the document who.cgi If user clicks on hyper link. The web server running at icrc.iiml.ac.in receives the request for the document who.cgi The configuration of the server indicates the.cgi files are CGI program /scripts. Thus, the server invokes CGI interface to execute who.cgi and its output is parsed by the server and sent to the browser for displaying. The configuration of the server indicates the.cgi files are CGI program /scripts. Thus, the server invokes CGI interface to execute who.cgi and its output is parsed by the server and sent to the browser for displaying. For the following who.cgi, For the following who.cgi,#!/bin/sh echo Content-type: text/plain echo echo Output of the Who command on icrc /bin/who On execution this script passes following output to the server, the browser output is shown in next slide. On execution this script passes following output to the server, the browser output is shown in next slide. Content-type: text/plain rootpts/0Nov 01 13:08(agni.iiml.ac.in) bhaskerpts/1Nov 01 13:22 (icrc.iiml.ac.in)

10 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 10 CGI: Identifying and Invoking programs

11 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 11 Forms and CGI Programs/Scripts For accepting the Input data for processing by the server based CGI Programs / Scripts, the HTML supports the tag. The tag defines a form. The tag has following important properties associated with it. ACTION: The action attribute specifies the CGI program/script that will be used for processing the data entered through the form. The action field accepts URL of the CGI programs. ENCTYPE: The attribute specifies how the values entered in the form are encoded for transmission to the URL. Some valid formats are are encoded for transmission to the URL. Some valid formats are application/x-www-form-urlencode and multipart/form-data. METHOD: The attribute describes the method used for sending the data to the Web server. The two supported methods are get and post. The browser uses the GET or POST protocol packet for sending the data to the server.

12 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 12 Forms and CGI Programs/Scripts A simple example of HTML document with forms is as follows.<html><head> Example of HTML form Example of HTML form </head><body> The following tags create a form in the HTML document The following tags create a form in the HTML document </form></body></html>

13 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 13 Forms and CGI Programs/Scripts In the browser, the creates a logical form with no displayable components. In the browser, the creates a logical form with no displayable components. The action attribute may contain a full URL or a relative path. The relative paths are relative to the base document, i.e., the document in which this relative path appears. The action attribute may contain a full URL or a relative path. The relative paths are relative to the base document, i.e., the document in which this relative path appears. The get method specifies that the data will be transmitted to the CGI program, through web server indicated in the action field, as per the “Get” protocol. The get method specifies that the data will be transmitted to the CGI program, through web server indicated in the action field, as per the “Get” protocol. The enctype attribute has not been specified in this case, thus the default application/x-form-urlencoded is assumed. The enctype attribute has not been specified in this case, thus the default application/x-form-urlencoded is assumed.

14 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 14 Forms and CGI Programs/Scripts For accepting input from the form screen, tags such as input, select and textarea have been defined. For accepting input from the form screen, tags such as input, select and textarea have been defined. Each of these input tags have properties called name and (default) value. The user entered data overrides the default value. The input is transmitted from the browser in name=value format. Each of these input tags have properties called name and (default) value. The user entered data overrides the default value. The input is transmitted from the browser in name=value format. Following HTML code segment shows the usage of the form and input tags. Following HTML code segment shows the usage of the form and input tags. Please enter your last name: Please enter your last name: </form>

15 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 15 Forms: Input Tag Text: Text: The text type input is made up of one-line field where user can type the data. The text type input is made up of one-line field where user can type the data. Following example shows the usage of text type input field: Following example shows the usage of text type input field: <input type=”text” name=”last_name” value=“none” size=20 maxlength=25> The size specifies the size of window that appears on the browser screen. The size specifies the size of window that appears on the browser screen. Value specifies the default value that will appear on the screen. In this case none appears on the screen. If user replace it by text by “newval”. The browser will pass last_name=“newval” otherwise last_name=“none” will be send by the browser. Value specifies the default value that will appear on the screen. In this case none appears on the screen. If user replace it by text by “newval”. The browser will pass last_name=“newval” otherwise last_name=“none” will be send by the browser. Maxlength: specifies the maximum length of input that can be accepted. If the size is smaller than maxlength the typed text will scroll over to left side. Maxlength: specifies the maximum length of input that can be accepted. If the size is smaller than maxlength the typed text will scroll over to left side.

16 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 16 Forms: Input Tag Password: Password: The text type input is made up of one-line field where user can type the data. The text type input is made up of one-line field where user can type the data. Following example shows the usage of text type input field: Following example shows the usage of text type input field: <input type=”password” name=”userpw” size=20 maxlength=20> The size specifies the size of window that appears on the browser screen. The size specifies the size of window that appears on the browser screen. For the type= Password, whatever user types on the screen will not appear in clear-text.. If user types “newpassl”. The browser will pass userpw=“newpassl” to the server. For the type= Password, whatever user types on the screen will not appear in clear-text.. If user types “newpassl”. The browser will pass userpw=“newpassl” to the server. Maxlength: specifies the maximum length of input that can be accepted. If the size is smaller than maxlength the typed text will scroll over to left side. Maxlength: specifies the maximum length of input that can be accepted. If the size is smaller than maxlength the typed text will scroll over to left side.

17 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 17 Forms: Input Tag Radio Buttons Radio Buttons –In multiple-choice situations, the radio buttons are used for accepting the input. –Like the Radio-Tape recorder buttons only one of them can be selected at a time. –Radio buttons require both the name and value attribute specified with the tag. –Bunch of radio button that form a group have a common name and different values. –Bunch of radio button that form a group have a common name and different values. –Within a group, each radio button should have a unique value as the name=value is sent to the web server on submission of a form.

18 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 18 Forms: Input Tag For example: <form> Hair Color: Hair Color: Brunette Brunette Blonde Blonde Golden Golden Eye Color: Eye Color: Blue Blue Green Green Black Black The above example has two groups of radio buttons, the first ones identified by name=”h_color” and the other one identified by the name=”e_color”. The above example has two groups of radio buttons, the first ones identified by name=”h_color” and the other one identified by the name=”e_color”. The browser will send the following input: The browser will send the following input: h_color=black&e_color=green h_color=black&e_color=green

19 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 19 Forms: Input Tag Check Boxes: Check Boxes: The check boxes permit users to enter more than one answer for a question. The check boxes permit users to enter more than one answer for a question. On a form they act like on/off switches. In case of the checkboxes, the name attribute must have a unique value. On a form they act like on/off switches. In case of the checkboxes, the name attribute must have a unique value. For example: For example:<form> Hair Dyes: Hair Dyes: Loreal Loreal Revelon Revelon </form> The browser will send name=value pair to the web server for all the boxes that are checked by the user prior to submitting the form. If user checks both the boxes, following argument will be sent: The browser will send name=value pair to the web server for all the boxes that are checked by the user prior to submitting the form. If user checks both the boxes, following argument will be sent: loreal=yes&revelon=yes loreal=yes&revelon=yes

20 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 20 Forms: Input Tag Submit buttons: Submit buttons: The submit button is created by defining the attribute type=“submit” in tag. The submit button has the name and value attributes as well. The submit button is created by defining the attribute type=“submit” in tag. The submit button has the name and value attributes as well. The value attribute specifies the label that appears on the submit button on the browser screen. If the value attribute is not specified the “submit” appears as the label on the button. The value attribute specifies the label that appears on the submit button on the browser screen. If the value attribute is not specified the “submit” appears as the label on the button. Submit button sends the data entered through the form to the web server for processing by the program specified through the “action” attribute of the tag. Submit button sends the data entered through the form to the web server for processing by the program specified through the “action” attribute of the tag. In case the name attribute has been specified for the submit button, the name=value pair corresponding to the submit button is sent as a part of the input argument. In case the name attribute has been specified for the submit button, the name=value pair corresponding to the submit button is sent as a part of the input argument.

21 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 21 Forms: Input Tag Reset Button Reset Button The reset button is defined by using the type=”reset” in the tag. The reset button is defined by using the type=”reset” in the tag. The reset button is used for clearing up the form and setting the values back to the original (default). The reset button is used for clearing up the form and setting the values back to the original (default). It is specially useful in a large form where after entering several fields user realizes the mistake and wants to starts afresh. It is specially useful in a large form where after entering several fields user realizes the mistake and wants to starts afresh. The value attribute of the reset button, like the submit button, can be used for changing the label of the reset button on the form. The value attribute of the reset button, like the submit button, can be used for changing the label of the reset button on the form.

22 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 22 Forms: Input Tag Hidden input: Hidden input: The hidden fields can be created by using type=”hidden” in the tag. The hidden fields can be created by using type=”hidden” in the tag. These fields do not appear anywhere on the form-screen displayed by the browser. These fields do not appear anywhere on the form-screen displayed by the browser. The hidden fields have name and value attributes. The name=value pair is sent to the web server for the hidden fields as well. The hidden fields have name and value attributes. The name=value pair is sent to the web server for the hidden fields as well. These field are used for passing the information to the server that you do not want a user to see and change. These field are used for passing the information to the server that you do not want a user to see and change. These fields can be used for passing the context information. Also, in multi-part form situation correlation information between the first form with subsequent forms can be maintained by adding a hidden field in the subsequent forms that carry some identifying values from the first form. These fields can be used for passing the context information. Also, in multi-part form situation correlation information between the first form with subsequent forms can be maintained by adding a hidden field in the subsequent forms that carry some identifying values from the first form.

23 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 23 Forms: Textarea Tag The textarea tag is used for accepting multiple lines of text input. The following example shows the use of textarea tag. The textarea tag is used for accepting multiple lines of text input. The following example shows the use of textarea tag. Your Feedback please: Your Feedback please: </textarea></form> The rows and columns specify the size of a textarea The rows and columns specify the size of a textarea Wrap attribute can have three values- off, physical and virtual. Wrap attribute can have three values- off, physical and virtual. WRAP=OFF means that the text in the box does not wrap, but it is sent exactly the way it was typed in WRAP=OFF means that the text in the box does not wrap, but it is sent exactly the way it was typed in WRAP=PHYSICAL means that the text in the box wraps, and it is sent that way too. WRAP=PHYSICAL means that the text in the box wraps, and it is sent that way too. WRAP=VIRTUAL means that the text in the box wraps, but it is sent as one long continuous string. WRAP=VIRTUAL means that the text in the box wraps, but it is sent as one long continuous string.

24 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 24 Forms: Select Tag Select tag is used as an alternative to the radio buttons. It creates a pull-down list or multiple line selection options, making it suitable for presenting a large list of options in a limited space on screen. The following example shows the use of select tag. Select tag is used as an alternative to the radio buttons. It creates a pull-down list or multiple line selection options, making it suitable for presenting a large list of options in a limited space on screen. The following example shows the use of select tag. Country:<br> India India Nepal Nepal Bangladesh Bangladesh Pakistan Pakistan</select></form>

25 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 25 Forms: Example HTML Code <html><head> Example of HTML form Example of HTML form </head><body> The following tags create a form with Input type text, radio buttons The following tags create a form with Input type text, radio buttons and checkboxes and checkboxes Please Enter Your Name: Please Enter Your Name: Please Indicate the Age group you belong: Please Indicate the Age group you belong: Under18 Years Under18 Years 18-30 Years 18-30 Years 30-50 Years 30-50 Years 50-65 Years 50-65 Years Over 65 Years Over 65 Years Please tick your hobbies: Please tick your hobbies: Reading Reading Sports Sports Mountaineering Mountaineering Horse Riding Horse Riding Gardening Gardening Stamp Collection Stamp Collection Photography Photography </form></body></html>

26 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 26 Browser Output of Example HTML Code

27 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 27 Forms and CGI: All about Data While defining the form in HTML document the method property can have one of the two values- GET and POST. While defining the form in HTML document the method property can have one of the two values- GET and POST. The GET method: The GET method: –If the document has METHOD="GET" in its FORM tag, the CGI program will receive the encoded form input in the environment variable QUERY_STRING. The POST method: The POST method: –If the document has METHOD="POST" in its FORM tag, the CGI program will receive the encoded form input on stdin. –The server does not receive EOF on the end of the data, The CONTENT_LENGTH environment variable is used to determine how many bytes to read from stdin.

28 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 28 Forms and CGI: All about Data The data received by the CGI program on server side is in the format determined by Enctype property of the form tag. If no enctype is specified, the default x- www-form-urlencoded is used. The data received by the CGI program on server side is in the format determined by Enctype property of the form tag. If no enctype is specified, the default x- www-form-urlencoded is used. In the default format, all name=value pairs are concatenated with & character as a separator. The spaces are replaced by + character. In the default format, all name=value pairs are concatenated with & character as a separator. The spaces are replaced by + character. For example, the following name=value pairs For example, the following name=value pairs username=bharat bhasker agegroup=midagereading=yesriding=yes will be encoded as will be encoded asusername=bharat+bhasker&agegroup=midage&reading=yes&riding=yes

29 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 29 Forms and CGI: All about Data Get method sends the whole argument string as a part of the URL specified in the action attribute. Get method sends the whole argument string as a part of the URL specified in the action attribute. The argument string is appended to the URL separated by ‘?’ character. The argument string is appended to the URL separated by ‘?’ character. For the example, if action../cgi/bin/test/test.cgi, then the Get part of the request packet will be as follows: For the example, if action../cgi/bin/test/test.cgi, then the Get part of the request packet will be as follows: GET../cgi/bin/test.cgi?username=bharat+bhasker&agegroup=midage&reading=yes&riding=yes

30 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 30 Forms and CGI: All about Data If the attribute specified value of post for the method attribute, the relevant of portion of the protocol request will be as follows: If the attribute specified value of post for the method attribute, the relevant of portion of the protocol request will be as follows: POST../cgi-bin/test-cgiHTTP/1.1 Content-type: application/x-www-form-urlencoded Content-length:27 <CR>username=bharat+bhasker&agegroup=midage&reading=yes&riding=yes

31 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 31 Forms and CGI: Environment Variables In addition to the Query-String and Content_length referred earlier, the server makes several other environment variables available to the CGI Program. Some of these are: In addition to the Query-String and Content_length referred earlier, the server makes several other environment variables available to the CGI Program. Some of these are: SERVER_SOFTWARE SERVER_SOFTWARE –The name and version of the web server software handling the request. For example, Apache/1.3 SERVER_NAME SERVER_NAME –The server's hostname, DNS alias, or IP address GATEWAY_INTERFACE GATEWAY_INTERFACE –The version of CGI specification to which this server complies. For example, CGI/1.1 SERVER_PROTOCOL SERVER_PROTOCOL –Name and version of the protocol this request came in with. For example, HTTP/1.1

32 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 32 Forms and CGI: Environment Variables Contd. SERVER_PORT SERVER_PORT –The server port number to which this request was sent. For example, 80 REQUEST_METHOD REQUEST_METHOD –The method with which the request was made. For HTTP, this is "GET", "HEAD", "POST". QUERY_STRING QUERY_STRING –The information following the ‘?’ character in the URL which referenced this script. This is the data entered in the form by user in encoded form. It is not be decoded by the server. This variable is always set when there is query information/form-data and the method used is GET. REMOTE_HOST REMOTE_HOST –The hostname of the client making the request. If case the information is not available to the web server, it sets the REMOTE_ADDR variable and leaves this unset. REMOTE_ADDR REMOTE_ADDR –The IP Address of the remote machine making the request.

33 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 33 Forms and CGI: Environment Variables Contd. CONTENT_TYPE CONTENT_TYPE –For queries which have attached information, such as HTTP POST, this is the content type of the data. It has the same value as the enctype attribute of the form tag. For example, application/x-www-form-urlencoded CONTENT_LENGTH CONTENT_LENGTH –The length of the content (encoded form-data) send by the client. HTTP_ACCEPT HTTP_ACCEPT –The MIME types that are accepted by the client. The information is derived from HTTP headers. Commas, as per the HTTP specifications,separate each item in this list. HTTP_USER_AGENT HTTP_USER_AGENT –Stamp of the browser that the client used for sending the request. For example, Mozilla/4.5 for Netscape version 4.5

34 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 34 Forms and CGI: Environment Variables If following is the content of test.cgi program, the output for the Previously mentioned input for get method is shown in the next slide. #!/bin/sh echo Content-type: text/plain echo echo CGI/1.0 test script report: echo SERVER_SOFTWARE = $SERVER_SOFTWARE echo SERVER_NAME = $SERVER_NAME echo GATEWAY_INTERFACE = $GATEWAY_INTERFACE echo SERVER_PROTOCOL = $SERVER_PROTOCOL echo SERVER_PORT = $SERVER_PORT echo REQUEST_METHOD = $REQUEST_METHOD echo HTTP_ACCEPT = "$HTTP_ACCEPT" echo PATH_INFO = "$PATH_INFO" echo SCRIPT_NAME = "$SCRIPT_NAME" echo QUERY_STRING = "$QUERY_STRING" echo REMOTE_HOST = $REMOTE_HOST echo REMOTE_ADDR = $REMOTE_ADDR echo REMOTE_USER = $REMOTE_USER echo AUTH_TYPE = $AUTH_TYPE echo CONTENT_TYPE = $CONTENT_TYPE echo CONTENT_LENGTH = $CONTENT_LENGTH

35 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 35 Forms and CGI: Environment Variables

36 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 36 Alternatives to CGI The CGI) offers capability to build the web-based applications that could provide search and retrieval, transaction management and other application services by interfacing the back-end information storage manager to the HTTP servers. The CGI) offers capability to build the web-based applications that could provide search and retrieval, transaction management and other application services by interfacing the back-end information storage manager to the HTTP servers. The CGI mechanism launches the script/program for every user requests that in turn takes up valuable processor time. The CGI mechanism launches the script/program for every user requests that in turn takes up valuable processor time. With limited number of requests per minute, it was possible to live with the performance. But, with the increase popularity of many of the search engines, electronic commerce sites the performance became a major issue. With limited number of requests per minute, it was possible to live with the performance. But, with the increase popularity of many of the search engines, electronic commerce sites the performance became a major issue. As a result, the Web server developers began to develop possible alternatives to the CGI mechanisms to enhance the performance. As a result, the Web server developers began to develop possible alternatives to the CGI mechanisms to enhance the performance.

37 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 37 Alternatives to CGI The performance problems were alleviated by removing the need to launch a CGI application repetitively for requests. The performance problems were alleviated by removing the need to launch a CGI application repetitively for requests. Some of the approaches are as follows: Some of the approaches are as follows: –Server Side Includes –Active Server Pages –Apache Mod_perl Module

38 ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 38 Alternatives to CGI: Mod_Perl Apache Web Server consists of several modules, each entrusted with specific functional responsibility. A request to server passes through several modules during the processing. The Web server is written to easily extend and add newer modules. Apache Web Server consists of several modules, each entrusted with specific functional responsibility. A request to server passes through several modules during the processing. The Web server is written to easily extend and add newer modules. Apache web server offers a special module ‘Mod_Perl’ that embeds the Perl Interpreter inside the server. Apache web server offers a special module ‘Mod_Perl’ that embeds the Perl Interpreter inside the server. When a user request is passed to the server, it checks the Apache registry to determine whether it is responsible for processing request. When a user request is passed to the server, it checks the Apache registry to determine whether it is responsible for processing request. Through the Apache::Registry Module, the web server can be configured to identify certain extension directories, for execution by the mod_perl module. Through the Apache::Registry Module, the web server can be configured to identify certain extension directories, for execution by the mod_perl module. The mod_perl module enables the perl script writers to run their scripts with in the Apache Web Server itself without invoking the external process and Perl interpreter as is the case with CGI/Perl. The mod_perl module enables the perl script writers to run their scripts with in the Apache Web Server itself without invoking the external process and Perl interpreter as is the case with CGI/Perl.


Download ppt "ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 1 Electronic Commerce: Information Publishing Technology."

Similar presentations


Ads by Google