URL notes

URL

Hypertext

  1. text with links to other text
    1. click on links takes you to somewhere else
  2. web adapted the idea, links specification
    1. URL(uniform resources locators)----provide names for web content

Parts of URL

  1. scheme (http:) identifies protocol used to fetch content
  2. host name(//host.company.com): name of a machine to connect to
  3. server’s port number(80): allows mutiple servers to run on the same machine
  4. hierachical portion(/a/b/c.html): used by server to find content
  5. query parameters(?user=Alice&year=2008): provides additional parameters
  6. fragement(#p2): have browser scroll page to fragmet (html: p2 is anchor tag)
    1. used on the browser only; not send to the server

URL Schemes(eg:http)

  • http: the most common scheme; use HTTP protocol
  • https: similar to http; except that it uses SSL encyption
  • file: read a file from a local disk
  • websocket: create a TCP connection
  • mailto: open an email program composing a message
  • there are many other schemes (~350)
    • example: mongodb: points to a MongoDB database

URL: hierarchical portion(a/b/c.html)

  • passed to the web server for interpretation. early web servers:
    • path name for a static HTML file
    • path name of a program that will generate the HTML content(eg: foo.php)
  • web server programmed with routing information
    • map hierachical positon to funcion to be performed and possibly the function’s parameters.
  • applicaiton programming interface(API) design, example:
    • /user / create
    • / user / list
    • /user / 0x23490
    • /user / 0x23433
    • /user / delete /0x23433

Query Parameters(eg: ?user=Alice&year=2008)

  • traditionally has been to provide parameters to operation
    • such as: http://www.company.com/showOrder.php?order=4621407
  • for morden apps has implications of when the browser switches pages

Links

  • browser maintains a notion of current location(i.e. URL)
  • links: content in a page which when clicked on, causes the browser to go to a URL
  • links are implemented with the tag:
    • such as
      <a href="http://www.company.com/news/2009.html">2009 News</a>

Different types of links

  1. Full URL:
    • such as <a href="http://www.company.com/news/2009.html">2009 News</a>
  2. Absolute URL:
    • such as <a href="/stock/quote.html">
    • same as http://www.xyz.com/stock/quote.html
  3. Relative URL ( intra-site-links ):
    • such as <a href="2008/March.html">
    • same as http://www.xyz.com/news/2008/March.html
  4. Define an anchor point(a position tha can be referenced with #notion):
    • such as <a name="sec3">
  5. Go to a different place in the same page:
    -such as <a href="#sec3">

Uses of URLs

  • loading a page: type URL into your browser
  • loading a image: <img src="..." />
  • loading a stylesheet: <link rel = "stylesheet" type = "text/css" href = "...">
  • embedded a page: <iframe src= "http://www.google.com">

URL Encoding

  • what if you want to include a punctuation character in a query value?
    • such as http://www.stats.com/companyInfo?name=C&H Sugar
  • any character in a URL other than A-Z, a-z, 0-9, or any of -__~. must be represented as %xx, where xx is the hexadecimal value of the character
    • such as http://www.stats.com/companyInfo?name=C%26H%20Sugar
  • escaping is a commonly used technique and also a source of errors

Miscellaneous Topics

  • computer scientists take on hypertext:
    • need to have referential integrity
  • the web (done by physicists):
    • Error 404
  • URI(uniform resources identifier) vs. URL(uniform resources locator)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值