URL

  • Thread starter Thread starter anonym
  • Start date Start date
A

anonym

I am trying to get the URL from the user and then set it
for a webservice. This fails when the URL is not of the
right format and gives me URIFormatException. My question
is : Is there anything I could use in my form so that I
check for teh right format for URL even before calling the
webserver method?

Thanks in advance
 
You can try to instantiate a Uri object with the URL and catch any
exceptions that it may throw. If the object can be created, it is a valid
URL.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top