Javaweb Knowledge Point Summary One

Source: Internet
Author: User
Tags apache tomcat

Javaweb Knowledge Point Summary One

Common status codes and their meanings

Some common HTTP status codes are:

--Server successfully returned to Web page

The server does not understand the syntax of the request

404 --The requested page does not exist

503 --Service not available

Common HTTP status Code Daquan

1xx (Temporary response): A status code that represents a temporary response and requires the requestor to continue the operation.

http Status Code The request shall continue to be made by the requesting person (continued). The server returns this code to indicate that the first part of the request was received and is waiting for the remainder.

http Status Code 101(switching protocol) The requestor has asked the server to switch protocols and the server has confirmed and is ready to switch.

2xx (Success): indicates the status code of the request was successfully processed.

http Status code + (Success) The server has successfully processed the request. Typically, this indicates that the server provided the requested Web page.
http Status code 201 The (created) request succeeded and the server created a new resource.
http Status code 202 The (accepted) server has accepted the request but has not yet processed it.
http status code 203 The (non-authoritative information) server has successfully processed the request, but the information returned may be from another source.
http status code 204 The (no content) server successfully processed the request, but did not return any content.
http status code 205 The (reset content) server successfully processed the request, but did not return any content.
http Status code 206 The (partial) server successfully processed a partial GET request.

3xx (redirected): indicates that further action is required to complete the request. Typically, these status codes are used for redirection.
http status code (multiple options) for requests, the server can perform a variety of operations. The server can select an action based on the requestor (user agent) or provide a list of actions for the requestor to select.
http status code 301(permanently moved) The requested page has been permanently moved to a new location. When the server returns this response (a response to a GET or HEAD request), the requestor is automatically forwarded to the new location.
http status code 302(temporary move) The server is currently responding to requests from different locations, but the requestor should continue to use the original location for future requests.
http Status code 303(View other locations) The server returns this code when the requestor should use a separate GET request for the different locations to retrieve the response.
http status code 304(not modified) The requested webpage has not been modified since the last request. When the server returns this response, the Web page content is not returned.
http status code 305(use proxy) the requestor can only use the proxy to access the requested Web page. If the server returns this response, it also indicates that the requestor should use the proxy.
http status code 307(Temporary redirect) The server is currently responding to a request from a Web page in a different location, but the requestor should continue to use the original location for future requests.

4xx(Request error): These status codes indicate a possible error in the request and hinder the processing of the server.

HTTP status Code (Error request) The server does not understand the syntax of the request.
http status code 401(Unauthorized) Request authentication is required. The server may return this response for pages that need to log on.
http status code 403(Forbidden) The server rejects the request.
http status code 404(not found) The requested Web page was not found by the server.
http status code 405(method Disabled) Disables the method specified in the request.
The http status code 406(not accepted) cannot use the requested content attribute to respond to the requested Web page.
http status code 407(requires proxy authorization) This status is similar to 401 (unauthorized), but specifies that the requestor should authorize the use of the proxy.
http status code 408(Request timed out) A timeout occurred while the server was waiting for a request.
http status code 409(conflict) The server has a conflict while completing the request. The server must include information about the conflict in the response.
http status code 410(deleted) If the requested resource has been permanently deleted, the server returns this response.
http status code 411(requires valid length) The server does not accept requests that do not contain a valid Content-Length header field.
http Status code 412(precondition not met) the server did not meet one of the prerequisites set by the requestor in the request.
http status code 413(Request entity is too large) the server cannot process the request because the request entity is too large to exceed the processing power of the server.
http status code 414(The requested URI is too long) The requested URI (usually a URL) is too long for the server to process.
http status code 415(Unsupported media type) The requested format is not supported by the requested page.
http status code 416(Request scope not compliant) if the page cannot provide the requested scope, the server returns this status code.
http status code 417(unmet expectations) the server did not meet the requirements for the "expected" Request header field.

5xx(server error): These status codes indicate that the server has an internal error while trying to process the request. These errors may be the error of the server itself, not the request.

http Status Code (Server internal error) the server encountered an error and could not complete the request.
http Status Code 501(not yet implemented) the server does not have the capability to complete the request. For example, this code may be returned when the server does not recognize the request method.
http Status Code The 502(Error Gateway) server receives an invalid response from the upstream server as a gateway or proxy.
http Status Code 503(Service Unavailable) server is not currently available (due to overloading or downtime maintenance). Typically, this is only a temporary state.

http Status Code The 504(Gateway Timeout) server acts as a gateway or proxy, but does not receive requests from the upstream server in a timely manner.
http Status Code 505(HTTP version not supported) the HTTP protocol version used in the request is not supported by the server.

