Elements of an HTTP URL
scheme://host[:port]/path/…/[;url-params][?query-string][#anchor] |
· Scheme
o Specifies the underlying protocol
o E.g. http, ftp, mailto, …
· Host
o Identifies the computer on the internet
o Either the name or the IP address
· Port
o Optional
o Identifies the port at which the web server is listening
o It follows a colon (:)
o Web server default is 80 but may be changed when configuring the server
§ Must be specified if an alternative port number is used
· Path
o Identifies how to locate the resource on the computer
o May refer to an actual file on the computer
§ E.g. http://www.cs.etsu.edu/sites/default/files/files/2012-2013.pdf
o Includes the first forward slash
· Url-Params
o Optional
o Once rarely used but now being used more frequently for session identifiers in Java Servlet APIs
o It follows a semi-colon (;)
· Query-String
o Optional
o Contains dynamic parameters associated with the resource request
o It follows a question sign (?)
o Name value pairs are separated with the equal sign (=)
o Parameters are delimited by the ampersand sign (&)
· Anchor
o Optional
o Reference to a positional marker within the requested resource
o It follows a hash (or pound) sign (#)
http://www.somesite.com:8080/somepath/path;id=1234?name=demo&type=url#marked |
|
Scheme: |
http |
Host: |
www.somesite.com |
Port: |
8080 |
Path: |
/somepath/path |
URL Params: |
id=1234 |
Query String: |
name=demo&type=url |
Anchor: |
marked |