package com.defonds.wms.module.server; import java.io.IOException; import java.io.OutputStream; import com.wowza.wms.http.HTTProvider2Base; import com.wowza.wms.http.IHTTPRequest; import com.wowza.wms.http.IHTTPResponse; import com.wowza.wms.logging.WMSLogger; import com.wowza.wms.logging.WMSLoggerFactory; import com.wowza.wms.vhost.IVHost; public class ServerMonitorHttpInterface extends HTTProvider2Base { private static final WMSLogger logger = WMSLoggerFactory.getInstance().getLoggerObj(ServerMonitorHttpInterface.class.getName()); @Override public void onHTTPRequest(IVHost ivHost, IHTTPRequest request, IHTTPResponse response) { String id = request.getParameter("id"); String name = request.getParameter("name"); logger.debug("ServerMonitorHttpInterface--http--request--id=" + id + ";name=" + name); // TODO do your own business logic here String jsonObject = "{\"key1\":\"value1\",\"key2\":\"value2\"}"; response.setHeader("Content-Type", "application/json"); // Get the printwriter object from response to write the required json object to the output stream OutputStream out = response.getOutputStream(); try { out.write(jsonObject.getBytes()); out.flush(); } catch (IOException e) { logger.error(e.getMessage(), e); } } }3. 编辑 VHost.xml
<HTTPProvider> <BaseClass>com.defonds.wms.module.server.ServerMonitorHttpInterface</BaseClass> <RequestFilters>monitor*</RequestFilters> <AuthenticationMethod>none</AuthenticationMethod> </HTTPProvider>
<HTTPProvider> <BaseClass>com.wowza.wms.http.HTTPServerVersion</BaseClass> <RequestFilters>*</RequestFilters> <AuthenticationMethod>none</AuthenticationMethod> </HTTPProvider>
让你的 wowza 服务器提供 RESTful web 服务,布布扣,bubuko.com
让你的 wowza 服务器提供 RESTful web 服务
原文:http://blog.csdn.net/defonds/article/details/30490271