Wowza Community

HTTPProvider that returns detail server info

https://www.wowza.com/docs/how-to-get-detailed-server-info-with-an-http-provider

I updated the code in the first post for Wowza Server 2. It should work properly now.

Charlie

Charlie,

This are the same code than currently are running in the las Update?

I’m try to make my own HTTPProvider Info and starting with this example does not work.

I receive allways the crossdomain.xml in base to the code, I read that is the default response over one exception…

BTW when you have planning launch the new version of the IDE with the update for WMS 2? and the documentation?

Thanks for any help.

Ale

The current version of the Wowza IDE works with Wowza Server 2. The documentation is included with the server in the [wowza-install-dir]/documentation folder, the WowzaMediaServer_ServerSideAPI.pdf.

Start with a “hello world” version of the HTTPProvider. In other words, start just trying to get it to load using the request filter. You can paste it into this thread.

Richard

Ale,

Take a look at this version:

http://www.wowza.com/community/t/-/84

It’s different because there is not a client associated with http streaming. The client is part of the interactive aspect of a rtmp connection which you don’t get in http streaming.

Richard

Not sure I understand, but that HTTPProvider does include Flash streams.

Richard

In that case you don’t need HTTProvider, just use Flash and netconnection, get all the same data, send AMFData from Wowza to client.

Richard

Take a look at the ServersideModules example, which shows every way of passing data and calling functions in client from server, and server from client.

[wowza-install-dir]/examples/ServerSideModules

Then make a Wowza application module and port the functionality of this HTTProvider. Replace the xml output with a AMFDataObj parameter sent to client.

Richard

The HTTProvider blocks in VHost.xml for Wowza 2 are significantly different. You are missing RequestFilters and AuthenticationMethod.

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

The RequestFilters node makes it possible to add your HTTProvider to an existing HostPort . You can use another HostPort with port 2000 as you are doing, but add the RequestFilters node with the “*” as above so that it is the default HTTProvider for that HostPort.

Also, Chrome at least does not render XML, you have to do View > Source to see it.

Richard

You can add RequestFilters and AuthenticationMethod to the HTTProvider in your HostPort:

<HostPort>
<ProcessorCount>4</ProcessorCount>
<IpAddress>*</IpAddress>
<Port>2000</Port>
<SocketConfiguration>
<ReuseAddress>true</ReuseAddress>
<ReceiveBufferSize>24000</ReceiveBufferSize>
<SendBufferSize>65000</SendBufferSize>
<KeepAlive>true</KeepAlive>
<AcceptorBackLog>100</AcceptorBackLog>
</SocketConfiguration>
<HTTPProvider>
<BaseClass>com.test.wms.module.HTTPServerConnector </BaseClass>
[B]<RequestFilters>*</RequestFilters>
<AuthenticationMethod>none</AuthenticationMethod>[/B]
<Properties>
<Property>
<Name>ContentDir</Name>
<Value>/usr/local/WowzaMediaServerPro/content</Value>
</Property>
</Properties>
</HTTPProvider>
</HostPort>

Then you can call it like this:

http://[wowza-address]:2000

Richard

I made this simple HTTProvider:

package com.wowza.wms.example.module.http;
import java.io.*;
import com.wowza.wms.http.*;
import com.wowza.wms.logging.*;
import com.wowza.wms.vhost.*;
public class HTTPTest extends HTTProvider2Base {
	public void onHTTPRequest(IVHost vhost, IHTTPRequest req, IHTTPResponse resp) {
		if (!doHTTPAuthentication(vhost, req, resp))
			return;
		String helloStr = "Hello Tester!";
		String retStr = "<html><head><title>" + helloStr
				+ "</title></head><body>" + helloStr + "</body></html>";
		try {
			OutputStream out = resp.getOutputStream();
			byte[] outBytes = retStr.getBytes();
			out.write(outBytes);
		} catch (Exception e) {
			WMSLoggerFactory.getLogger(null).error("HTTPTest: " + e.toString());
		}
	}
}

I added this HostPort to the top of the HostPortList in VHost.xml:

