Java Web knowledge point Summary 1. Java Web knowledge point summary

Source: Internet
Author: User

Java Web knowledge point Summary 1. Java Web knowledge point summary

Java Web knowledge point Summary 1

Common status codes and their meanings

Some common HTTP status codes are:

200 -- the server returns the webpage successfully

400 -- the server does not understand the request syntax

404 -- the requested webpage does not exist

503 -- service unavailable

Common HTTP Status Codes

1xx(Temporary response ):Status Code indicating a temporary response and requiring the requester to continue the operation.

HttpStatus Code100(CONTINUE) the requester shall continue to make the request. The server returns this code, indicating that the first part of the request has been received and is waiting for the remaining part.

HttpStatus Code101(Switching protocol) the requester has requested the server switching protocol, and the server has confirmed and is ready to switch.

2xx(Successful ):Indicates that the request status code is successfully processed.

HttpStatus Code200(Successful) the server has successfully processed the request. Generally, this indicates that the server provides the requested webpage.
HttpStatus Code201(Created) The request is successful and the server creates a new resource.
HttpStatus Code202(Accepted) the server has accepted the request but has not yet processed it.
HttpStatus Code203(Unauthorized information) the server has successfully processed the request, but the returned information may come from another source.
HttpStatus Code204(NO content) The server successfully processes the request, but does not return any content.
HttpStatus Code205(Reset content) The server successfully processes the request, but does not return any content.
HttpStatus Code206(Partial content) The server successfully processes some GET requests.

3xx(Redirection ):Indicates that further operations are required to complete the request. These status codes are usually used for redirection.
HttpStatus Code300(Multiple options) for requests, the server can perform multiple operations. The server selects an operation based on the user agent or provides an operation list for the user agent to select.
HttpStatus Code301The requested webpage has been permanently moved to a new location. When the server returns this response (response to a GET or HEAD request), it automatically redirects the requester to a new location.
HttpStatus Code302(Temporary mobile) The server currently responds to requests from different locations, but the requester should continue to use the original location for subsequent requests.
HttpStatus Code303(View other locations) when the requester uses a separate GET request for different locations to retrieve the response, the server returns this code.
HttpStatus Code304(Not modified) the requested webpage has not been modified since the last request. When the server returns this response, no webpage content is returned.
HttpStatus Code305(Using proxy) the requester can only use the proxy to access the requested webpage. If the server returns this response, it also indicates that the requester should use a proxy.
HttpStatus Code307(Temporary redirection) The server currently responds to requests from different locations, but the requester should continue to use the original location for subsequent requests.

4xx(Request error ):These status codes indicate that the request may fail and impede server processing.

Http status code 400The server does not understand the request syntax.
HttpStatus Code401(Unauthorized) requests require authentication. The server may return this response for webpages that require logon.
HttpStatus Code403(Forbidden) The server rejects the request.
HttpStatus Code404(Not found) The server cannot find the requested webpage.
HttpStatus Code405(Method disabled) disable the method specified in the request.
HttpStatus Code406(Not accepted) the requested webpage cannot be responded using the Content features of the request.
HttpStatus Code407(Proxy authorization is required) this status code is similar to 401 (unauthorized), but the specified requester should authorize the use of proxy.
HttpStatus Code408(Request timeout) timeout occurs when the server waits for a request.
HttpStatus Code409(Conflict) a conflict occurs when the server completes the request. The server must contain conflict information in the response.
HttpStatus Code410(Deleted) If the requested resource has been permanently deleted, the server returns this response.
HttpStatus Code411(Valid length required) the server does not accept requests that do not contain valid Content Length header fields.
HttpStatus Code412(Not meeting the prerequisites) the server does not meet one of the prerequisites set by the requester in the request.
HttpStatus Code413(The request entity is too large) The server cannot process the request because the request entity is too large to exceed the server's processing capability.
HttpStatus Code414(The requested URI is too long) The request URI (usually the URL) is too long and cannot be processed by the server.
HttpStatus Code415(Unsupported media type) The request format is not supported by the request page.
HttpStatus Code416(The request range does not meet the requirements) if the page cannot provide the request range, the server returns this status code.
HttpStatus Code417(Not meeting expectations) the server does not meet the "expectation" request header field requirements.

5xx(Server error ):These status codes indicate an internal error occurred when the server attempted to process the request. These errors may be server errors rather than request errors.

HttpStatus Code500(Internal server error) The server encounters an error and cannot complete the request.
HttpStatus Code501(Not implemented yet) the server does not have the function to complete the request. For example, this Code may be returned when the server cannot identify the request method.
HttpStatus Code502(Error gateway) the server, as a gateway or proxy, receives an invalid response from the upstream server.
HttpStatus Code503(Service unavailable) the server is currently unavailable (due to overload or downtime maintenance ). Generally, this is only a temporary status.

HttpStatus Code504(Gateway timeout) The server acts as a gateway or proxy, but does not receive a request from the upstream server in time.
HttpStatus Code505(The HTTP version is not supported) the server does not support the HTTP protocol version used in the request.

