Java Reference
In-Depth Information
Host: www.apress.com
Path: /catalogsearch/result/
Query: q=juneau
Protocol: http
Authority: www.apress.com
Reference: null
How It Works
When constructing and working with URLs in an application, it is sometimes benefi-
cial to extract information pertaining to an URL. This can be easily done using the
URL built-in class methods, which can call a given URL and return strings of informa-
tion. Table 21-1 explains the accessor methods available in the URL class for obtaining
information.
Table 21-1 . Accessor Methods for Querying
URLs
Method
URL Information
Returned
Authority component
getAuthority()
File name compon-
ent
getFile()
Hostname compon-
ent
getHost()
Path component
getPath()
Protocol identifier
component
getProtocol()
Reference compon-
ent
getRef()
Query component
getQuery()
 
 
Search WWH ::




Custom Search