Skip to main content

[JDIC] JDIC Desktop#browser vs. Java 6 Desktop#browse

2 replies [Last post]
Anonymous

Hi all,

I'm trying to use Desktop#browse to trigger the VoIP client on my
system. Hence, I pass a URL in the form of : to
the browse method. is the name of the handler for which the
VoIP client is registered. Sidenote: for Skype the protocol would either
be "skype" or "callto".

While Java 6 Desktop#browse expects an URI as an argument and nicely
invokes my VoIP app, JDIC Desktop#browse has more problems with that
because its argument is a URL.
Constructing a URL in the form of callto: throws a
MalFormedUrlException because "callto" is an unknow protocol - at least
to the Java runtime.

Are there any chances I could make this work with JDIC, too?

Regards,
Marcel

--
Marcel Stör, http://www.frightanic.com
Blog: http://frightanic.wordpress.com
Skype: marcelstoer

---------------------------------------------------------------------
To unsubscribe, e-mail: jdic-unsubscribe@jdic.dev.java.net
For additional commands, e-mail: jdic-help@jdic.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Marcel Stör

Marcel Stör wrote:
> Hi all,
>
> I'm trying to use Desktop#browse to trigger the VoIP client on my
> system. Hence, I pass a URL in the form of
:
to
> the browse method.
is the name of the handler for which the
> VoIP client is registered. Sidenote: for Skype the protocol would either
> be "skype" or "callto".
>
> While Java 6 Desktop#browse expects an URI as an argument and nicely
> invokes my VoIP app, JDIC Desktop#browse has more problems with that
> because its argument is a URL.
> Constructing a URL in the form of callto:
throws a
> MalFormedUrlException because "callto" is an unknow protocol - at least
> to the Java runtime.
>
> Are there any chances I could make this work with JDIC, too?

I hate answering my own questions, but if no one else does....

Turns out it's rather easy and straightforward.

Since I don't really intend to open the respective URL I can provide my
own URLStreamHandler with a null implementation:

final URLStreamHandler handler = new URLStreamHandler(){
protected URLConnection openConnection(URL u) throws IOException {
return null;
}};

Then create a URL with that handler and feed it to JDIC Desktop#browse():

org.jdesktop.jdic.desktop.Desktop.browse(new URL(null,
"callto:
", handler));

-Marcel

--
Marcel Stör, http://www.frightanic.com
Blog: http://frightanic.wordpress.com
Skype: marcelstoer

---------------------------------------------------------------------
To unsubscribe, e-mail: jdic-unsubscribe@jdic.dev.java.net
For additional commands, e-mail: jdic-help@jdic.dev.java.net

Marcel Stör

Marcel Stör wrote:
> Hi all,
>
> I'm trying to use Desktop#browse to trigger the VoIP client on my
> system. Hence, I pass a URL in the form of
:
to
> the browse method.
is the name of the handler for which the
> VoIP client is registered. Sidenote: for Skype the protocol would either
> be "skype" or "callto".
>
> While Java 6 Desktop#browse expects an URI as an argument and nicely
> invokes my VoIP app, JDIC Desktop#browse has more problems with that
> because its argument is a URL.
> Constructing a URL in the form of callto:
throws a
> MalFormedUrlException because "callto" is an unknow protocol - at least
> to the Java runtime.
>
> Are there any chances I could make this work with JDIC, too?

Would be nice to get some information from a JDIC developer on this issue. In case this is indeed not supported by JDIC is there another way I can a protocol handler from Java?

Thanks,
Marcel

--
Marcel Stör, http://www.frightanic.com
Blog: http://frightanic.wordpress.com
Skype: marcelstoer

---------------------------------------------------------------------
To unsubscribe, e-mail: jdic-unsubscribe@jdic.dev.java.net
For additional commands, e-mail: jdic-help@jdic.dev.java.net