Hello all,
I have a situation where I get a .ior file from a server. If URL is OK, everything works fine. If the URL is malformed I catch that exception.
Now, the problem is if the URL is not malformed, but is not the right one either, my application keep waiting & waiting to get that file which is not even existing there!!
How should I handle this??
Please please help.
Thanks,
Priya.
-
how to make sure if a resource is existing on a server?? (5 messages)
- Posted by: priya veerendra
- Posted on: February 22 2005 11:30 EST
Threaded Messages (5)
- how to make sure if a resource is existing on a server?? by Artem Yegorov on February 22 2005 11:43 EST
- how to make sure if a resource is existing on a server?? by priya veerendra on February 22 2005 12:20 EST
- switch to nio by Jason Frank on February 22 2005 05:42 EST
-
how to make sure if a resource is existing on a server?? by Artem Yegorov on February 23 2005 03:51 EST
- how to make sure if a resource is existing on a server?? by priya veerendra on February 25 2005 12:53 EST
- how to make sure if a resource is existing on a server?? by priya veerendra on February 22 2005 12:20 EST
-
how to make sure if a resource is existing on a server??[ Go to top ]
- Posted by: Artem Yegorov
- Posted on: February 22 2005 11:43 EST
- in response to priya veerendra
Can you provide a sample of the code that you are using to the above?
Sincerely,
Artem D. Yegorov
http://www.activexml.org -
how to make sure if a resource is existing on a server??[ Go to top ]
- Posted by: priya veerendra
- Posted on: February 22 2005 12:20 EST
- in response to Artem Yegorov
Thank you very much for responding..
here is snippet of my code..
...
....
String nsURL = prop.getProperty("dpa_server_nsURL1");
try {
//Load the IOR for the Root Context of the Naming Service
//Open the URL that references the file where the IOR is stored.
java.net.URL URL = new URL(nsURL);
.....
try{
InputStream is = URL.openStream ( ) ;
BufferedReader dis = new BufferedReader ( new InputStreamReader ( is ) ) ;
// Read the content of the file.
String objStr = null;
objStr = dis.readLine() ;
.....
}
....
catch(IOException i){
....
}
....
}
catch(MalformedURLException me ){
logger.fine("Invalid URL");
// do something
}
I can send you more if this is not enough to understand. I would really appreciate any input.
Thanks.
Priya -
switch to nio[ Go to top ]
- Posted by: Jason Frank
- Posted on: February 22 2005 17:42 EST
- in response to priya veerendra
use non-blocking i/o, there is lots of good idioms out there one can use to implement this kind of functionality. -
how to make sure if a resource is existing on a server??[ Go to top ]
- Posted by: Artem Yegorov
- Posted on: February 23 2005 15:51 EST
- in response to priya veerendra
I ran your example and in case of file or http protocol I am getting a FileNotFoundException, which is the proper behaviour in case the URL is well-formed but esource does not exist...
What is the exact situation when it waits?
Sincerely,
Artem D. Yegorov
http://www.activexml.org -
how to make sure if a resource is existing on a server??[ Go to top ]
- Posted by: priya veerendra
- Posted on: February 25 2005 12:53 EST
- in response to Artem Yegorov
Thanks again for responding. I really appreciate it.
Well, the situation is the testing people are testing by manipulating the url.. but it seems to be the url is within our domain..and possibly router is directing it to somewhere..
anyway, right now I've fixed this problem by writing a timeout routine.
Thanks & regards,
Priya.