URL : Java Glossary

go to home page U words local find full screen, hide local find menu Google search web for more information on this topic jump to foot of page translate this page with Babelfish punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all) ©1996-2009 2007-12-16 Roedy Green, Canadian Mind Products
URL
Uniform Resource Locator. The old name for URI. RFC 4248 describes URL formats. RFC 3986 describes URI formats. java.net.URL has been replaced by java.net.URI. Strictly speaking, every URL is a URI, but not every URI is a URL. URI’s are an extension and refinement of the URL. Yet, as classes, neither is a subclass of the other and they have no common base other than Object. java.net. URI is Java’s second attempt at doin a URL class an they started from scratch.

URLs never automatically armour their parameters, where URIs sometimes do.

If a bug report I got is correct, under some conditions JDK 1.6 URL.openConnection returns null without throwing an IOException.

The term URL can also be an as a verb, as in “Please URL me that picture of the Windows Firewall, meaning “Please email me the URL of that photograph”, in other words email the text: http://mindprod.com/image/jgloss/msfirewall.jpg.

Non-ASCII URLs

What if you wanted to embed the following URL in your HTML?
<a href="http://en.wikipedia.org/wiki/Façade_pattern">
What do you do about that pesky non-ASCII ç character? HTML 4.01 says URLs should only contain ASCII chars, but if non-ASCII chars appear they should be treated as UTF-8. In theory you should be able to encode it with &ccedil;, &#231; or &#xe7;, but in practice, you can’t count on this working. You must use the URL-Encoded %hh escaping mechanism of the equivalent UTF-8 chars like this:
<a href="http://en.wikipedia.org/wiki/Fa%E7ade_pattern">
+ is converted to %2B and space is converted to +.

URLs always use UTF-8 encoding, no matter what the encoding of the enclosing document.

Learning More

Sun’s Javadoc on URL class : available:
Sun’s Javadoc on URI class : available:

CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/url.html J:\mindprod\jgloss\url.html
CMP logofeedback Please email your feedback for publication, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.191.105]
You are visitor number 17,299.