Request Protocol format

User_agent Information

User_agent is part of the HTTP protocol and is part of the header domain. user_agent is also called UA. In general, it is an identifier that provides information such as the browser type, operating system and version, CPU type, browser rendering engine, browser language, and browser plug-in when you access a website. The UA string is sent to the server each time the browser sends an HTTP request.

The standard format of the browser UA string is: browser identifier (operating system identifier; encryption level identifier; browser language ).

What are the common request headers and Response Headers in http and their functions?

Request Header:
Accept: text/html, image/* (type that the browser can receive)
Accept-Charset: ISO-8859-1 (encoding type that the browser can receive)
Accept-Encoding: gzip, compress (the browser can Accept the compression Encoding type)
Accept-Language: en-us, zh-cn (Language and country type that the browser can receive)
Host: www.it315.org: 80 (Host and port requested by the browser)
If-Modified-Since: Mon, 6 Jul 2015 18:23:51 GMT (Cache Time of a page)
Referer: http://www.it315.org/index.jsp (page from which the request comes)
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) (Browser Information)
Cookie: (the browser saves the information sent by the server)
Connection: close (1.0)/Keep-Alive (1.1) (HTTP request version features)
Date: Mon, 6 Jul 2015 18:23:51 GMT (time requested for the website)

Response Header:
Location: http://www.it315.org/index.jsp (control which page the browser displays)
Server: apache tomcat (Server type)
Content-Encoding: gzip (compression Encoding method sent by the server)
Content-Length: 80 (the Length of the bytecode that the server sends)
Content-Language: zh-cn (the Language and country name of the Content sent by the server)
Content-Type: image/jpeg; charset = UTF-8 (Type and encoding Type of the Content sent by the server)
Last-Modified: Mon, 6 Jul 2015 18:23:51 GMT (Last modification time of the server)
Refresh: 1; url = http://www.it315.org (control the page to which the URL points after 1 second)
Content-Disposition: attachment; filename=aaa.jpg (the server controls the browser to open the file by sending and downloading)
Transfer-Encoding: chunked (the server transmits data to the client in blocks)
Set-Cookie: SS = Q0 = 5Lb_nQ; path =/search (the server sends Cookie-related information)
Expires:-1 (the server controls that the browser does not cache webpages. The default value is cache)
Cache-Control: no-cache (the Server Control browser does not Cache webpages)
Pragma: no-cache (the Server Control browser does not cache webpages)
Connection: close/Keep-Alive (HTTP request version features)
Date: Mon, 6 Jul 2015 18:23:51 GMT (Response Time)

What is the default port number of the Tomcat server? How to modify tomcat Port

The default port of the Tomcat server is 8080; \ conf \ server under tomcat. <Connector port = "8080" in the Connector element in xml...> change 8080 to the port you want.

What is cookie? What is the function of cookie?

Cookie is a short text message that is transmitted between the Web server and the browser as user requests and pages. Each time a user accesses a site, the Web application can read the information contained in the Cookie.

Cookie provides a useful method for Web applications to save user-related information. For example, when a user accesses your site, you can use cookies to save user preferences or other information, so that when the user visits your site next time, the application can retrieve previously saved information.

Differences between dynamic and static include in JSP

Dynamic include is implemented using the jsp: include action. <jsp: include page = "embedded ded. jsp "flush =" true "/> always checks for changes in the contained files. It is suitable for inclusion of dynamic pages and can contain parameters;

Static include is implemented using the include pseudo code. <% @ include file = "included.htm" %> does not check the changes in the contained files. It is applicable to include static pages.

Briefly describe the difference between POST and GET in a form

GET Method

Resource Type: active or passive

Data Type: Text

Data volume: up to 255 characters. Although HTTP does not limit the length of the query string, Some browsers and web servers may not be able to process data that exceeds 255 characters.

Visibility: data is a part of a URL, which is visible to the user in the URL address bar of the browser.

Cache: data can be cached in the URL history of the browser.

POST method

Target Resource Type: Active

Data Type: text or binary data

Data volume: no limit.

Visibility: data is sent as the request message body instead of a part of the URL. Therefore, the data is invisible to the user in the URL address bar of the browser.

Cache: data cannot be cached in the URL history of the browser.

JSP Execution Process

First, the client browser sends a Request to the Web server to access the JSP page, and then the JSP Engine is responsible for converting the JSP into a Servlet. The generated servlet is compiled to generate a class file, then load the class file to the memory for execution. Finally, the Web server sends the result (Response) to the client browser.

Compared with JSP, what are the advantages and disadvantages of Servlet?

Advantages: Responding to client requests, dynamic response based on requests, the biggest advantage is to act as a service, control program flow direction, filtering, etc. In mvc, control is servlet.

Disadvantage: Servlet logically expresses views, which is much more troublesome than JSP. JSP is better when the display is complete and the page is generated.

 

Related Article

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.