def _parse_java_configuration(self, app_engine_web_xml_path): """Parse appengine-web.xml and web.xml. Args: app_engine_web_xml_path: A string containing the full path of the .../WEB-INF/appengine-web.xml file. The corresponding .../WEB-INF/web.xml file must also be present. Returns: A tuple where the first element is the parsed appinfo.AppInfoExternal object and the second element is a list of the paths of the files that were used to produce it, namely the input appengine-web.xml file and the corresponding web.xml file. """ with open(app_engine_web_xml_path) as f: app_engine_web_xml_str = f.read() web_inf_dir = os.path.dirname(app_engine_web_xml_path) web_xml_path = os.path.join(web_inf_dir, 'web.xml') with open(web_xml_path) as f: web_xml_str = f.read() has_jsps = False for _, _, filenames in os.walk(self.application_root): if any(f.endswith('.jsp') for f in filenames): has_jsps = True break app_yaml_str = yaml_translator.TranslateXmlToYamlForDevAppServer( app_engine_web_xml_str, web_xml_str, has_jsps, self.application_root) config = appinfo.LoadSingleAppInfo(app_yaml_str) return config, [app_engine_web_xml_path, web_xml_path]
def _parse_java_configuration(self, app_engine_web_xml_path): """Parse appengine-web.xml and web.xml. Args: app_engine_web_xml_path: A string containing the full path of the .../WEB-INF/appengine-web.xml file. The corresponding .../WEB-INF/web.xml file must also be present. Returns: A tuple where the first element is the parsed appinfo.AppInfoExternal object and the second element is a list of the paths of the files that were used to produce it, namely the input appengine-web.xml file and the corresponding web.xml file. """ with open(app_engine_web_xml_path) as f: app_engine_web_xml_str = f.read() app_engine_web_xml = (app_engine_web_xml_parser.AppEngineWebXmlParser( ).ProcessXml(app_engine_web_xml_str)) quickstart = xml_parser_utils.BooleanValue( app_engine_web_xml.beta_settings.get('java_quickstart', 'false')) web_inf_dir = os.path.dirname(app_engine_web_xml_path) if quickstart: app_dir = os.path.dirname(web_inf_dir) web_xml_str, web_xml_path = java_quickstart.quickstart_generator( app_dir) webdefault_xml_str = java_quickstart.get_webdefault_xml() web_xml_str = java_quickstart.remove_mappings( web_xml_str, webdefault_xml_str) else: web_xml_path = os.path.join(web_inf_dir, 'web.xml') with open(web_xml_path) as f: web_xml_str = f.read() has_jsps = False for _, _, filenames in os.walk(self.application_root): if any(f.endswith('.jsp') for f in filenames): has_jsps = True break web_xml = web_xml_parser.WebXmlParser().ProcessXml( web_xml_str, has_jsps) app_yaml_str = yaml_translator.TranslateXmlToYamlForDevAppServer( app_engine_web_xml, web_xml, self.application_root) config = appinfo.LoadSingleAppInfo(app_yaml_str) return config, [app_engine_web_xml_path, web_xml_path]