Java Reference
In-Depth Information
identifieslines 5 through 10 ofatextdocumentnamed document.txt onmyweb-
site. (This example is only illustrative; the resource doesn't actually exist.)
URIs can be categorized as absolute or relative. An absolute URI begins with a
scheme followed by a colon character. The earlier http://tutortutor.ca URI
is an example of an absolute URI. Other examples include
mailto:jeff@tutortutor.ca and news:comp.lang.java.help . Con-
sideranabsoluteURIasreferringtoaresourceinamannerindependentofthecontext
in which that identifier appears. To use a filesystem analogy, an absolute URI is equi-
valent to a pathname to a file that starts from the root directory.
A relative URI doesn'tbeginwithascheme(followedbyacoloncharacter).Anex-
ampleis tutorials/tutorials.html .ConsiderarelativeURIasreferringtoa
resource in a manner dependent on the context in which that identifier appears. Using
thefilesystemanalogy,therelativeURIislikeapathnametoafilethatstartsfromthe
current directory.
URIs also can be categorized as opaque or hierarchical. An opaque URI is an
absolute URI whose scheme-specific-part doesn't begin with a forward slash (/) char-
acter. Examples include http://tutortutor.ca and
mailto:jeff@tutortutor.ca . Opaque URIs aren't parsed (beyond identifying
their schemes) because scheme-specific-parts don't need to be validated.
A hierarchical URI iseitheranabsoluteURIwhosescheme-specific-partbeginswith
a forward slash character, or is a relative URI.
UnlikeanopaqueURI,ahierarchicalURI'sscheme-specific-partmustbeparsedinto
the various components identified by the following syntax:
[// authority ] [ path ] [? query ] [# fragment ]
authority identifiesthenamingauthorityfortheURI'snamespace.Whenpresent,
this component begins with a pair of forward slash characters, is either server-based
or registry-based, and terminates with the next forward slash character, question mark
character,ornomorecharacters—theendoftheURI.Registry-basedauthoritycompon-
entshavescheme-specificsyntaxes(andaren'tdiscussedbecausethey'renotcommonly
used),whereasserver-basedauthoritycomponentscommonlyadoptthefollowingsyn-
tax:
[ userinfo @] host [: port ]
Thissyntaxspecifiesthataserver-basedauthoritycomponentoptionallybeginswith
user information (e.g., a username) and an “at” (@) character, then continues with the
host's name, and optionally concludes with a colon character and a port. For example,
Search WWH ::




Custom Search