Format of the Request protocol

    1. Request method URI Protocol/version
    2. Request Header: Contains a number of useful information about the client environment and the request body. For example, the request header can declare the language used by the browser, the length of the request body, and so on.
    3. Request body: There is a blank line between the request header and the request body, which is very important, it indicates that the request header has ended, and then the request body.

Information contained in User_agent

User_agent is part of the HTTP protocol and is part of the header domain, and user_agent is also referred to as UA. In more general terms, it is an identification of the type of browser you use, the operating system and version, the CPU type, the browser rendering engine, the browser language, the browser plugin, and so on when you visit the site. The UA string is sent to the server each time the browser HTTP request occurs.

The standard format of the browser UA string is: Browser identification (operating system identity; encryption level identification; browser language) rendering engine identity version information

What are the common request headers and response headers in HTTP, and their role

Request Header:
accept:text/html,image/* (types that the browser can receive)
accept-charset:iso-8859-1 (the type of encoding the browser can receive)
Accept-encoding:gzip,compress (The browser can receive the compression encoding type)
ACCEPT-LANGUAGE:EN-US,ZH-CN (language and country type that the browser can receive)
host:www.it315.org:80 (browser-requested host and Port)
If-modified-since:mon, 6 Jul 18:23:51 GMT (one page cache time)
referer:http://www.it315.org/index.jsp (which page the request came from)
user-agent:mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) (browser-related information)
Cookies: (Information sent by the browser staging server)
Connection:close (1.0)/keep-alive (1.1) (features of the HTTP request version)
Date: Mon, 6 Jul 18:23:51 GMT(time to request a website)

Response Header:
location:http://www.it315.org/index.jsp (control which page the browser displays)
Server:apache Tomcat (type of server)
Content-encoding:gzip (compressed encoding method sent by the server)
content-length:80 (the server sends the displayed byte code length)
CONTENT-LANGUAGE:ZH-CN (language and country name of the server sending content)
content-type:image/jpeg; charset=utf-8 (Type and encoding type of content sent by the server)
last-modified: Mon, 6 Jul 18:23:51 GMT(the time the server was last modified)
refresh:1;url=http://www.it315.org (Control browser 1 seconds after the forwarding URL points to the page)
content-disposition:attachment; filename=aaa.jpg (server control browser send download open file)
transfer-encoding:chunked (server chunked pass data to client)
set-cookie:ss=q0=5lb_nq; Path=/search (server sends Cookie-related information)
Expires: 1 (server control browser do not cache Web pages, default is cache)
cache-control:no-cache (server control browser do not cache Web pages)
pragma:no-cache (server control browser do not cache Web pages)
Connection:close/keep-alive (features of the HTTP request version)
Date: Mon, 6 Jul 18:23:51 GMT(response site time)

What is the default port for the Tomcat server? How to modify Tomcat ports

The default port for the Tomcat server is 8080, and the <connector port= "8080" in the Connector element in \conf\server.xml under Tomcat changes the 8080 to the port you want.

What is a cookie? What is the role of cookies?

A Cookie is a small piece of textual information that accompanies a user request and the page is passed between the WEB server and the browser. Each time a user accesses a site, the WEB application can read the information contained in the Cookie.

Cookies provide a useful way for a WEB application 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 the application can retrieve previously saved information the next time the user accesses your site.

A brief description of the difference between dynamic include and static include in JSP

Dynamic include is implemented with Jsp:include action, <jsp:include page= "included.jsp" flush= "true"/> It always checks for changes in the included files, is suitable for containing dynamic pages, and can take parameters ;

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

Brief description of the difference between post and get in the form

Get method

Resource type: Active or passive

Data type: Text

Amount of data: up to 255 characters. Although the HTTP protocol does not limit the length of the query string, some browsers and Web servers may not be able to handle data that is longer than 255 characters.

Visibility: The data is part of the URL and is visible to the user in the browser's URL address bar.

Caching: Data can be cached in the browser's URL history.

Post method

Target Resource type: Active

Data type: text or binary data

Data volume: No limit.

Visibility: The data is not part of the URL but is sent as the message body of the request, so it is not visible to the user in the browser's URL address bar.

Caching: Data cannot be cached in the browser's URL history.

The execution process of short-name JSP

First, the client browser presents 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 resulting servlet is compiled to generate the class file, and then the class file is loaded into memory execution. Finally, the Web server will execute the result (Response) to the client browser.

What are the advantages of servlets compared to JSPs, and what are the drawbacks?

Advantages: Responding to the client's request, according to the request dynamic response, the greatest advantage as a service, control program flow, filtering and so on. In MVC, control is the servlet.

Disadvantage: The servlet has too much trouble representing the view's representation logically relative to the JSP, and the JSP is better at displaying the work done and generating the page.

Javaweb Knowledge Point Summary One

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.