HTTP one, protocol
The two sides in the interaction, communication, the time to follow a specification, a rule.
Second, the HTTP protocol
The full name of HTTP is: Hypertext Transfer Protocol (Hypertext Transfer Protocol), a specification that is followed by the client and server side of the network when executing the HTTP protocol. In fact, the client is required to access the server when the need to send something, the server response to the client when the need to return something.
Iii. the difference between HTTP1.0 and HTTP1.1
In the HTTP1.0 protocol, after a client has established a connection with a Web server, only one Web resource can be obtained.
After the HTTP1.1 protocol allows a client to establish a connection with a Web server, multiple Web resources can be obtained on a single connection.
Iv. HTTP Requests
The requested data contains three parts: a request line, a request header, and a request body.
Request Lines : The request is: Post,, OPTIONS, DELETE, TRACE, PUT, commonly used are: GET, POST
The difference between get and post:
Request Header :
Accept:application/x-ms-application, Image/jpeg, Application/xaml+xml, Image/gif, Image/pjpeg, application/x-ms-x BAP, */* referer:http://localhost:8080/examples/servlets/servlet/requestparamexample ACCEPT-LANGUAGE:ZH-CN user-agent:mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; trident/4.0; SLCC2;. NET CLR 2.0.50727;. NET CLR 3.5.30729;. NET CLR 3.0.30729; Media Center PC 6.0;. net4.0c;. net4.0e) content-type:application/x-www-form-urlencoded Accept-encoding:gzip, deflate Host:localho st:8080 content-length:31 connection:keep-alive Cache-control:no-cache---------------------------- -------------------------------------------------Accept: The client indicates to the server what type of data I can support. Referer: True requested address path, full path Accept-language: Support language format user-agent: User agent indicates to the server that the current client information is being visited. Content-type: The submitted data type. The data accept-encoding:gzip of the form form urlencoding encoded, deflate: compression algorithm. Host: Hosting Address Content-length: Data length connection:keep-alive stay connected Cache-control: operation on Cache
Request body : HTML code
V. HTTP response
The requested data contains three parts: Response line, response header, response body.
* Response Line http/1.1-OK Protocol version Status code (JS explained in detail, here are only a few common) 200: Success, normal processing, get data. 403 : For Bidden deny 404:not Found 500: Server Exception * Response header server : What type of server is it? Tomcat Content-type: Server returned to client your content type content-length: Data length returned date : Date of communication, time of response
Download and install TOMCAT1. Download Tomcat
Website address: http://tomcat.apache.org/whichversion.html
2. Install Tomcat
1. Unzip directly, then find Bin/startup.bat
2. can be installed
After startup, if you can see the black window properly, it indicates that the installation was successful. In order to ensure foolproof, it is best to enter in the address bar of the browser: http://localhost:8080, if you see the content indicates success.
3. If you double-click on the Startup.bat and see a flash of the situation, it is generally the JDK environment variable is not configured.
3.Tomcat Catalog
Bin
> contains some jar, bat files. Startup.bat
Conf
Tomcat configuration Server.xml Web. xml
Lib
The jar files required for Tomcat to run
Logs
Log files that are running
Temp
Temporary files
WebApps
The items that are published to the Tomcat server are stored in this directory.
Work (no tube at the moment)
JSP translated into a class file storage place
4. Publish a Web project using Tomcat
requirements: How to get other computers to access the resources on my computer. aa.html
Browser address bar notation: localhost: Native address/project name/folder name/file name
copy this file to Webapps/root and access it in the browser:
Http://localhost:8080/stu.xml
Access using IP address:
http://192.168.5.437:8080/aa.html
Directory structure for 5.WEB applications
Use Myecplise to configure your own Tomcat
Step one, get the server running environment configuration, Window/preferences/server/runtime Environmen (each version of the location of different, looking for themselves)
Step two, click Add to select your own version of the Tomcat download, click Next
Step three, select your own Tomcat home folder click Finish
Step four, see if your Tomcat appears in the server
Step five, test your tomcat.
Step six, configure your own JSP project in Tomcat (how to create a Web project later)
Javaweb Learning (i)----HTTP and Tomcat installation and use