【问题标题】:how to create httpprovider for another server如何为另一台服务器创建 httpprovider
【发布时间】:2017-06-07 21:41:08
【问题描述】:

我尝试在 eclipe 中创建 httpprovider,但在 wowza 媒体服务器中运行时,它无法正确加载,它只返回 wowza 服务器版本。 eclipse的代码在这里

package com.domain.appname;

import java.io.IOException;
import java.io.OutputStream;

import com.wowza.wms.vhost.IVHost;
import com.wowza.wms.http.HTTProvider2Base;
import com.wowza.wms.http.IHTTPRequest;
import com.wowza.wms.http.IHTTPResponse;

public class CreateApp extends HTTProvider2Base {

    public void onHTTPRequest(IVHost inVhost, IHTTPRequest req, IHTTPResponse resp){

        String ret = req.getQueryString();

        resp.setHeader("Content-Type", "text/xml");

        OutputStream out = resp.getOutputStream();
        byte[] outBytes = ret.toString().getBytes();
        try {
            out.write(outBytes);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}

并将 vhost 文件设置为

<HTTPProvider>
<BaseClass>com.domain.appname.CreateApp</BaseClass>
<RequestFilters>CreateProducerApp*</RequestFilters>
<AuthenticationMethod>none</AuthenticationMethod>
</HTTPProvider>

请帮忙

【问题讨论】:

    标签: wowza


    【解决方案1】:

    如果没有看到完整的 vhost.xml,我猜你将新的 HTTPProvider 放在 HTTPProvider 列表的最后。

    当服务器处理 http 请求时,它会从第一个请求开始并尝试每个请求。返回服务器信息的提供者的 RequestFilter 是“*”,这意味着在此之后不会调用任何提供者。这通常是最后一个。请确保您的在此之前。

    【讨论】:

      【解决方案2】:

      请在以下块之前将您的 HTTPProvider 条目放在 vHosts 文件中:

      <HTTPProvider>              
        <BaseClass>com.wowza.wms.http.HTTPServerVersion</BaseClass>
        <RequestFilters>*</RequestFilters>
        <AuthenticationMethod>none</AuthenticationMethod>
      </HTTPProvider>
      

      否则您的所有请求都会提供 Wowza 版本的详细信息。

      因此,您最终的 vhost 文件的结尾应如下所示:

      <HTTPProvider>
        <BaseClass>com.domain.appname.CreateApp</BaseClass>
        <RequestFilters>CreateProducerApp*</RequestFilters>
        <AuthenticationMethod>none</AuthenticationMethod>
      </HTTPProvider>
      <HTTPProvider>              
        <BaseClass>com.wowza.wms.http.HTTPServerVersion</BaseClass>
        <RequestFilters>*</RequestFilters>                            
        <AuthenticationMethod>none</AuthenticationMethod>
      </HTTPProvider>
      

      【讨论】:

        猜你喜欢
        • 2021-02-15
        • 2018-08-26
        • 1970-01-01
        • 2016-10-17
        • 1970-01-01
        • 2018-06-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多