Hi,
I am trying to integrate Wurfl's cloud service with the Wowza streaming server (detect dynamically the streaming capabilities of each device ).
The problem is that Wowza is not a Servlet container, and as such I don't have access to the HTTPServletRequest/Response.
Using Wurfl's Cloud service, how can I obtain the Wurfl device if I only have the User-Agent String?
Thanks and regards,
Victor
Integration with Wowza streaming server
-
- Posts: 38
- Joined: Tue Jan 31, 2012 10:27 am
Re: Integration with Wowza streaming server
Hi Victor,
actually it is very important for WURFL Cloud to have access to the HTTP request, since the matching performance does not depend on the user agent string only, but also on several other HTTP headers.
The HttpServletRequest instance, on the other hand, is used only to manage a Cookie based cache (see below for more details).
As I have rapidly seen in the Wowza API, there exist IHttpRequest and IHttpResponse interfaces.
Since HttpServletRequest/Response are interfaces themselves, if you have access to such interfaces, it is quite easy to mirror the methods.
Apart from header methods, if you are using a Cookie cache (notice that if you are a free user, it is the only cache available), you have to manage request::getCookies() and response::setCookie(Cookie) methods, not only to avoid exceptions being thrown, but also to allow the cache to work.
Let me know if you have any problem implementing this, or if for some reason you don't have any access to instances of IHttpRequest and IHttpResponse.
Thanks,
Fulvio
actually it is very important for WURFL Cloud to have access to the HTTP request, since the matching performance does not depend on the user agent string only, but also on several other HTTP headers.
The HttpServletRequest instance, on the other hand, is used only to manage a Cookie based cache (see below for more details).
As I have rapidly seen in the Wowza API, there exist IHttpRequest and IHttpResponse interfaces.
Since HttpServletRequest/Response are interfaces themselves, if you have access to such interfaces, it is quite easy to mirror the methods.
Apart from header methods, if you are using a Cookie cache (notice that if you are a free user, it is the only cache available), you have to manage request::getCookies() and response::setCookie(Cookie) methods, not only to avoid exceptions being thrown, but also to allow the cache to work.
Let me know if you have any problem implementing this, or if for some reason you don't have any access to instances of IHttpRequest and IHttpResponse.
Thanks,
Fulvio
Re: Integration with Wowza streaming server
Hi Fulvio,
Thank you very much for your reply.
I don't think your solution would work. Event if there was a match between the methods of both interfaces (HttpServletRequest and IHttpRequest), how would I tell Wowza to use my new implementation (which would extend actual Wowza implemantation and implement HttpServletRequest)? The same for the response classes.
Even if the above would be possible, most of the methods would have to be null implementations, and in that case, as I don't know Wurfl internal's, the result could be erroneous.
Having said this, let me ask you if it is possible to add a method which returns the device capabilities based on the User agent String?
In my scenario, I could perfectly live without any cache.
Thanks in advance.
Best regards,
Victor
Thank you very much for your reply.
I don't think your solution would work. Event if there was a match between the methods of both interfaces (HttpServletRequest and IHttpRequest), how would I tell Wowza to use my new implementation (which would extend actual Wowza implemantation and implement HttpServletRequest)? The same for the response classes.
Even if the above would be possible, most of the methods would have to be null implementations, and in that case, as I don't know Wurfl internal's, the result could be erroneous.
Having said this, let me ask you if it is possible to add a method which returns the device capabilities based on the User agent String?
In my scenario, I could perfectly live without any cache.
Thanks in advance.
Best regards,
Victor
-
- Posts: 38
- Joined: Tue Jan 31, 2012 10:27 am
Re: Integration with Wowza streaming server
Hi Victor.
What I suggested was to implement a wrapper of HttpServletRequest around the IHTTPRequest coming from Wowza.
I didn't understand from your response if you don't have a reference to an IHTTPRequest at all, or if you have completely discarded this solution for other reasons.
This is a code snippet of what I suggest to impelment:
My suggestion is to forward as many methods as possible, since the cloud API could exploit more and more information from the HTTP request in the future.
So far, the mandatory methods we are using are:
http://www.wowza.com/resources/serverap ... quest.html
all these methods are available in the IHTTPRequest, so forwarding should be trivial.
Another method we use in the request is getCookies(), but the possibility that a null is returned is managed inside the API.
As for the response, the only method used so far is addCookie(Cookie cookie).
If you are a premium user (please confirm), you can easily disable the cache, and you can simply pass a null as a response reference.
Otherwise, just write a class which implements the HttpServletResponse, having all void methods doing nothing, and all functions returning null or default values, and the Cloud should run smoothly.
Regards,
Fulvio
What I suggested was to implement a wrapper of HttpServletRequest around the IHTTPRequest coming from Wowza.
I didn't understand from your response if you don't have a reference to an IHTTPRequest at all, or if you have completely discarded this solution for other reasons.
This is a code snippet of what I suggest to impelment:
Code: Select all
class HttpServletWrapper {
private final IHTTPRequest mRequest;
HttpServletWrapper(IHTTPRequset request) {
mRequest = request;
}
public String getHeader(String name) {
return mRequest.getHeader(name);
}
// all other stuff...
}
So far, the mandatory methods we are using are:
- getHeaderNames()
getHeader(String name)
getParameter(String name)
getRemoteAddr()
http://www.wowza.com/resources/serverap ... quest.html
all these methods are available in the IHTTPRequest, so forwarding should be trivial.
Another method we use in the request is getCookies(), but the possibility that a null is returned is managed inside the API.
As for the response, the only method used so far is addCookie(Cookie cookie).
If you are a premium user (please confirm), you can easily disable the cache, and you can simply pass a null as a response reference.
Otherwise, just write a class which implements the HttpServletResponse, having all void methods doing nothing, and all functions returning null or default values, and the Cloud should run smoothly.
Regards,
Fulvio
Re: Integration with Wowza streaming server
Hi Fulvio,
We have managed to get a reference to Wowza's IHTTPRequest and we have implemented the wrapper. Null implementation, except for the methods your referred:
getHeaderNames()
getHeader(String name)
getParameter(String name)
getRemoteAddr()
It is working nice!
Thank you very much.
Best regards,
Victor
We have managed to get a reference to Wowza's IHTTPRequest and we have implemented the wrapper. Null implementation, except for the methods your referred:
getHeaderNames()
getHeader(String name)
getParameter(String name)
getRemoteAddr()
It is working nice!
Thank you very much.
Best regards,
Victor
Who is online
Users browsing this forum: No registered users and 5 guests