* conf/crossdomain.xml 파일을 만들고 아래의 내용을 넣어준다. * conf/VHost.xml 파일을 열어서 아래의 내용을 추가해 준다. com.wowza.wms.http.HTTPCrossdomain *crossdomain.xml none * 와우자를 다시 시작해 준다. * 또 다른 방법으로 아래의 소스를 이용해 모듈을 만들어서 추가해 준다. package com.wowza.wms.http; import java.io.*; import java.util.*; import java.net.*; import com.wowza.wms.application.*; import com.wowza.wms.client.*; import com.wowza.wms.logging.*; import com.wowza.wms.server.*; import com.wowza.wms.vhost.*; import com.wowza.wms.http.*; import com.wowza.util.*; import com.wowza.wms.httpstreamer.model.*; //import org.json.*; public class HTTPConnectionCountsXMLCORS extends HTTProvider2Base { class MyCounter { int total = 0; } private void outputConnectionInfo(StringBuffer ret, ConnectionCounter counter) { ret.append(""+counter.getCurrent()+""); ret.append(""+counter.getTotal()+""); ret.append(""+counter.getTotalAccepted()+""); ret.append(""+counter.getTotalRejected()+""); } private void outputIOPerformanceInfo(StringBuffer ret, IOPerformanceCounter ioPerformance) { ret.append(""+ioPerformance.getMessagesInBytesRate()+""); ret.append(""+ioPerformance.getMessagesOutBytesRate()+""); } private int toCount(Integer intObj, MyCounter counter) { int ret = intObj==null?0:intObj.intValue(); counter.total += ret; return ret; } public void onHTTPRequest(IVHost inVhost, IHTTPRequest req, IHTTPResponse resp) { if (!doHTTPAuthentication(inVhost, req, resp)) return; StringBuffer ret = new StringBuffer(); String queryStr = req.getQueryString(); Map queryMap = HTTPUtils.splitQueryStr(queryStr); boolean isFlat = false; isFlat = this.properties.getPropertyBoolean("isFlat", isFlat); if (queryMap.containsKey("flat")) isFlat = true; try { List vhostNames = VHostSingleton.getVHostNames(); ret.append("\n"); IServer server = Server.getInstance(); if (!isFlat) { outputConnectionInfo(ret, server.getConnectionCounter()); outputIOPerformanceInfo(ret, server.getIoPerformanceCounter()); } Iterator iter = vhostNames.iterator(); while (iter.hasNext()) { String vhostName = iter.next(); IVHost vhost = (IVHost)VHostSingleton.getInstance(vhostName); if (vhost != null) { if (!isFlat) { ret.append(""); ret.append(""+URLEncoder.encode(vhostName, "UTF-8")+""); ret.append(""+vhost.getTimeRunningSeconds()+""); ret.append(""+vhost.getConnectionLimit()+""); outputConnectionInfo(ret, vhost.getConnectionCounter()); outputIOPerformanceInfo(ret, vhost.getIoPerformanceCounter()); } List appNames = vhost.getApplicationNames(); Iterator appNameIterator = appNames.iterator(); while (appNameIterator.hasNext()) { String applicationName = appNameIterator.next(); IApplication application = vhost.getApplication(applicationName); if (application == null) continue; if (!isFlat) { ret.append(""); ret.append(""+URLEncoder.encode(applicationName, "UTF-8")+""); ret.append("loaded"); ret.append(""+application.getTimeRunningSeconds()+""); outputConnectionInfo(ret, application.getConnectionCounter()); outputIOPerformanceInfo(ret, application.getIoPerformanceCounter()); } List appInstances = application.getAppInstanceNames(); Iterator iterAppInstances = appInstances.iterator(); while (iterAppInstances.hasNext()) { String appInstanceName = iterAppInstances.next(); IApplicationInstance appInstance = application.getAppInstance(appInstanceName); if (appInstance == null) continue; if (!isFlat) { ret.append(""); ret.append(""+URLEncoder.encode(appInstance.getName(), "UTF-8")+""); ret.append(""+appInstance.getTimeRunningSeconds()+""); outputConnectionInfo(ret, appInstance.getConnectionCounter()); outputIOPerformanceInfo(ret, appInstance.getIOPerformanceCounter()); } Map flashCounts = appInstance.getPlayStreamCountsByName(); Map smoothCounts = appInstance.getHTTPStreamerSessionCountsByName(IHTTPStreamerSession.SESSIONPROTOCOL_SMOOTHSTREAMING); Map cupertinoCounts = appInstance.getHTTPStreamerSessionCountsByName(IHTTPStreamerSession.SESSIONPROTOCOL_CUPERTINOSTREAMING); Map sanjoseCounts = appInstance.getHTTPStreamerSessionCountsByName(IHTTPStreamerSession.SESSIONPROTOCOL_SANJOSESTREAMING); Map rtspCounts = appInstance.getRTPSessionCountsByName(); List publishStreams = appInstance.getStreams().getPublishStreamNames(); Set streamNames = new HashSet(); streamNames.addAll(publishStreams); streamNames.addAll(flashCounts.keySet()); streamNames.addAll(smoothCounts.keySet()); streamNames.addAll(cupertinoCounts.keySet()); streamNames.addAll(sanjoseCounts.keySet()); streamNames.addAll(rtspCounts.keySet()); Iterator siter = streamNames.iterator(); while(siter.hasNext()) { String streamName = siter.next(); MyCounter counter = new MyCounter(); if (isFlat) { int flashCount = toCount(flashCounts.get(streamName), counter); int cupertinoCount = toCount(cupertinoCounts.get(streamName), counter); int smoothCount = toCount(smoothCounts.get(streamName), counter); int sanjoseCount = toCount(sanjoseCounts.get(streamName), counter); int rtspCount = toCount(rtspCounts.get(streamName), counter); ret.append(""); } else { ret.append(""); ret.append(""+URLEncoder.encode(streamName, "UTF-8")+""); ret.append(""+toCount(flashCounts.get(streamName), counter)+""); ret.append(""+toCount(cupertinoCounts.get(streamName), counter)+""); ret.append(""+toCount(sanjoseCounts.get(streamName), counter)+""); ret.append(""+toCount(smoothCounts.get(streamName), counter)+""); ret.append(""+toCount(rtspCounts.get(streamName), counter)+""); ret.append(""+counter.total+""); ret.append(""); } } if (!isFlat) ret.append(""); } if (!isFlat) ret.append(""); } if (!isFlat) ret.append(""); } } ret.append(""); } catch (Exception e) { WMSLoggerFactory.getLogger(HTTPServerVersion.class).error("HTTPServerInfoXML.onHTTPRequest: "+e.toString()); e.printStackTrace(); } try { resp.setHeader("Access-Control-Allow-Origin", "*"); resp.setHeader("Content-Type", "text/xml"); OutputStream out = resp.getOutputStream(); byte[] outBytes = ret.toString().getBytes(); out.write(outBytes); } catch (Exception e) { WMSLoggerFactory.getLogger(HTTPServerVersion.class).error("HTTPServerInfoXML.onHTTPRequest: "+e.toString()); e.printStackTrace(); } } } * VHost.xml 파일에 추가한다. com.wowza.wms.http.HTTPConnectionCountsXMLCORS statsXMLCORS* none