Day4
Web Development
Protocol Port
HTTP 80
SMTP 25
POP3 110
FTP 23
HTTPS 443
Mapping Method
1.Configure the context element in theserver.xml file
<context path= "/itcast" docbase= "D:\news"/>
Need to restart server
2, new XML file configuration context under Tomcat\conf\catalina\localhost directory elements, etc.;
<context docbase= "D:\news"/>
Change the file name to Root.xml need to restart the server
3,tomcat Auto Map
put the web app (News folder) in the webapps directory
The composition of WEB applications
Configuring a virtual host
Ww.sina.con
1 Configuring Host Context in the server.xml file
2, create a New directory under the C drive sina\mail application
3, C:\Windows\System32\drivers\etc directory hosts file set IP Address
Web resource access process
1, query Windows, get host name relative to IP
2, query DNS, get host name corresponding IP
3, connect the sina server with the IP of the query
4, send http request
5, obtain the host that the client wants to access from the request is the information
6. Get the Web app Thecustomer wants to access from the requested information Center
7. Get the Web Resources The customer wants to access from the requested information Center
8, readthe web Resources under theWeb application under the corresponding host
9, Create an http response with the data that isread to the Web Resource
Server loopback http response
One, the browser receives HTTP to operate, resolves the resource data display
with The reloadable element of the Context element , allowing tomcat to automatically load the updated Web app
Configuring HTTPS connectors
1,keytool-genkey-alias tomcat-keyalg RSA
Get . keystore file
C:\Users\ Huang Xianle >keytool-genkey-alias tomcat-keyalg RSA
Enter KeyStore password :
Enter the new password again :
what is your first and last name ?
[Unknown]: localhost
What is the name of your organizational unit ?
[Unknown]:
What is your organization's name ?
[Unknown]:
What is the name of your city or region ?
[Unknown]:
What is the name of your state/province ?
[Unknown]:
What is the two-letter country/region code for this unit ?
[Unknown]:
Cn=localhost, Ou=unknown, O=unknown, L=unknown, St=unknown, C=unknown right ?
[ no ]: y
Enter the key password for <tomcat>
( if the keystore password is the same, press ENTER ):
C:\Users\ Huang Xianle ;
2, write in server.xml
<connector port= "8443" protocol= "http/1.1" sslenabled= "true"
maxthreads= "Scheme=" "https" secure= "true"
Clientauth= "false" sslprotocol= "TLS" keystorefile= "Conf/.keystore" keystorepass= "123456"/>
3,https://localhost:8443/
Management platform for Tomcat server
Open the following code in conf\tomcat-users.xml and write
<role rolename= "Tomcat"/>
<role rolename= "Role1"/>
<role rolename= "manager"/>
<user username= "Tomcat" password= "Tomcat" roles= "Tomcat, manager"/>
<user username= "Both" password= "Tomcat" roles= "Tomcat,role1"/>
<user username= "Role1" password= "Tomcat" roles= "Role1"/>
http Protocol
http Request
Request Line
Request Header
accept:test/html/image/*
used to tell the server what type of data the client supports
Accept-charset:iso-8859-1
used to tell the server that the encoding used by the client
Accept-encoding:gzip,compress
used to tell the server that the client supports the data compression format
Accept-language:en-us,zh-cn
The language environment of the client
Host:www.it315.org:80
The client uses this header to tell the server that the host name you want to access
if-modified-since:tue,11 Jul 18:23:51 GMT
The client tells the server through this header that the cache time of the resource
referer:http://www.it315.org/index.jsp
The client tells the server through this header which resource is accessing the server (anti-theft chain)
user-agent:moailla/4.0 (compatible; MSIE 5.5; Windows NT5.0)
The client uses this header to tell the server that the client's software environment
Cookies
This header allows the client to bring data to the server
Connection:close/keep-alive
The client shuts down or keeps the connection through this header request
data:tue,11 Jul 18:23:51 GMT
Current time
http Response
Status Line
Response Header
Location:http://www.it325.org/index.jsp
This header is used with the 302 status code to tell the customer who to look for
Sever:apache Tomcat
The server passes this header and tells the browser the type of the server
Contend-encoding:gzip
Server through this header, tell the browser data compression format
Contend-length:80
The server passes this header and tells the browser the length of the loopback data
Contend-language:zh-cn
contend-type:text/html; charset=gb2312
The server passes this header, telling the browser to echo the length of the data
last-modified:tue,11 Jul 18:23:51 GMT
The server passes this header and tells the browser the current cache time of the resource
refresh:1;url=http://www.it315.org
The server passes this header and tells the browser how long it takes to refresh
Contend-disposition:attachment;filename=aaa.zip
The server passes this header and tells the browser to open the data by following the download method
Thansfer-encoding:chunked
The server passes this header and tells the browser the data transfer format
Set-cookie:ss=qq=5lb_nq;path=/search
etag:w/"7777-124223490400"
Cache-Related headers
Expires:-1
The server passes this header and tells the browser how long to cache the loopback resource, 1 or 0, and the test does not cache
Cache-control:no-cache
Pragma:no-cache
Server through the above two headers, control the browser do not cache data
Connection:close/keep-alive
data:tue,11 Jul 18:23:51 GMT
http utility header
Web Study Day Fourth