Clever users can even invent new types on the fly and register them in the java.protocol.handler.pkgs system property. You can specify IPv4 (Internet Protocol Version 4) but not IPv6 numeric IP (Internet Protocol) addresses in URI s.
URI .resolve( String ); lets you construct a new URI using the original as a context to modify. The new URL (String ) constructor lets do the same thing.
Allowable Characters | URL vs URI |
Formats | getResource |
Relative vs Absolute | Learning More |
Component Parts | Links |
URLs never automatically armour their parameters, where URIs sometimes do.
Types of URI | |
---|---|
Example | Notes |
AIM (America Online Instant Messenger) : | America online Instant Messenger, an instant mail service. |
dbaw://Gloria:8889 | Symantec dbAnywhere. Gloria is the name of a local computer on the net with an IP in your HOSTS file. 8889 is the port. |
dns://mynameserver.com/mindprod.com | JNDI specification of a site for which you want DNS (Domain Name Service) information. You feed these strange double-barrelled URLs to javax.naming.directory.Attributes.DirContext.getAttributes(). See JNDI for more details. |
file://localhost/C|/mydir/myfile.txt | Old style local file URL. Most browsers today use the C: rather than C| style. To get at a local file you must encode the name in a strange way. That example started out life as C:\mydir\myfile.txt. Use your browser to load a file and it will tell you the URL-encoded name on the top line. JNLP (Java Network Launching Protocol) does not like this form. |
file://localhost/C:/mydir/myfile.txt | This is a variant of the local file scheme above, popular in more recent browsers. This is the form JNLP likes. |
file://localhost/C:/other/mydir/myfile.txt | Count’em three slashes after the file: Used to get at a file on local hard disk C:\other\mydir\myfile.txt It is like the localhost form, with the host field left blank. |
file://other/mydir/myfile.txt | Count’em four slashes after the file: Used to get at a file on remote LAN (Local Area Network) drive \\other\mydir\myfile.txt It is like the localhost form, with the host field and the drive field left blank. |
file://localhost/C|/mydir/myfile.txt | This is the long form for accessing a local file. It could also be used to access a file on a computer attached via a LAN, by substituting localhost with the host name. |
ftp://roedy:sesame@www.hans.org/downloads/getit.zip | for FTP (File Transfer Protocol) downloads. roedy is
the userid and sesame is the password. For
anonymous FTP, you can leave out the userid and password:
ftp://www.hans.org/downloads/getit.zip
FTP for Java client support |
gopher://gopher.someplace.edu | Gopher protocol is an endangered species largely replaced by HTTP (Hypertext Transfer Protocol). |
http://www.hans.org/index.html#FLUORIDE | HTTP. It gives the site name and the document name within that site and the spot within that document. Unfortunately, showDocument in older versions of Opera cannot handle a #FLOURIDE extension. |
http://roedy:sesame@www.hans.org/membersonly/goodies.html | HTTP. It gives userid, password, the site name, the document name within that site. |
http:// 65.110.21.43 :80/index.html | HTTP, using an IP and port address 80. It gives the site name and the document name within that site. |
myfile.txt | Relative URI. Usually this would get you a file on the mother website from which the current page was loaded, relative to the web page being viewed. You can’t use relative URIs directly. You must convert them to absolute URIs using the URI context constructor. An absolute URI must have a complete http: domain, filename and optional #REF. getDocumentBase and getCodeBase are useful in converting relative to absolute URI I know of no tools to go the other way to find the shortest relative URI to express a given absolute URI in a given context. Browsers must convert relative URL links to absolute ones before sending the request to the server. |
https://www.hans.org/index.html | Secure HTTP for SSL (Secure Sockets Layer)
only work inside Netscape.
SSL: to learn how to add support in browsers that don’t directly support https |
icq: | ICQ (Internet Chat Query) instant messaging service. Also allows file transfer. |
jar:file://localhost/C|/bar/baz.jar!/com/foo/Quux.class | Local jar file. In JDK1.2+ there are jar URIs for getting at the contents of the individual member of a local jar. |
jar:http://www.foo.com/bar/baz.jar!/com/foo/Quux.class | Jar on server. In JDK1.2+ there are jar URIs for getting at the contents of the individual member of a remote jar. |
jdbc:BorlandBroker://193.174.106.43:1600/sample,user,password | Typical JDBC (Java Data Base Connectivity) connection. |
mailto:someone@somedomain.com | |
n2p: | Net To Phone. A scheme where you use the Internet to telephone people without Internet connections. |
nap: | Napster MP3 file-sharing protocol. Allows peer-to-peer file transfers with a minimum of setup fuss. |
news://comp.lang.java.programmer | Newsgroup. Needs a newsreader. |
pnm: | Real Audio streaming format |
rlogin: | remote login. |
rmi://server:1099 | rmi access the server. |
rmi:Strawberry | rmi access an LDAP (Lightweight Directory Access Protocol) object. |
rtsp: | RTSP (Real Time Streaming Protocol) |
telnet://melvyl.ucop.edu/ | telnet |
urn:isbn:096139210x | ISBN (International Standard Book Number) book number |
However, I have not found any built-in way to convert an absolute URI to the most compact relative representation given a context. You would use this to correct HTML (Hypertext Markup Language) references to their most compact canonical form.
In W95, W98, Me, NT, W2K, XP, W2003, Vista, W2008, W7-32, W7-64, W8-32, W8-64, W2012, W10-32 and W10-64, *.url files let you create short cuts (bookmarks) to web files on the Internet or your local disk. They are just little text files stored on your disk. If you peek inside one, they look something like this:
This page is posted |
http://mindprod.com/jgloss/uri.html | |
Optional Replicator mirror
|
J:\mindprod\jgloss\uri.html | |
Please read the feedback from other visitors,
or send your own feedback about the site. Contact Roedy. Please feel free to link to this page without explicit permission. | ||
Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[3.144.255.158] |
| |
Feedback |
You are visitor number | |