HTTP protocol and Tomcat

Source: Internet
Author: User

1.Http protocol

http: Hypertext Transfer Protocol is one of the most widely used network protocols on the Internet. All WW files are subject to this standard.

The HTTP protocol consists of HTTP requests and HTTP responses, and when a Web site is entered in a browser, your browser encapsulates your request as an HTTP request to the server site, and the server receives a request that organizes the response data into an HTTP response that is returned to the browser. So no request, no response.

2.http Request

  

Post-Submission Grab bag

Request Line

Request Method: Post,get

Requested resource:/demoee/from.html

Protocol version:/http/1.1

1.0, send a request, create a connection, get a Web resource, disconnect the connection

1.1 Send a request, create a connection, get multiple resources, stay connected

Request Header

Is some information that the client sends to the server, using a key-value pair to represent the Key:value

Referer: The browser notifies the server where the current request is coming from, and if it is directly accessible, it will not have this header, commonly used in: anti-theft chain

If-modify-since: Browser Notification server, last change time of local cache, combined with another response header to control cache of browser pages

Cookie: Cookie information used to store the browser cache

User-agent: Browser notification server, client browser and operating system-related information

Connection: Keep the connection status. Close closed in keep-alive connection

Host: The requested server host name

Content-length: The length of the request body

Content-type: If it is a POST request, it will have this header, the default value is Application/x-www-form-urlencoded, which indicates that the request body content uses URL encoding

Accept: The MIME type that the browser can support, and a description of the file type. MIME format: For example: text/html, HTML file; text/css,css file

Accept-encoding: Browser Notification server, data compression format supported by browser

Accept-language: Browser notification server, browser supported language, national languages

Request Body

When the request mode is post, the request realizes the requested parameter

If the request method is get, then the request parameter will not appear in the request body, will be stitched behind the URL address

3.Http response

  

Response Line

Status code

200: Request succeeded

302: Request Redirection

304: Request resource not changed, access local cache

404: The request resource does not exist, usually a user path write error, or the server resource has been deleted

500: Server internal error, usually program throw exception

Response header

The response header is a key-value pair, and the server returns the information to the client in the form of a key-value pair

Location: Specifies the path of the response and needs to be used in conjunction with status Code 302 to complete the jump

Content-type: Type of response Body (MIME type)

Content-disposition: Parsing the body via browser download mode

Set-cookie: Server writes cookies to browser

Content-encoding: Compression format used by the server

Content-length: Length of response body

Refresh: Timed Flush

Server: Refers to the servers name, default value: apache-coyote/1.1.

Last-modified: Server notifies browser, last modified time of file

Response body

The response body is the page body that the server writes back to the client, the browser loads the body into memory, and then parses the render display page content

Structure of the 4.TOMCAT server

  

Bin: Script Directory

Startup script: Startup.bat

Stop script: Shutdown.bat

Conf: Configuration file directory (config/configuration)

Core configuration file: Server.xml

User Rights profile: Tomcat-users.xml

All Web project default profiles: XML

Lib:tomcat and the jar packages required in the Web project

Logs: Log file

localhost access log.*.txt Tomcat records user access information, * indicates time

Temp: Temp file directory, folder contents can be deleted arbitrarily

WebApps: Directories that are stored by publishing Web projects by default

Working directory for WORK:TOMCAT processing JSP

Why 5.tomcat failed to start

If you do not configure the JAVA_HOME environment variable, when you double-click the "Startup.bat" file to run Tomcat, the flash shuts down immediately.

Port conflict

Java.net.BindException:Address already in Use:jvm_bind <null>:8080

Modify Tomcat/conf/server.xml

6.web application directory Structure

HTTP protocol and Tomcat

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.