• Post Reply Bookmark Topic Watch Topic
  • New Topic

How I can test URL connectivity  RSS feed

 
Chilkosae Cozea
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What is the best approach to verify connectivity to any HTTP URL in java?

Is there any lightweight call that could be made to verify that the server is working?

Thanks
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Opening a socket is the lightest thing I can think of.
If you want to make sure that you are connecting to an HTTP server, you'll either have to use a socket and manage the protocol yourself or read the result from an HttpUrlConnection.
 
him jain
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can write a servlet to respond to your http request.
You need to run your client on one side, and servlet on the other end to respond.
(if you want to go for http instead of socket)
 
Rob Spoor
Sheriff
Posts: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chilkosae Cozea wants to test if any random server is listening for HTTP request. Why would you then want to set up a server container yourself?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!