2018-09-01http Response +http Request Encapsulation +http response Encapsulation + server deployment steps +dynamicweb Project Creation

Source: Internet
Author: User
Tags stop script apache tomcat

HTTP protocol:

HTTP, Hypertext Transfer Protocol (hypertext Transfer Protocol) is the most widely used network protocol on the Internet! All WWW files must adhere to this standard, the original purpose of design HTTP is to provide a way to publish and receive HTML pages!


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 to a server site, and the server receives a request that organizes the response data into an HTTP response that is returned to the browser. That is, there is no response without a request!

1; Request Line

Request Method: Post,get

Requested resource:/demoee/form.html

Protocol version: http/1.1

http/1.0: Send a request, create a connection, get a Web resource, disconnect the connection!

http/1.1: Send a request, create a connection, get multiple Web resources, stay connected!

2. Request Header

The request header is some information that the client sends to the server, using a key-value pair to represent the Key:value

Common Request Headers

Description (Red master, other understanding)

Referer

The browser notifies the server where the current request is coming from. If it is direct access, there will be no such header. Commonly used: anti-theft chain

If-modified-since

The browser notifies the server of the last change time of the local cache. Controls the caching of browser pages with a combination of another response header.

Cookies

Session-related techniques for storing cookie information cached by the browser.

User-agent

Browser notification server, client browser and operating system related information

Connection

Keep the connection state. Keep-alive connection, Close is closed

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 types that the browser can support. A description of the file type.

MIME format: Large type/small type [; parameter]

For example:

text/html, HTML file

TEXT/CSS,CSS file

Text/javascript,js file

image/*, all picture files

Accept-encoding

The browser notifies the server that the browser supports the data compression format. such as: gzip compression

Accept-language

The browser notifies the server that the browser supports the language. Languages of the World (international i18n)

1. The Request body

When the request mode is post, the request realizes the requested parameter, in the following format:

Username=zhangsan&password=123

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

1; Response Line

HTTP protocol

Status code:

200: The request is successful!

302: Request REDIRECT!

304: The request resource has not changed to access the local cache (common in repeated refreshes)!

404: The request resource does not exist! This is usually a user path write error, or the server resource has been deleted (common in path problems)!

500: Server internal error, usually program throw exception!

Status information: status information is changed according to the status code changes!

1; Response header: The response is also a key-value pair form, the server side of the information in the form of key-value pairs returned to the client!

Common Request Headers

Describe

Location

Specifies the path of the response, which needs to be used in conjunction with status Code 302 to complete the jump.

Content-type

Type of response body (MIME type)

Value: Text/html;charset=utf-8

Content-disposition

Parse the body by browser download method

Value: Attachment;filename=xx.zip

Set-cookie

Session-related technologies. Server writes cookies to browser

Content-encoding

Compression format used by the server

Value: gzip

Content-length

Length of response body

Refresh

Timed refresh, Format: number of seconds; url= path. The URL can be omitted, and the default value is the current page.

Value: 3;url=www.orcale.cn//Three seconds Refresh page to www.orcale.cn

Server

Refers to the server name, default value: apache-coyote/1.1. Modifications can be made through the Conf/server.xml configuration. <connector port= "8080" ... server= "Orcale"/>

Last-modified

The server notifies the browser of the last modified time of the file. Used in conjunction with If-modified-since.

2; 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 rendering to display the contents of the page!

Common concepts in Web development:

Brower/server: Browser + Server System (website)

Client/server: Client + Server System (QQ, League of Legends)

Web resources:

① the resources that exist in the Web application server for outside access are Web resources such as HTML,CSS,JS, pictures, videos, etc. that exist inside the Web application server ... )

1 static resources: refers to the Web page for people to browse the data is always the same (such as: In the Web application server inside the Html,css,js, pictures, videos, etc...) )!

2; dynamic resources: Refers to the Web page for people to browse the data is generated by the program, different times to access the Web page to see the content of the various (such as: jsp/servlet,asp,php)!


Javaweb Domain: Dynamic resources think to generate html! dynamically through Java code


Web servers commonly used in Web development:

①weblogic:oracle Company's large-scale Web server, support all Java EE specifications!

②WEBSPHERE:IBM Company's large fee Web server supports all Java EE specifications!

③tomcat:apache Open source free small and medium Web application Server support servlet and JSP specification in Java EE!


Bin: Script Directory!

Startup script: Startup.bat

Stop script: Shutdown.bat

CONF: Configuration file directory (config/configuration), which has a Web. xml file, when the custom Web. xml file cannot find the appropriate resource, it will find the Web. xml File!

Core configuration file: Server.xml

User Rights profile: Tomcat-users.xml

All Web project default profiles: XML

Lib: Dependent libraries, Tomcat, and jar packages needed in Web projects

Logs: Log file.

Localhost_access_log.*.txt Tomcat: Record user access information, Star * represents time!

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

WebApps: The directory where Web projects are published by default!

Work:tomcat working directory for JSP Processing!

The Web-inf directory is protected and cannot be accessed by the outside world!

Eclipse binds Tomcat and uses:

① get the server run environment configuration:

Eclipse-->window-->preferences-->runtime Environment-->add

① add Server, select the Tomcat version (here 7.0):

Click next!

① Select the Tomcat installation directory (the parent directory of the Bin folder):

Click finish!

① Setup Complete:

① setting up the Tomcat publishing location:

Tick the second use TomCat, and then in the Deploy path position, remove the Wtpwebapps before the WTP three letters!

Here if start the Tomcat server will be in the pop-up window error, prompting failed to start!

After ① redeploy Tomcat, the server starts the failed solution:

Romove the original Apache TomCat and add the library back to the tomcat!

To create a javaweb engineering step:

Create a new Project-->dynamic Web project--> fill out the project name-->target Runtime tick Server program (here Tomcat) and tick the Dynamic Web Component version to 2.5-- >finish!

The rest of the details are in tomorrow's notes!

2018-09-01http Response +http Request Encapsulation +http response Encapsulation + server deployment steps +dynamicweb Project Creation

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.