AjaxStubDispatch

This base class of AjaxStub sets the CGI content type which is used to determine the encode method (JSON, XML, HTML). It also encodes your stub results into one of these three encode types and dispatches everything to your page. This class is used internally and is not needed by an implementation using AjaxStub.

Static Member Objects
All these objects are accessible through the AjaxStub interface.
__init__(self, cType=HTML)
Passing any of the three static members to the constructor will enable the content type defined by that member static object. If custom content types have been added with the addContentType() class method the key name for the custom type can be passes to this argument.
_getContentType(self)
Returns the content type for this submission.
addContentType(self, typeMap)
This is a class method that can be called before subclass AjaxStub is instantiated to add custom content types. The typeMap argument is a map of custom content types of which he key can be passed to the constructor.
AjaxStub.addContentType({'APP': 'application/x-JavaScript'})

as = AjaxStub('APP')


Remember you are instantiation the subclass not AjaxStubDispatch.

initRequest(self)
Sends the content type in response to the request of the client.
processClientRequest(self)
Sends the results to the client.
dispatchJavaScript(self)
Sends the generated JavaScript to the client when the page is requested.
_encodeHTML(self, data)
Encodes the resultant data into the text/html content type. This method can be overridden.
_encodeJSON(self, data)
Encodes the resultant date into the text/x-json content type. This method can be overridden.
_encodeXML(self, data)
Encodes the resultant date into the text/xml content type. This method can be overridden.

Carl J. Nobile 2007-08-02