web fundamentals by hzqqzh
A user input \about the interactions between the Browser and other servers.
1 浏览器通过URL(统一资源定位符,Uniform / Universal Resource Locator)访问DNS(domain name service),DNS 返回一个IP地址。 2 浏览器用IP地址建立TCP/IP链接
3 浏览器通过TCP/ip链接给服务器发送一个HTTP请求
4依据这个请求,服务器找到合适的文件,生成一个MIME(Multipurpose Internet Mail Extensions\多功能Internet 邮件扩充服务)格式的HTTP响应,并将响应传回浏览器,随后关闭链接。
5 依据HTTP响应的开头信息,浏览器显示收到的文件
注意每一个图片浏览器需要建立一个TCP连接,传送,并关闭链接。 http://162.105.203.19/wst/webtech/unit2/internet.gif
Carefully review the steps taken to install and configure an Apache on the course server. Be able to explain the slight difference between the ASCII mode and BINARY mode of FTP protocol. 安装步骤:
1 解压缩:tar -xzf文件名
2 configure: ./configure --prefix=路径 3make
4 make install
5修改端口:httpd。conf的listen XX 6//apache/bin/apacheclt start
Carefully review the steps taken to install and configure an Apache on the course server. Be able to explain the slight difference between the ASCII mode and BINARY mode of FTP protocol.
ftp是应用层协议,和具体操作系统无关,ASCII 模式和BINARY模式的区别是回车换行的处理,binary模式不对数据进行任何处理,asci模式将回车换行转换为本机的回车字符,比如Unix下是\\n,Windows下是\\r\\n,Mac下是\\r
ascii模式下会转换文件,不能说是不同系统对回车换行解释不同,而是不同的系统有不同的行结束符
(1)unix系统下行结束符是一个字节,即十六进制的0A (2)而ms的系统是两个字节,即十六进制的0D0A
所以当你用ascii方式从unix的ftp server下载文件时(不管是二进制或者文本文件),每检测到一个字节是0A,就会自动插入一个0D,所以如果你的文件是二进制文件比如可执行文件、压缩包什么的,就肯定不能用了。如果你的文件就是unix下的文本文件,你用ascii模式是正确的,要是误用了binary模式, 你在windows上看这个文件是没有换行的,里面是一个个的黑方块。
因此(1)用HTML 和文本编写的文件必须用ASCII模式上传,用BINARY模式上传会破坏文件,导致文件执行出错
(2)BINARY模式用来传送可执行文件,压缩文件,和图片文件
Explain the following queries enclosed in brackets that are inputed to Google: Google搜索常识逻辑为and
(1) cache: The query [cache:] will show the version of the web page that Google has in its cache.
(2) link: The query [link:] will list webpages that have links to the specified webpage.
(3) related: The query [related:] will list web pages that are \ web page.
(4) info: The query [info:] will present some information that Google has about that web page.
(5) define: The query [define:] will provide a definition of the words you enter after it, gathered from various online sources.
(6) stock: Google will treat the rest of the query terms as stock ticker symbols, and will link to a page showing stock information for those symbols.
(7) site: If you include [site:] in your query, Google will restrict the results to those websites in the given domain.
(8) allintitle: If you start a query with [allintitle:], Google will restrict the results to those with all of the query words in the title.
(9) intitle: If you include [intitle:] in your query, Google will restrict the results to documents containing that word in the title.
(10) allinurl: If you start a query with [allinurl:], Google will restrict the results to those with all of the query words in the url.
(11) inurl: If you include [inurl:] in your query, Google will restrict the results to documents containing that word in the url.
(12) filetype: If you include filetype:suffix in your query, Google will restrict the results to pages whose names end in suffix.
All URLs have the same general format: scheme:object-address. You should be able to understand various kinds of URL. Such as URL which executes a CGI program on remote server, URL which points to a port other than 80, URL which points to a local document and URL with a FTP protocol.
scheme告诉浏览器使用哪种通信协议,一般scheme包括http,ftp,telnet,file,mailto and news.格式为scheme//
MIME stands for Multipurpose Internet Mail Extensions. It helps browser to determine the formats of the document that the browser gets from the Web servers. Generally, a list of MIME specifications in the format of type/subtype is stored in configuration files of each Web server. Web server determines the type of a document by using the filename's extension as the key into a configuration file. The type is transfered by the Content-type field of HTTP response header.
HTTP1.1应答的几个介绍
Connection:表示是否需要持久连接。如果Servlet看到这里的值为“Keep-Alive”,或者看到请求使用的是HTTP 1.1(HTTP 1.1默认进行持久连接),它就可以利用持久连接的优点,当页面包含多个元素时(例如Applet,图片),显著地减少下载所需要的时间。 Expires 应该在什么时候认为文档已经过期,从而不再缓存它
Last-Modified 文档的最后改动时间。客户可以通过If-Modified-Since请求头提供一个日期,该请求将被视为一个条件GET,只有改动时间迟于指定时间的文档才会返回,否则返回一个304(Not Modified)状态。
Set-Cookie 设置和页面关联的Cookie。 Date 当前的GMT时间。
Content-Type 表示后面的文档属于什么MIME类型。Servlet默认为text/plain
cache-control头文件来通知客户端浏览器的缓存方案,常见的取值有private、no-cache、max-age、must-revalidate等,默认为private。
Age: 当代理服务器用自己缓存的实体去响应请求时,用该头部表明该实体从产生到现在经过多长时间了。
HTML标签(一定有
balabala
line:heading:
1-6
image: Hypertext Links: 无序列表 第一个项目 第二个项目 有序列表
第一个项目 第二个项目
表格:
定义表格里的一个单元格
html comment:
Explain what does Ajax stand for. Why we need it? Ajar: Asynchronous JavaScript+XML
目的是是基于web的应用程序在交互速度方面进而在用户体验方面更接近于客户端的桌面应用程序
传统的web交互中,客户机向服务器发送消息的方式或者是通过单击链接,或者是提交表单。然后用新文档取代整个浏览器的显示画面。对于复杂的文档,从服务器传个客户端,浏览器再显示,需要大量的时间。所以需要Ajar
Ajar主要有两点:1服务器和浏览器异步通信,浏览器不需要等待服务器的消息,可以继续做自己的事2服务器正在提供的通常只显示文档中相对较小的一部分,以节约时间
哪里使用比较好:验证和表单填写,google map的只显示一小块,鼠标悬停弹出信息,域用户的快速交互
How the URL is encoded before it is send to Web server when a form is submitted.? 浏览器通过NAME/VALUE对传递信息,同时对URL进行重新编码: +代替空格
“%HH“,十六进制的ASCII值,表示非numberic和非字母数据。 =用于分开name和value对 &用来不同的name、value对
Can tell the difference between the GET method and the POST method.
2、Get将表单中数据的按照variable=value的形式,添加到action所指向的URL后面;Post是将表单中的数据放在form的数据体中,按照变量和值相对应的方式,传递到action所指向URL,之后script从stdin中得到消息。
3、Get是不安全的,因为在传输过程,数据被放在请求的URL中,而如今现有的很多服务器、代理服务器或者用户代理都会将请求URL记录到日志文件中,然后放在某个地方,这样就可能会有一些隐私的信息被第三方看到。另外,用户也可以在浏览器上直接看到提交的数据,一些系统内部消息将会一同显示在用户面前。Post的所有操作对用户来说都是不可见的。
4、Get传输的数据量小,这主要是因为受URL长度限制;而Post可以传输大量的数据,所以在上传文件只能使用Post 5、Get限制Form表单的数据集的值必须为ASCII字符;而Post支持整个ISO10646字符集。默认是用ISO-8859-1编码 6、Get是Form的默认方法。
Understand the slight difference between the executing mechanism of a CGI program and that of a PHP program. Why CGI programs are of higher cost comparing to PHP programs?
对于CGI,服务器需要创建更多的地址空间同时需要fork进程,PHP的执行已经嵌入到服务器中
what is java?
Java,是由Sun公司于1995年5月推出的Java程序设计语言和Java平台的总称。 特点:简单,面向对象,分布式,健壮,解释型,多线程,动态 public class Hello {
public static void main(String args []) { System.out.println(\ } }
applet和servlet 最简单版本 applet是客户端的程序,它们可以直接嵌入到网页或者其他特定的容器中,并能够产生特殊的效果。
servlet是服务端器的程序,用于实现服务器功能的扩充,响应客户端请求 相似之处:
* 它们不是独立的应用程序,没有main()方法。
* 它们不是由用户或程序员调用,而是由另外一个应用程序(容器)调用。 * 它们都有一个生存周期,包含init()和destroy()方法。 不同之处:
* Applet具有很好的图形界面(AWT),与浏览器一起,在客户端运行。 * Servlet 则没有图形界面,运行在服务器端。
含有Applet的网页的HTML文件代码中部带有和这样一对标记,当支持Java的网络浏览器遇到这对标记时,就将下载相应的小应用程序代码并在本地计算机上执行该Applet。 Java Applet 是用Java 语言编写的一些小应用程序,这些程序是直接嵌入到页面中,由支持Java的浏览器(IE 或Nescape)解释执行能够产生特殊效果的程序。由于Applet是在用户的计算机上执行的,所以它的执行速度不受网络带宽或者Modem存取速度的限制。 样例 importjava.applet.Applet; importjava.awt.Graphics; public class HelloWorld extends Applet { public void paint(Graphics g) { g.drawString(\ } }
下一篇:2010材料导论习题课