Diffusion Web Server

Diffusion Web Server

By setting http.enabled on a Client Connector this connector can act as a Web Server and serve files as well as Diffusion client requests

Compression

If the web server is required to serve a file, which has a mime type of text or is Javascript the Web Server will send the response compressed. This response is then cached for future requests in its compressed state.

Cache

The web server will cache all file requests in order to serve them as fast as possible. If the static property in the web server section is set to true, once a file has been cached it will not check again to see if the file has changed. If the property is set to false, then every time that the file is requested the Web Server will check to see if the file has changed and needs to be reloaded. It is envisaged that this property will be set to true in production and false in development. If the property is set to true and some modifications need to be made to the files, then using the JMX console, the Web Server cache can be emptied.

HTML Minification

The server is able to minify HTML for static and dynamic HTML pages, before they are compressed and sent to the browser

Server Side processing

Server side processing can be utilised with any file that has a text mime type and Javascript. Currently there are two server side tags, DiffusionInclude and DiffusionTag. These are stored in HTML comments as to not interfere with normal HTML

DiffusionInclude

Include stubs load the file specified in the file attribute and are loaded as is into the parent HTML document. The include stubs can be positioned anywhere in the HTML file. These includes are synonymous with Hash Include statements. Below is and example of the syntax

<!--@DiffusionInclude file="stub.html"  -->

DiffusionTag

DiffusionTags allow a publisher to interact with the web page during the serving process. These tags can appear anywhere within the parent document. Below is an example of a Diffusion tag.

<!--@DiffusionTag publisher="Trade" tagid="table"  -->

The publisher method processHTMLTag will be called with the tag argument located in the tagid attribute, which in this case would be table. The publisher can then return a String of HTML that will be injected into the document.