function ServletContext($web_xml_file) { $web_xml_file = new File($web_xml_file); if (File::validClass($web_xml_file) && $web_xml_file->exists()) { $this->file =& $web_xml_file; $cache_file = new File($web_xml_file->getFilePath() . 'cached'); $valid_cache = FALSE; if ($cache_file->exists() && $web_xml_file->lastModified() == $cache_file->lastModified()) { $this->config = @unserialize(FileReader::readFileContent($cache_file)); if (ServletContext::validClass($this->config)) { $valid_cache = TRUE; } } if (!$valid_cache) { $this->config =& ServletXMLConfigReader::readXMLConfig(new FileReader($web_xml_file)); FileWriter::writeToFile($cache_file, serialize($this->config), $web_xml_file->lastModified()); } } if (isset($this->config)) { $this->initServletContext(); } }
<td bgcolor=#ffffff> <strong>jphp://jphp.demo/ServletXMLConfigReader/<a href="<?php echo $request->getRequestPath(), $source ? '">display demo</a>' : '?source=TRUE">show-source</a>'; ?> </strong></font> </td> </tr> <tr> <td bgcolor=#ffffff> <br> <?php if ($source) { highlight_string(implode('', file(__FILE__))); exit; } $data = ServletXMLConfigReader::readXMLConfig(new FileReader('web.xml')); ?> <strong>Display name : </strong> <font color="#990000" style='font-weight: bold'><?php echo $data->getDisplayName(); ?> </font> <br> <br> <dl><strong>Context : </strong> <dd>· Class use : <font color="#990000" style='font-weight: bold'><?php echo $data->getContextManager(); ?> </font> <dd><dl>· Class properties :