Jar: protocol question

R

Roedy Green

The ideal would be to come up
with a standardized way of saying "the file is in some jar of the classpath
but we don't need it's name" that the whole industry would understand and
accept.

You specifically want to exclude things on the classpath NOT in jars
though?

You could do that with a wrapper around the getResource method that
looked at the offered URL and rejected ones without a ! somewhere in
them.

You would invent a custom protocol mainly if you wanted to smuggle
this into other people's code that only understood URLs.

You could use a self explanatory protocol name

in-jar-on-classpath:xxx.txt
 
T

Thomas Fritsch

Roedy Green said:
You then name your new URLStreamHandler class com.mydomain.protocol.
xxxx.Handler where xxxx is the name of your new protocol.
You could also name your new URLStreamHandler class
"sun.net.www.protocol.xxxx.Handler" .
Then there would be no need to fiddle with the "java.protocol.handler.pkgs"
system property.
(But of course this is dirty cheating, and as such is to be frowned upon.
;-) )
 
R

Roedy Green

You could also name your new URLStreamHandler class
"sun.net.www.protocol.xxxx.Handler" .
Then there would be no need to fiddle with the "java.protocol.handler.pkgs"
system property.
(But of course this is dirty cheating, and as such is to be frowned upon.
;-) )

That would be like teaching forgery as way to solve your financial
ills. I suspect if you distributed such code, and Sun found out about
it, they could sue you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top