com.wowza.wms.http
Class HTTProvider2Base

Object
  extended by com.wowza.wms.http.HTTProvider2Base
All Implemented Interfaces:
IHTTPProvider, IHTTPProvider2

public abstract class HTTProvider2Base
extends Object
implements IHTTPProvider2

HTTProvider2Base: base class for implementing HTTP Providers.

Simple HTTPProvider class

public class HTTPHelloWowza extends HTTProvider2Base
{
        public void onHTTPRequest(IVHost vhost, IHTTPRequest req, IHTTPResponse resp)
        {
                if (!doHTTPAuthentication(vhost, req, resp))
                        return;


                String retStr = "Hello WowzaHello Wowza";
                try
                {
                        OutputStream out = resp.getOutputStream();
                        byte[] outBytes = retStr.getBytes();
                        out.write(outBytes);
                }
                catch (Exception e)
                {
                        WMSLoggerFactory.getLogger(HTTPServerVersion.class).error("HTMLServerVersion: "+e.toString());
                }

        }
}


Field Summary
protected  IAuthenticate authenticateHandler
           
protected  IAuthenticateHTTPProvider authenticateHTTPProviderHandler
           
protected  String authenticationMethod
           
protected  java.util.List<com.wowza.wms.http.HTTProvider2Base.QuickFilter> filters
           
protected  WMSProperties properties
           
protected  String requestFilters
           
 
Constructor Summary
HTTProvider2Base()
           
 
Method Summary
 boolean canHandle(String path)
          Return true if can handle the request
 boolean doHTTPAuthentication(IVHost vhost, IHTTPRequest req, IHTTPResponse resp)
          Handle authentication request
 String getAuthenticationMethod()
          Get the authentication method: digest, basic, none...
 String getPath(IHTTPRequest req, boolean removeFilter)
          Get the request path
 String getRequestFilters()
          Get the request filter
 void init()
          Initialize the HTTPProvider
 void onBind(IVHost vhost, HostPort hostPort)
          Called when bind is called on port
 void onUnbind(IVHost vhost, HostPort hostPort)
          Called when unbinid is called on port
 void setAuthenticationMethod(String authenticationMethod)
          Set authentication method: digest, basic, none...
 void setProperties(WMSProperties properties)
          Set properties
 void setRequestFilters(String requestFilters)
          Set the request filter
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.wowza.wms.http.IHTTPProvider
onHTTPRequest
 

Field Detail

authenticateHandler

protected IAuthenticate authenticateHandler

authenticateHTTPProviderHandler

protected IAuthenticateHTTPProvider authenticateHTTPProviderHandler

authenticationMethod

protected String authenticationMethod

filters

protected java.util.List<com.wowza.wms.http.HTTProvider2Base.QuickFilter> filters

properties

protected WMSProperties properties

requestFilters

protected String requestFilters
Constructor Detail

HTTProvider2Base

public HTTProvider2Base()
Method Detail

canHandle

public boolean canHandle(String path)
Return true if can handle the request

Specified by:
canHandle in interface IHTTPProvider2
Parameters:
path - request path
Returns:
true, if can handle the request

doHTTPAuthentication

public boolean doHTTPAuthentication(IVHost vhost,
                                    IHTTPRequest req,
                                    IHTTPResponse resp)
Handle authentication request

Parameters:
vhost - vhost
req - request
resp - response
Returns:
true, if request should be handled by the HTTPProvider subclass

getAuthenticationMethod

public String getAuthenticationMethod()
Get the authentication method: digest, basic, none...

Specified by:
getAuthenticationMethod in interface IHTTPProvider2
Returns:
authentication method

getPath

public String getPath(IHTTPRequest req,
                      boolean removeFilter)
Get the request path

Parameters:
req - request
removeFilter - set to true to remove filter part of URL
Returns:
path

getRequestFilters

public String getRequestFilters()
Get the request filter

Specified by:
getRequestFilters in interface IHTTPProvider2
Returns:
request filter

init

public void init()
Initialize the HTTPProvider

Specified by:
init in interface IHTTPProvider2

onBind

public void onBind(IVHost vhost,
                   HostPort hostPort)
Called when bind is called on port

Specified by:
onBind in interface IHTTPProvider
Parameters:
vhost - vhost
hostPort - host port

onUnbind

public void onUnbind(IVHost vhost,
                     HostPort hostPort)
Called when unbinid is called on port

Specified by:
onUnbind in interface IHTTPProvider
Parameters:
vhost - vhost
hostPort - host port

setAuthenticationMethod

public void setAuthenticationMethod(String authenticationMethod)
Set authentication method: digest, basic, none...

Specified by:
setAuthenticationMethod in interface IHTTPProvider2
Parameters:
authenticationMethod - authentication method

setProperties

public void setProperties(WMSProperties properties)
Set properties

Specified by:
setProperties in interface IHTTPProvider
Parameters:
properties - properties

setRequestFilters

public void setRequestFilters(String requestFilters)
Set the request filter

Specified by:
setRequestFilters in interface IHTTPProvider2
Parameters:
requestFilters - request filter