Page 200 - DCAP207_NETWORKS_DCAP406_COMPUTER_NETWORKS
P. 200

Unit 12: Application Layer




          the web browser. In other words, it may understood as a connection between web server and  Notes
          webpages. The request may be for a file stored on the disk of webserver or an executable
          command and possibly arguments. CGI is used to provide responses for the second request type
          namely request for an executable commands. Therefore, CGI is inclusive of the web server and
          is used to communicate with other programs running on the web server. The CGI enables web
          user to ask questions and run applications in an interactive manner. The CGI is used to create
          web pages based on web user interaction in which the web users are able to read random pages
          on the website, create pages specific to them based on the form input and generate pages based
          on databases. Some of the CGI applications are interactive forms processing, gateways
          programming, etc. Gateways are also known as web gateways and are programs or scripts to
          access information that is not directly readable by the web client.
          In its simplest form a web server receives request from the web client and responses back to the
          web client with requested web pages through HTTP program without processing the data of the
          web client. Sometimes the web client needs web server-side processing of the data. In many case
          web server also does not allow providing data verbatim. Such cases prompt the web client to
          send a fill-in HTML form to obtain data from the web server. Therefore to initiate data processing
          and manipulation at web server side, another program and a mechanism to forwards data to
          another program are required. Such secondary programs enabling data processing at web server
          are known as gateway programs. As its name implies, they act as a gateway between the web
          and other resources on the HTTP server machine like databases. The gateway programs are also
          used to return the processed data to the web client.
          Normally, the CGI programs and scripts reside in a special directory, called cgi-bin. When a web
          user opens a URL associated with a CGI program, the web client sends a request to the web
          server asking for the file. Recognizing that it is a CGI program, the web server executes the
          program instead of returning the file contents exactly. When the CGI program begins running,
          it either creates and output a new document or provides the URL to an existing one. Thereafter,
          the CGI program sends the newly created data either directly to the web client or indirectly
          through the web server. When the output consists of a complete HTTP header, the data is sent
          directly to the web client without web server modification. Alternatively, the output is sent to
          the web server as a data stream and the web server then appends the complete header information
          and using the HTTP protocol to transfer the data to the client. The header is consisted of the
          details like type of communication protocol, the date and time of the response, the server name
          and version and the revision of the MIME protocol. MIME is a Multipurpose Internet Mail
          Extensions specification that is used for sending multiple types of data through
          e-mail. In brief the basic approach of CGI can be grouped into two categories. They are sending
          data to the gateway program and returning data to the web client. The disadvantage of CGI
          Scripts is to generate lot of loads on a web server and poorly written programs tend to fall into
          endless loops at the cost of the web server processor time. Such endless loops continue until a
          system administrator comes in and shuts off the faulty script. The browser based scripting tools
          use the processor locally instead of the Web server itself and so is less intense on the Web server.

          Java

          Java is a high-level third generation programming language to write computer applications.
          The Java shares lots of C’s syntax but it is quire different from C language. The uniqueness of
          Java language is that it provides special programs called applets. The applets are downloadable
          from the Internet and can be played safely within a web browser. Java is a platform independent
          language for application development. It is so called because Java programs produce a special
          format called byte code written in hexadecimal byte by byte, which looks like machine language
          codes and are verbatim same on every platform. However, Java programs compiled into byte
          code needs an interpreter to execute them on any given platform. The Java provides automatic
          memory allocation and de-allocation to make it simple and bug free language. Some of the
          features of Java language are given as below:


                                           LOVELY PROFESSIONAL UNIVERSITY                                   193
   195   196   197   198   199   200   201   202   203   204   205