extend java.net.URL?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

extend java.net.URL?

John X
Hi, All,

I need to extend java.net.URL, in order to handle newer/more schemes.
The problem is that java.net.URL is final, not meant to be subclassed.
Since URL is extensively used in nutch, I am also reluctant to replace
every one with my own MyURL. It seems I will have to hack java.net.URL source
directly. This is not portable though. I am wondering if there are
better alternatives, or some tricks can be applied.

Thanks,

John
Reply | Threaded
Open this post in threaded view
|

RE: extend java.net.URL?

Nick Lothian
>
> Hi, All,
>
> I need to extend java.net.URL, in order to handle newer/more schemes.
> The problem is that java.net.URL is final, not meant to be subclassed.
> Since URL is extensively used in nutch, I am also reluctant
> to replace every one with my own MyURL. It seems I will have
> to hack java.net.URL source directly. This is not portable
> though. I am wondering if there are better alternatives, or
> some tricks can be applied.
>
> Thanks,
>
> John
>

Do pluggable protocol handlers do what you want? (eg:
http://java.sun.com/developer/onlineTraining/protocolhandlers/)

Nick
Reply | Threaded
Open this post in threaded view
|

Re: extend java.net.URL?

John X
On Thu, Aug 11, 2005 at 03:47:37PM +0930, Nick Lothian wrote:

> >
> > Hi, All,
> >
> > I need to extend java.net.URL, in order to handle newer/more schemes.
> > The problem is that java.net.URL is final, not meant to be subclassed.
> > Since URL is extensively used in nutch, I am also reluctant
> > to replace every one with my own MyURL. It seems I will have
> > to hack java.net.URL source directly. This is not portable
> > though. I am wondering if there are better alternatives, or
> > some tricks can be applied.
> >
> > Thanks,
> >
> > John
> >
>
> Do pluggable protocol handlers do what you want? (eg:
> http://java.sun.com/developer/onlineTraining/protocolhandlers/)

Hi, Nick,

How could I have missed that! That's the one. Thanks a lot.

John

>
> Nick
>
__________________________________________
http://www.neasys.com - A Good Place to Be
Come to visit us today!
Reply | Threaded
Open this post in threaded view
|

Re: extend java.net.URL?

Dawid Weiss

Pluggable protocols work quite nice. I remember I created a pluggable
protocol for opening application resources once; worked like a charm.

D.

John X wrote:

> On Thu, Aug 11, 2005 at 03:47:37PM +0930, Nick Lothian wrote:
>
>>>Hi, All,
>>>
>>>I need to extend java.net.URL, in order to handle newer/more schemes.
>>>The problem is that java.net.URL is final, not meant to be subclassed.
>>>Since URL is extensively used in nutch, I am also reluctant
>>>to replace every one with my own MyURL. It seems I will have
>>>to hack java.net.URL source directly. This is not portable
>>>though. I am wondering if there are better alternatives, or
>>>some tricks can be applied.
>>>
>>>Thanks,
>>>
>>>John
>>>
>>
>>Do pluggable protocol handlers do what you want? (eg:
>>http://java.sun.com/developer/onlineTraining/protocolhandlers/)
>
>
> Hi, Nick,
>
> How could I have missed that! That's the one. Thanks a lot.
>
> John
>
>
>>Nick
>>
>
> __________________________________________
> http://www.neasys.com - A Good Place to Be
> Come to visit us today!