Web proxy server - CHAPTER 3 CONTENT CHUNKING PATTERN 75 Consider
CHAPTER 3 CONTENT CHUNKING PATTERN 75 Consider the following example HTML page:
| Nothing |
As in previous examples, a variable of type Asynchronous is instantiated. The button is wired to make an asynchronous method call with the URL /chap03/chunkjs04.js. When the request receives the JavaScript chunk, it is executed via the eval statement. After the eval statement has returned, the method dynamicFiller.MakeCall is made. The call to the method dynamicFiller. MakeCall is a general piece of code. In the implementation of the dynamicFiller.MakeCall method is the specific code managed by the server. Referencing the dynamicFiller.MakeCall method is done using an incomplete variable; that is, the initial script includes no definition of the variable dynamicFilter. Of course, a loaded and processed script cannot reference an incomplete variable because that would generate an exception. But what a script can do is load the implementation just before an incomplete variable is used. That is what the example HTML page has illustrated. For those wondering, there is no definition of dynamicFilter in the files factory.jsor asynchronous.js. Incomplete variables, types, and functions are possible in JavaScript, allowing a script to be loaded and processed without generating an exception. The following source code implements the incomplete dynamicFiller variable: var dynamicFiller = { generatedAsync : new Asynchronous(), reference : null, complete : function(status, statusText, responseText, responseXML) { dynamicFiller.reference.innerHTML = responseText; }, makeCall : function(destination) { dynamicFiller.reference = destination; dynamicFiller.generatedAsync.complete = dynamicFiller.complete; dynamicFiller.generatedAsync.call(’/chap03/chunkjs05.html’); } }
Note: If you are looking for cheap webhost to host and run your apache application check Vision jboss web hosting services