Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Proxy Server and Input Stream  RSS feed

 
Shashi Eye
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a stand-alone application in place.My requirement is that I want to get the proxy server settings on the host machine where my application will be running.Also,I am having the following line in my code:
InputStream is = url.openStream();
I want to check whether the url is valid or not.In order to do so,can I check for the existence of the InputStream object or in other words can I check whether InputStream is null or not.
Please respond with your valuable suggestions.Thanks in advance.
 
Joe Ess
Bartender
Posts: 9425
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch.
I'm not aware of any way to directly obtain proxy information. Since it is usually configured in a particular application (for example, IE), one would need to delve into that application's configuration (in IE's case, the Windows registry) to get it.
As for checking if the resource pointed to a URL exists, the only way to do that is to try to access it and catch the exception (likely java.io.FileNotFoundException).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!