JavaWeb study notes --day08

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/xz58000/article/details/100515763

Software system architecture

	*常见软件系统体系结构B/S、C/S
		**cs结构即客户端/服务器,软件更新需要同时更新客户端与服务器端,安全性较好
		**bs结构即浏览器/服务器,只需要编写服务器端程序,安全性较差
	*WEB资源
		**html:静态资源
		**JSP/Servlet:动态资源
		**客户端请求的页面如果是静态网页,那么服务器会直接把静态网页的内容响应给客户端。如果是动态网页,服务器需要先把动态网页转换成静态网页,然后再把转换后的静态网页响应给客户端。
	*访问WEB资源:协议名://域名:端口/路径
	浏览器默认端口80,tomcat8080,

Tomcat

	*Tomcat概述
		Tomcat7支持Servlet3.0,而Tomcat只支持Servlet2.5
	*Tomcat安装
			启动之前必须配置环境变量
			JAVA_HOME:必须配置
			CATALANA_HOME:如果是安装版,还需要配置这个变量,指定Tomcat安装路径
	*Tomcat目录结构
			引用:https://blog.csdn.net/zd454909951/article/details/78665657
	*配置端口号
		打开%CATALANA_HOME%\conf\server.xml文件

Here Insert Picture Description

Web Applications

	*创建静态网站
			在webapps下创建一个项目目录;项目下创建html文件
			启动tomcat;打开浏览器访问localhost:8080/hello/index.html
	*创建动态网站
			在webapps目录下创建一个项目目录
			在项目目录下创建如下内容:
				WEB-INF目录(里面可以有lib文件夹,classes文件夹),其下创建web.xml文件(WEB-INF不能被浏览器访问)
				创建静态或动态页面

Configure external applications

	*把应用放到Tomcat之外,也就是外部应用。
		*方法一
			打开server.xml文件,找到<Host>元素,在其中添加<Context>元素,代码如下
			<Host name="localhost" appBase="webapps"
						unpackWARs="true" autoDeploy="true">
						<Context path="itcast_hello" docBase="C:/hello"/>
			</Host>
			path指定当前应用名称,dacBase指定应用的物理位置
			浏览器访问路径:http://localhost:8080/itcast_hello/index.html
		方法2
			conf/catalana/localhost:在该目录下创建 itcast_hello.xml文件,在该文件中编写<Contest>元素,代码如下:
			<Context docBase="C:/hello0"/>
			文件名指定当前应用的名称
			docBase指定应用的物理位置
			浏览器访问路径:http://localhost:8080/itcast_hello/index.html

Map virtual hosts

	*修改端口号为80
	*host文件中绑定目标网站与127.0.0.1的关系
	*server.xml中添加一个host,name指定为目标网站

Here Insert Picture Description

Introduce an element of server.xml

	Connector像酒店的服务员
	Engine像酒店后厨
	Host像后厨的菜系分区
	Context像大厨,一个上下文表示一个项目

HTTP protocol

	*客户端和服务器双方通信的格式
			请求协议
			响应协议

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

Simple verification code

Here Insert Picture Description

Guess you like

Origin blog.csdn.net/xz58000/article/details/100515763