You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Jackson, Bruce" <br...@qualcomm.com> on 2009/01/14 13:25:24 UTC

HTTPRequestForIcon in UPnP base driver

Hi there

Using the felix UPnP base driver, I'm unable to retrieve icons for Windows
Media Player UPnP content sources.

I've followed the code through, and I come to the class:

org.apache.felix.upnp.basedriver.importer.util.HTTPRequestForIcon

...which is where the trouble is.

This class contains a method:

public InputStream getInputStream()

... Which starts with the comment:

//TODO we should speak about that

... Never a good sign :-) ! I'm trying to understand why the code manually
constructs the HTTP request and does everything at the socket level, rather
than simply:

URLConnection conn = url.openConnection();
return conn.getInputStream();

I've changed this in my local copy of the base driver, and tested it, and it
works fine. So, either this is a bit of old code that should be fixed, OR
there is a good reason to not use the JDK URLConnection class that somebody
might be aware of.

If its the latter, please let me know, and I'll see how to fix it so that it
will work with Windows Media Player.

Thanks

Bruce


Re: HTTPRequestForIcon in UPnP base driver

Posted by Stefano Lenzi <ki...@interfree.it>.
Jackson, Bruce ha scritto:
> Great!
> 
> I'm not sure why it the original code doesn't work correctly with Windows Media Player, as it seems to work fine with other sources such as Azureus or Orb.

I think that the main reason is that the HTTPConnection containing the 
Icon is handled by the CyberLink library which doesn't support all the 
"complex" feature of an HTTP Connection. Hence, it may fail with certain 
client. On the other hand, the URLConnection implemented by JVM "should 
be fully complaint" with the HTTP protocol.

> However, the URLConnection method works with all of these.
> 
> Thanks
> 
> Bruce

Bruce, I have another question for you. Are you using our UPnP Base 
Driver for an open source project?
Can you point out a website that describe your project/product?

> 
> 
> On 15/01/2009 19:50, "Stefano Lenzi" <ki...@interfree.it> wrote:
> 
> Hi Bruce,
> 
> Jackson, Bruce wrote:
>> Hi there
>>
>> Using the felix UPnP base driver, I'm unable to retrieve icons for Windows
>> Media Player UPnP content sources.
>>
>> I've followed the code through, and I come to the class:
>>
>> org.apache.felix.upnp.basedriver.importer.util.HTTPRequestForIcon
>>
>> ...which is where the trouble is.
>>
>> This class contains a method:
>>
>> public InputStream getInputStream()
>>
>> ... Which starts with the comment:
>>
>> //TODO we should speak about that
>>
>> ... Never a good sign :-) ! I'm trying to understand why the code manually
>> constructs the HTTP request and does everything at the socket level, rather
>> than simply:
>>
>> URLConnection conn = url.openConnection();
>> return conn.getInputStream();
>>
>> I've changed this in my local copy of the base driver, and tested it, and it
>> works fine. So, either this is a bit of old code that should be fixed, OR
>> there is a good reason to not use the JDK URLConnection class that somebody
>> might be aware of.
> 
> There is no real reason to do not use URLConnection, and if add a JIRA
> issue with the patch we will fix it :)
> 
>> If its the latter, please let me know, and I'll see how to fix it so that it
>> will work with Windows Media Player.
>>
>> Thanks
>>
>> Bruce
>>
> 
> Ciao,
> Stefano "Kismet" Lenzi
> 
> 


Re: HTTPRequestForIcon in UPnP base driver

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
Great!

I'm not sure why it the original code doesn't work correctly with Windows Media Player, as it seems to work fine with other sources such as Azureus or Orb.
However, the URLConnection method works with all of these.

Thanks

Bruce


On 15/01/2009 19:50, "Stefano Lenzi" <ki...@interfree.it> wrote:

Hi Bruce,

Jackson, Bruce wrote:
> Hi there
>
> Using the felix UPnP base driver, I'm unable to retrieve icons for Windows
> Media Player UPnP content sources.
>
> I've followed the code through, and I come to the class:
>
> org.apache.felix.upnp.basedriver.importer.util.HTTPRequestForIcon
>
> ...which is where the trouble is.
>
> This class contains a method:
>
> public InputStream getInputStream()
>
> ... Which starts with the comment:
>
> //TODO we should speak about that
>
> ... Never a good sign :-) ! I'm trying to understand why the code manually
> constructs the HTTP request and does everything at the socket level, rather
> than simply:
>
> URLConnection conn = url.openConnection();
> return conn.getInputStream();
>
> I've changed this in my local copy of the base driver, and tested it, and it
> works fine. So, either this is a bit of old code that should be fixed, OR
> there is a good reason to not use the JDK URLConnection class that somebody
> might be aware of.

There is no real reason to do not use URLConnection, and if add a JIRA
issue with the patch we will fix it :)

>
> If its the latter, please let me know, and I'll see how to fix it so that it
> will work with Windows Media Player.
>
> Thanks
>
> Bruce
>

Ciao,
Stefano "Kismet" Lenzi


Re: HTTPRequestForIcon in UPnP base driver

Posted by Stefano Lenzi <ki...@interfree.it>.
Hi Bruce,

Jackson, Bruce wrote:
> Hi there
> 
> Using the felix UPnP base driver, I'm unable to retrieve icons for Windows
> Media Player UPnP content sources.
> 
> I've followed the code through, and I come to the class:
> 
> org.apache.felix.upnp.basedriver.importer.util.HTTPRequestForIcon
> 
> ...which is where the trouble is.
> 
> This class contains a method:
> 
> public InputStream getInputStream()
> 
> ... Which starts with the comment:
> 
> //TODO we should speak about that
> 
> ... Never a good sign :-) ! I'm trying to understand why the code manually
> constructs the HTTP request and does everything at the socket level, rather
> than simply:
> 
> URLConnection conn = url.openConnection();
> return conn.getInputStream();
> 
> I've changed this in my local copy of the base driver, and tested it, and it
> works fine. So, either this is a bit of old code that should be fixed, OR
> there is a good reason to not use the JDK URLConnection class that somebody
> might be aware of.

There is no real reason to do not use URLConnection, and if add a JIRA 
issue with the patch we will fix it :)

> 
> If its the latter, please let me know, and I'll see how to fix it so that it
> will work with Windows Media Player.
> 
> Thanks
> 
> Bruce
> 

Ciao,
Stefano "Kismet" Lenzi