• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Contacting a site fro URL Connection...

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can I contact a sight using URL Connection?
I know that I can give a url path with IP and port and invoke particular servlet.
Instaed if I give the domain name I am getting the following error.

Exception java.net.MalformedURLException: no protocol: www.verisign.com

Is it right to use as shown?
[B]
URL url = new URL("www.verisign.com");
URLConnection urlCon = url.openConnection();
[B]
Do suggest me how to do it.
Thanks,
Vasu
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure you can. However you have to sepcify the protocol also when you construct the URL.
For eg.,
URL url = new URL("http://www.verisign.com");
 
vasu devan
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Junaid Bhatra,
Thanks you very much, it worked.
Vasu.
 
reply
    Bookmark Topic Watch Topic
  • New Topic