Web hosting control panel - CHAPTER 9 STATE NAVIGATION PATTERN 277 Managing
CHAPTER 9 STATE NAVIGATION PATTERN 277 Managing State at the Protocol Level Moving down one level on the technological scale, this section illustrates the HTTP communications between the client and server. The communications are started by having a web browser ask for the resource http://mydomain.com/ajax/chap07/page1, which is illustrated by the following request. Note that the illustrated requests and responses are abbreviated and show only the HTTP information that is relevant for the discussion: GET /ajax/chap07/page1 HTTP/1.1 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 The server accepts the request and responds with the following: HTTP/1.1 200 OK ETag: W/”1017-1126885576349″ Last-Modified: Fri, 16 Sep 2005 15:46:16 GMT Content-Type: text/html Content-Length: 1017 Server: Apache-Coyote/1.1 In the response, there is an ETag indicating that the content could be cached by the web browser. If the ETag were sent in response to an XMLHttpRequest request, the Cache Controller pattern could have been used. The server-generated response uses the Permutations pattern and contains information that can be represented by a web browser. The generated response represents the empty or generic representation that does not contain a state. When the generated content has been converted into a processed HTML page, the HTML body onload event is triggered. Triggering the onload event generates a request for the state associated with the resource. Following is the XMLHttpRequest-generated request: GET /ajax/chap07/page1/state HTTP/1.1 Accept: application/xml Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 X-Page-Window-Name: window-2005-10-03-10-10-10-1245 X-Page-State: none What is unique in the request for the state from the XMLHttpRequest object is that the URL is similar in structure to the resource URL, except that the state keyword is appended to the URL. The state keyword is necessary so that all proxies and browsers can uniquely identify the resource and the state associated with the resource. Using the same URL would cause problems. In the HTTP request, the additional HTTP headers X-Page-State and X-Page-Window-Nameare used. The header X-Page-State defines the state identifier, and the header X-Page-Window-Name identifies the name of the window asking for the state. What triggers the server-side State Navigation pattern implementation is either the appended state identifier or the X-Page-State HTTP header. More about the trigger will be discussed in the server-side code implementation.
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.