Example #1
0
 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();
     }
 }