Request-response loop (Definition)

The mechanism by which a web server handles a request and serves a page back to a browser.

The web browser sends a request to a web server. This is passed to the middleware application server which may create a special object to represent the request. Values passed to the web server by the browser will be reflected as properties of that request object.

This mechanism will invoke an appropriate handler. That handler may be compiled code or perhaps a script, possibly written in JavaScript in some middleware implementations.

As the handler is invoked, it is passed the request object and also an empty response object. The handler then populates the response object with headers and body contents. This may be done by means of property accessors or method calls.

Eventually the response is despatched back to the requesting browser. At this point some clean-up takes place, the request logging takes place and the request response loop is completed.

See also:Storage duration