<HostPort>
				<ProcessorCount>4</ProcessorCount>
				<IpAddress>*</IpAddress>
				<Port>2000</Port>
				<SocketConfiguration>
					<ReuseAddress>true</ReuseAddress>
					<ReceiveBufferSize>24000</ReceiveBufferSize>
					<SendBufferSize>65000</SendBufferSize>
					<KeepAlive>true</KeepAlive>
					<AcceptorBackLog>100</AcceptorBackLog>
				</SocketConfiguration>
				<HTTPStreamerAdapterIDs>sanjosestreaming,cupertinostreaming,smoothstreaming</HTTPStreamerAdapterIDs>
				<HTTPProviders>
					<HTTPProvider>
						<BaseClass>com.wowza.wms.example.module.http.HTTPTest</BaseClass>
						<RequestFilters>*</RequestFilters>
						<AuthenticationMethod>none</AuthenticationMethod>
						<Properties>
						<Property>
						<Name>ContentDir</Name>
						<Value>/usr/local/WowzaMediaServerPro/content</Value>
						</Property>
						</Properties>
					</HTTPProvider>
				</HTTPProviders>
			</HostPort>

And I tested with this URL in a browser:

http://localhost:2000/

Result is:

Hello Tester!

I also hit a breakpoint.

Check package path compared to BaseClass. Make sure you are restarting Wowza. Make sure there you are binding to port 2000: you will see it in the startup lines in the IDE console.

Richard

Richard,

The problem what I found is with this lines:

if (crossdomainHandler.handleCrossdomainRequest(inVhost, req, resp))
	return;

With this allways responde the crossdomain.xml and not my information.

Y have comment this line and currently are working well the rest of the code.

Regards,

Ale

Thanks Charlie for the Update.

Currently I’m trying to add the other Protocols to this XML, but I don’t know how get the other Clients informations:

List clients = appInstance.getClients();

This line only work with Flash, what are the equivalent for HTTP and RTSP?

Thanks

Ale

Richards,

Excellent, I could get all the information…

Currently, I don’t understand how I can get the StreamName in a Flash Client.

For example:

ret.append("<StreamName>"+client.getStreamName()+"</StreamName>");

I see in the other protocols than “getStreamName()” exist but for Flash I don’t see nothing similar.

Do you have some example for this?

On the other hand I saw in the IOPerformanceCounter the value with decimals like this:

<MessagesOutBytesRate>105046.0</MessagesOutBytesRate>

is this correct? the value can be a decimal value?

Thanks again.

Ale

Richard,

Thank I found the option getName in the IMediaStream class.

BTW, I’m try to migrate the HTTProvider currently in XML to AMF directly for better performance with my Admin Console, Wowza support export this information to AMF?

Thanks

Ale

Richard,

Thanks for the info, have in the forum some example?

Regards,

Ale

Hi.

I’m trying to get working a V1 HTTPProvider, which just doesn’t work on V2.

I just get a blank page no matter what I try. There is nothing in logs - even no HTTP calls.

The onHTTPRequest() handler is not getting called at all.

I downloaded and installed the latest 2 IDE and Wowza 2.1.2, and tried the example on this page, but still no luck.

My VHost.xml configuration is fine.

Any idea?

Here is the sample of VHost configuration:

4

*

2000

true

24000

65000

true

100

com.test.wms.module.HTTPServerConnector

ContentDir

/usr/local/WowzaMediaServerPro/content

Hi.

Thanks for the explanation, will try.

The RequestFilters node makes it possible to add your HTTProvider to an existing HostPort .

Can you give an example, how to use the Wowza default HTTP HostPort with my provider?

Thanks again!

Hi.

  1. I tried this and it didn’t work - the debugger just doesn’t hit the breakpoint in onHTTPRequest().

Any idea?

Edit:

By the way - I tried placing just random class names, and didn’t receive any errors. Perhaps the HostProvider even don’t see the compiled classes?

  1. I actually meant about example using the Wowza default HTTP port with my own provider.

Thanks again.