html5-img
1 / 23

Server Side programming

Server Side programming. Server Side programming. With the advent of the World Wide Web, the Internet gained tremendous popularity. This greatly increased the volume of the requests users made fro information fro Web sites.

ori-bridges
Télécharger la présentation

Server Side programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Server Side programming

  2. Server Side programming • With the advent of the World Wide Web, the Internet gained tremendous popularity. • This greatly increased the volume of the requests users made fro information fro Web sites. • It became evident that the degree of interactivity between the user and the Web would be crucial. • The power of the Web resides not only in serving content to users, but also in responding to requests from users and generating Web content dynamically.

  3. Server Side programming • When users enter a Uniform Resource Locator (URL) address in a Web browser, they requesting a specific document from a Web server. • The Web server maps the Url to a file on the server. • The Web server returns the requested document to the client. • During this interaction, the Web server and the client communicate through the platform-independent Hypertext Transfer Protocol (HTTP). • The HTTP protocol responsible for transferring requests and files over the Internet.

  4. Server Side programming • Processing data on the server to increase communication between clients and servers, thus creating interactive applications. • With using scripting languages, we reduce the load on the server, but this is not always sufficient when building truly interactive web based applications.

  5. Server Side programming • Advantages of Server Side ProgramsThe list below highlights some of the important advantages of Server Side programs. • All programs reside in one machine called the Server. Any number of remote machines (called clients) can access the server programs. • New functionalities to existing programs can be added at the server side which the clients’ can advantage without having to change anything from their side. • Migrating to newer versions, architectures, design patterns, adding patches, switching to new databases can be done at the server side without having to bother about clients’ hardware or software capabilities.

  6. Server Side programming • Issues relating to enterprise applications like resource management, concurrency, session management, security and performance are managed by service side applications. • They are portable and possess the capability to generate dynamic and user-based content (e.g. displaying transaction information of credit card or debit card depending on user’s choice). • Types of Server Side Programs • Active Server Pages (ASP) • Java Servlets • Java Server Pages (JSPs) • Enterprise Java Beans (EJBs) • PHP

  7. Common Gateway Interface (CGI) • CGI is a standard protocol that defines how web server software can delegate the generation of web sites to a console application. • Such applications are known as CGI scripts; they can be written in any programming language, although scripting languages are often used. • The task of a Web server is to respond to requests for web sites issued by clients (usually web browsers) by analyzing the content of the request (which is mostly in its URL), determining an appropriate document to send in response, and returning it to the client.

  8. Common Gateway Interface (CGI) • If the request identifies a file on disk, the server can just return the file's contents. Alternatively, the document's content can be composed on the fly. • One way of doing this is to let a console application compute the document's contents, and tell the web server to use that console application. • CGI specifies which information is communicated between the Web server and such a console application, and how. • The Web server software will invoke the console application as a command. • CGI defines how information about the request (such as the URL) is passed to the command in the form of arguments and environment variables.

  9. Common Gateway Interface (CGI) • The application is supposed to write the output document to standard output; CGI defines how it can pass back extra information about the output (such as the MIME type, which defines the type of document being returned) by prepending it with headers.

  10. Common Gateway Interface (CGI)

  11. Common Gateway Interface (CGI) • CGI programs can be written with many languages. CGI can be programmed in C, C++, Java, Perl, Visual Basic, or any other language which can accept user input, process that input, and respond with output. • CGI works with many different types of systems. CGI works on Mac, NT, Windows, OS2, Amiga, UNIX, and pretty much every operating system which runs web server software. • By the way, if you use a "platform independent" language like Perl or Java to write your CGI script, the exact same CGI script can be moved directly from one platform to another without it breaking!

  12. Common Gateway Interface (CGI) • CGI is not a language. CGI is a standard of communication, a process, an interface which provides well-defined rules for creating partnerships. The benefit is that if everyone follows the rules of the interface, then everyone can talk to each other. Thus, typically we say that we write "CGI programs" or "CGI scripts" which perform the functions of the common gateway interface.

  13. CGI Applications Forms • One of the most prominent uses of CGI is in processing forms. • Forms are a subset of HTML that allow the user to supply information. The forms interface makes Web browsing an interactive process for the user and the provider.

  14. CGI Applications

  15. CGI Applications • Generally, forms are used for two main purposes. • At their simplest, forms can be used to collect information from the user. • But they can also be used in a more complex manner to provide back-and-forth interaction. • For example, the user can be presented with a form listing the various documents available on the server, as well as an option to search for particular information within these documents. A CGI program can process this information and return document(s) that match the user's selection criteria.

  16. CGI Applications Gateways • Web gateways are programs or scripts used to access information that is not directly readable by the client. • For example, Oracle database that contains baseball statistics for all the players on your company team and you would like to provide this information on the Web. How would you do it? You certainly cannot point your client to the database file (i.e., open the URL associated with the file) and expect to see any meaningful data. • CGI provides a solution to the problem in the form of a gateway. You can use a language such as oraperl or a DBI extension to Perl to form SQL queries to read the information contained within the database.

  17. CGI Applications • Once you have the information, you can format and send it to the client. In this case, the CGI program serves as a gateway to the Oracle database. • Similarly, you can write gateway programs to any other Internet information service, including Archie, WAIS, and NNTP (Usenet News).

  18. CGI Applications Virtual Documents • Virtual, or dynamic, document creation is at the heart of CGI. Virtual documents are created on the fly in response to a user's information request. You can create virtual HTML, plain text, image, and even audio documents. • A simple example of a virtual document could be something as trivial as this: Welcome to Shishir's WWW Server! You are visiting from diamond.com. The load average on this machine is 1.25. Happy navigating!

  19. CGI Applications • In this example, there are two pieces of dynamic information: • the alphanumeric address (IP name) of the remote user • and the load average on the serving machine. • On the other hand, very complex virtual documents can be created by writing programs that use a combination of graphics libraries, gateways, and forms. • As a more sophisticated example, say you are the manager of an art gallery that specializes in selling replicas of ancient Renaissance paintings and you are interested in presenting images of these masterpieces on the Web. • You start out by creating a form that asks for user information for the purpose of promotional mailings, presents a search field for the user to enter the name of a painting, as well as a selection list containing popular paintings. • Once the user submits the form to the server, a program can email the user information to a certain address, or store it in a file. And depending on the user's selection, either a message stating that the painting does not exist or an image of the painting can be displayed along with some historical information located elsewhere on the Internet.

  20. CGI Applications • Along with the picture and history, another form with several image processing options to modify the brightness, contrast, and/or size of the picture can be displayed. • You can write another CGI program to modify the image properties on the fly using certain graphics libraries, sending the resultant picture to the client.

  21. CGI Applications Some Working CGI Applications • Lycos World Wide Web Search • Located at http://www.lycos.com, this server allows the user to search the Web for specific documents. Lycos returns a dynamic hypertext document containing the documents that match the user's search criteria. • Coloring Book • An entertaining application that displays an image for users to color. It can be accessed at http://www.ravenna.com/coloring. • ArchiePlex Gateway • A gateway to the Archie search server. Allows the user to search for a specific string and returns a virtual hypertext document. This useful gateway is located at http://pubweb.nexor.co.uk/public/archie/archieplex/archieplex.html.

  22. CGI Applications • Guestbook with World Map • A guestbook is a forms-based application that allows users to leave messages for everyone to see. Though there are numerous guestbooks on the Web, this is one of the best. You can access it at http://www.cosy.sbg.ac.at/rec/guestbook. • Japanese <-> English Dictionary • A sophisticated CGI program that queries the user for an English word, and returns a virtual document with graphic images of an equivalent Japanese word, or vice versa. It can be accessed at http://www.wg.omron.co.jp/cgi-bin/je?SASE=jfiedl.html or at http://enterprise.ic.gc.ca/cgi-bin/j-e.

  23. LINKS • www.cgi101.com/learn/ch1/text.html • http://www.oocities.com/webkiddie/links.html • CGI Programming on the World Wide Web • http://oreilly.com/openbook/cgi/ch00_01.html

More Related