How to get a property value in Wowza configuration file

If you want to obtain a configuration value from a xml file in your install, you can leverage the following code:

String fileURL = Bootstrap.getServerHome(Bootstrap.CONFIGHOME) + "/conf/" + applicationName + "/Application.xml"; 
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder domBuilder = domFactory.newDocumentBuilder();
Document doc = domBuilder.parse(fileURL);

XPathFactory factory = XMLUtils.newXPathFactory();
factory.newXPath();

if (doc != null)
{
	Element root = doc.getDocumentElement(); 
	String streamTypeValue = XMLUtils.getNodeValueByTagName(root, "StreamType"); 
	// System.out.println("Stream Type of "+applicationName+" is "+streamTypeValue);
}

Comments are closed.