Proof concept about on demand tree generation
From Morfeo Wiki
Proof concept
The development process consists in the generation of JSP pages, validation descriptors and associated script code. The process of generating JSP pages leaves its results in a well known directory and this pages define the tree of MyMobileWeb Tags. The question in this moment is which is the cost to carry to the tree generation on runtime instead of development time. The result is about 320 millisecons all process. In addition the tree is generated the first time single since it is cached in memory.
The proof concept has consisted of load and parse XML page with DOM and SAX parser and to receive styles CSS on execution time.
Source code
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="example1.css" type="text/css"?>
<html xmlns:mymw="http://morfeo-project.org/mymobileweb">
<head>
<title>Empresas</title>
</head>
<body>
<mymw:div id="p1" class="center vertical">
<mymw:table id="listComp" bind="${selectedComp}" optionsbind="${searchCompResult}"
class="tps paginate" keymember="0">
<mymw:th class="header">
<mymw:td>Empresa</mymw:td>
</mymw:th>
<mymw:tr>
<mymw:td member="1" />
</mymw:tr>
</mymw:table>
</mymw:div>
</body>
</html>
Interface Generator provides a method for generating MyMobileWeb Tree:
DocumentTag generate(WriterData wd, String url, long start) throws Throwable;
- WriterData object holds HttpRequestData, Context, etc...
- The url parameter is a path to a XML page.
- Start parameter is the millisecond when the process started.
DOMGenerator load and parses the previous page with a DOM parser and generates the MyMobileWeb tree. In addition to it's in charged of the CSS styles retrieval.
This class implements core dynamic presentation proccess, through a SAX interface event-handler process supported by a tag and atributte stack.
SAXGenerator load and parses the previous page with SAX parser and generates the MyMobileWeb tree. Moreover, it's in charged of the CSS styles retrieval.
Servlet ParserHTTP dispatch request on demand DocumentTag generation.
The class implements the abstract AbstractStylesManager for execution-time styles retrieval.
