473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

testing URLs

40
Hi all,

I'm trying to make a simple browser that will try to display web pages
and will also check for user's mistakes such as omission of "http://" or
"www". What I'm having difficulty with, is how to test if a page
is downloaded (that is if the URL is correct) after "setPage" method is called.

Would this be a proper way to do it?
Expand|Select|Wrap|Line Numbers
  1. if(editorPane.getPage().toString().equals(""))
  2. //then the URL is not working

Thanks a lot
stack
Nov 7 '07 #1
4 1284
r035198x
13,262 8TB
Hi all,

I'm trying to make a simple browser that will try to display web pages
and will also check for user's mistakes such as omission of "http://" or
"www". What I'm having difficulty with, is how to test if a page
is downloaded (that is if the URL is correct) after "setPage" method is called.

Would this be a proper way to do it?
Expand|Select|Wrap|Line Numbers
  1. if(editorPane.getPage().toString().equals(""))
  2. //then the URL is not working

Thanks a lot
stack
Form your code a URL is not valid only if it is the empty string.
Is that how you want your URL checker to behave?

Have a look at the specs for the URL class itself.
Nov 7 '07 #2
stack
40
Form your code a URL is not valid only if it is the empty string.
Is that how you want your URL checker to behave?

Have a look at the specs for the URL class itself.
Thank you for your reply.
I want my URL checker to tell me if the URL attempted is valid or not. I read the URL class you suggested but I can't find any method suitable for that.
Any more hints?

Thanks again
Nov 7 '07 #3
r035198x
13,262 8TB
Thank you for your reply.
I want my URL checker to tell me if the URL attempted is valid or not. I read the URL class you suggested but I can't find any method suitable for that.
Any more hints?

Thanks again
Don't just read it to get a ready made method to solve the problem.
For example when you read the specs for that class, when does it say a MalformedURLException is thrown?
Nov 7 '07 #4
stack
40
Don't just read it to get a ready made method to solve the problem.
For example when you read the specs for that class, when does it say a MalformedURLException is thrown?

Ok, got it.

Thanks a lot
Nov 7 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: phpkid | last post by:
Howdy I've been given conflicting answers about search engines picking up urls like: http://mysite.com/index.php?var1=1&var2=2&var3=3 Do search engines pick up these urls? I've been considering...
1
by: Graham Mattingley | last post by:
Hi, I have been running a site where people add there sites, so it is like a database of URLS. Is there any way of testing if the URL is still active.. I think if the Domain list dont exist,...
0
by: gg.2.starfire | last post by:
WebCheck (http://www.raycosoft.com/rayco/products/webcheck) is a program for testing and analyzing static or dynamic web pages. WebCheck fetches web pages, applies detailed tests to each web page...
26
by: Howard Brazee | last post by:
I would like to click on a URL of a html document that will open several URLs at once for me. Does someone have an example of a html document that will do this?
1
by: DM | last post by:
I'm working on a site with more than 1700 HTML files. We'll be moving files around on this site a lot because we're reorganizing it. I'm thinking of writing a script that will convert all URLs in...
2
by: Durai | last post by:
Hello All, How to test the "Multiuser testing" in PostgreSQL?. I used the apache bench "ab" tool for this one. The following command execute the "test.php" 50 times concurrently. $ ab -c 1...
10
by: jflash | last post by:
Hello all, I feel dumb having to ask this question in the first place, but I just can not figure it out. I am wanting to set my site up using dynamic urls (I'm assuming that's what they're...
9
by: Salve =?iso-8859-1?Q?H=E5kedal?= | last post by:
What is the best regular expression for finding urls in plain text files? (By urls I mean http://www.something.com, but also www.something.com, or salve@somewhere.com) Salve
3
by: WebCM | last post by:
How to apply nice URL-s into CMS? 1. Should we use nice urls for every page? 2. Do we need to put a FULL path into <a href="">? 3. What is faster and better? a) 10 rules in .htaccess...
4
by: David | last post by:
Hi list. Do test-driven development or behaviour-driven development advocate how to do higher-level testing than unit testing? types of testing: unit integration system
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.