Level 175 Level 177
Level 176

Networking: URL Class Methods


23 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

Ignore?
Uniform Resource Locator
URL
protocol://host:port/path?query#ref
a URL can be broken down into parts
java.net.URL class
represents a URL and has complete set of methods to manipulate URL in Java.
public String getPath()
Returns the path of the URL.
public String getQuery()
Returns the query part of the URL.
public String getAuthority()
Returns the authority of the URL.
public int getPort()
Returns the port of the URL.
public int getDefaultPort()
Returns the default port for the protocol of the URL.
public String getProtocol()
Returns the protocol of the URL.
public String getHost()
Returns the host of the URL.
public String getFile()
Returns the filename of the URL.
public String getRef()
Returns the reference part of the URL.
Object getContent()
Retrieves the contents of this URL connection.
Object getContent(Class[] classes)
Retrieves the contents of this URL connection.
String getContentEncoding()
Returns the value of the content-encoding header field.
int getContentLength()
Returns the value of the content-length header field.
String getContentType()
Returns the value of the content-type header field.
int getLastModified()
Returns the value of the last-modified header field.
long getExpiration()
Returns the value of the expires header field.
long getIfModifiedSince()
Returns the value of this object's ifModifiedSince field.
public void setDoInput(boolean input)
Passes in true to denote that the connection will be used for input. the default value is true because clients typically read from a URLConnection.
public void setDoOutput(boolean output)
Passes in true to denote that the connection will be used for output. the default value is false because many types of URLs do not support being written to.
public URL getURL()
Returns the URL that this URLConnection object is connected to