[Java collection iv] servlet of Java Web Foundation_ Request&&Response

Today, let's review the previous knowledge of servlet's response and response. 1. Request and response technology: the role of RR: request is a request and encapsulates the user's request information If you want to get the request information, just look for request. Response is the response, encapsulating the response information of the server. If you want to write something to the page, Just find the response. RR architecture: request has a service (ServletRequest, servletresponse) abstract method in the servlet, implements the service (ServletRequest, servletresponse) in the httpservlet, and overloads the implementation class org. Of the service (HttpServletRequest, httpservletresponse) request apache. catalina. connector. Implementation class of requestfacade response org apache. catalina. connector. Response facade request system 2, Response (1) function: HTTP response format: response line response header response body (2) brief introduction to API operation response line: format of response line: Protocol / version status code status code description http / 1.1 200 OK common methods: setstatus (int) senderror (int) senderror (int, MSG) operation response header: format of response header: key: name key: name1, Name2 -- separate multiple values with commas. Common methods: setheader (string, string) setintheader (string, int) AddHeader (string, string) setdateheader (string, long) operation response body: the response question is the displayed content getoutputstream() getwriter() (3) detailed API a, Status code: 1XX: request in progress 2XX: request response completed 200: successful completion 3xx: further operation by the browser 302: jump 304: browser to read cache 4xx: user request Error 404: path does not exist 5xx: server error: 500: server error

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>