wowza http連線基本認證做法
package com.wowza.wms.modules;
import com.wowza.wms.application.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import com.sun.istack.internal.logging.Logger;
import com.wowza.wms.amf.*;
import com.wowza.wms.client.*;
import com.wowza.wms.module.*;
import com.wowza.wms.request.*;
import com.wowza.wms.stream.*;
import com.wowza.wms.rtp.model.*;
import com.wowza.wms.httpstreamer.model.*;
import com.wowza.wms.httpstreamer.cupertinostreaming.httpstreamer.*;
import com.wowza.wms.httpstreamer.smoothstreaming.httpstreamer.*;
public class AuthCheck extends ModuleBase {
public void onHTTPSessionCreate(IHTTPStreamerSession httpSession){
boolean isGood = true;
String ipAddressClient = httpSession.getIpAddress();
String ipAddressServer = httpSession.getServerIp();
String queryStr = httpSession.getQueryStr();
String referrer = httpSession.getReferrer();
String cookieStr = httpSession.getCookieStr();
String userAgent = httpSession.getUserAgent();
IApplicationInstance appInstance = httpSession.getAppInstance();
String streamName = httpSession.getStreamName();
try {
String checkurl = "http://192.168.65.1:8080/query.php?"+queryStr;
URL connectto = new URL(checkurl);
try {
URLConnection urlopen = connectto.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(urlopen.getInputStream()));
String inputLine;
while(((inputLine = in.readLine()) != null) && ("1".equals(inputLine))){
isGood = false;
}
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(!isGood) httpSession.rejectSession();
}
}
文章來源http://charleslin74.pixnet.net/blog/post/443363204
留言列表