This discussion is archived
3 Replies Latest reply: Jan 27, 2007 3:35 PM by 807596 RSS

java.net.URL, making special protocols valid

807596 Newbie
Currently Being Moderated
Hi,
Is there any place which officially lists valid protocols when we create a java.net.URL?
I have a url like "mms.://myserver.com/image.asf". I am unable to create a URL. It throws a MalformedURLException saying that "mms" is an unknown protocol.
Is there any way I can make the java.net.URL accept this protocol?
Waiting for the response.

Thanks

Pramodh.
  • 1. Re: java.net.URL, making special protocols valid
    796365 Newbie
    Currently Being Moderated
    Take a loo at this article regarding custom protocol handlers: http://java.sun.com/developer/onlineTraining/protocolhandlers/
  • 2. Re: java.net.URL, making special protocols valid
    807596 Newbie
    Currently Being Moderated
    Hi,
    Thank you for the response. I am sure it will be useful for my problem. I was wondering if you encountered this and had to do the same thing to make you application support a specific protocol. If you did so, can you provide me with a sample implementation of custom protocol handling of any protocol? It would be great if you can do that.

    And If I want my application to support multiple custom protocols, do I have to create multiple custom protocol handlers, one for each custom protocol. To do so, I have to subclass URL, URLConnection for each custom protocol. And thus the code becomes massive and clumsy. Is there a way to implement this custom protocol handlers in any other way to support multiple custom protocl handling.

    Thanks,

    Pramodh.
  • 3. Re: java.net.URL, making special protocols valid
    807596 Newbie
    Currently Being Moderated
    Hi!

    I know this is a very old topic, but dit you ever manage to get it to work? Im currently trying to make Java.net.url to talk with the mms protocol, but it is not working so far...