Response construction
At some point in handling the request, the application must send a response back to the client. In the context of MVC, this corresponds to the View component.
The response may take one of several different forms:
- In the most common case, the request is successfully completed and the client is sent back a dynamically generated HTML page.
- Content other than a HTML Web page has to be returned to the client, for example a MP3 audio file.
- The client request cannot be handled completely by the current URL handler and the client is redirected to a different URL.
- Errors were encountered in handling the request and an error page needs to be displayed to the client.
Each of these forms is discussed in subsequent sections, but it is important to keep in mind that every client request must result in exactly one response being returned. An error is generated if, for example, a redirect response is attempted in conjunction with returning of a Web page during the handling of a single request.