Most applications communicate with a server in one way or another. It is imperative that you understand a number of concepts related to the web before continuing in this book. This section explains those concepts concisely.
Fundamentals of the web
What is the web?
The web is a complex system of interconnected systems possessing the ability to communicate with other systems existing on a common network via one or more protocols. A protocol is an official, well-defined system of rules governing the exchange of information between devices.
Hypertext Transfer Protocol
All communications over the web are made in accordance with a protocol. A particularly important protocol for fostering communication between systems is the Hypertext Transfer Protocol (HTTP).
Billions of images, videos, text files, documents, and other files are transferred across the internet on a daily basis. These files are all transferred through HTTP. HTTP is an application protocol for distributed and hypermedia information systems. It can be said to be a foundational component for communication across the internet. A major benefit of using HTTP for data transfer across systems is that it is highly reliable. This is as a result of its utilization of reliable protocols, such as the Transmission Control Protocol (TCP) and Internet Protocol (IP).
Clients and servers
A web client is any application that communicates with a web server utilizing HTTP. A web server is a computer that provides – or serves – web resources to web clients. A web resource is anything that provides web content. A web resource can be a media file, an HTML document, a gateway, and so on. Clients need web content for various purposes, such as information rendering and data manipulation.
Clients and servers communicate with each other via HTTP. One major reason for the utilization of HTTP is the fact that it is extremely reliable in data transmission. The use of HTTP ensures data loss does not occur in a request-response cycle.
HTTP requests and responses
An HTTP request – as the name replies – is a solicitation for a web resource sent by a web client to a server over HTTP. An HTTP response is a reply – sent by a server – to a request in an HTTP transaction:
HTTP methods
HTTP supports a number of request methods. These methods can also be referred to as commands. HTTP methods specify the type of action to be performed by the server. Some common HTTP methods are tabularized as follows:
HTTP method | Description |
GET |
Retrieves a named resource present on the client. |
POST |
Sends data from a client to a server. |
DELETE |
Deletes a named resource residing on a server. |
PUT |
Store data collected by the client in a named resource residing on the server. |
OPTIONS |
Returns HTTP methods that the server supports. |
HEAD |
Retrieves HTTP headers with no content. |