• Post Reply Bookmark Topic Watch Topic
  • New Topic

needed help on URL

 
sannuth kashikar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac)

Sets an application's URLStreamHandlerFactory. This method can be called at most once in a given Java Virtual Machine.

Does this mean that,this method cannot be used with same JVM for different applications.Please explain about this method,i am not able to understand usage to this method.
thanks in avance.
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please do not post the same question more than once. It causes confusion and duplication of effort as the community tries to help everyone.
CarefullyChooseOneForum
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, yes and no. This method sets a static variable in the URL class, but only if the variable is null. If the variable is not null, the method throws an exception. In general, this means that the method can really be called just once in a given JVM.

But, if an application pulled some interesting class loader tricks, such that the java.net classes could be loaded by multiple class loaders, then there would be multiple copies of that static variable, and the method could be called once on each copy. But absent that sort of ugly hack, yes, just once.
[ September 26, 2008: Message edited by: Ernest Friedman-Hill ]
 
sannuth kashikar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How important is this method to be used in an application.Is this method used for security purpose or to verify information exchange between to machines.
It would be helpfull if explained with a small example.
Thanks
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How important is it? Not important at all. I've never used it. I imagine if you were writing a web browser from scratch in Java, you might want to use it, but even then, probably not.
 
sannuth kashikar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!