Which of the following does not belong to HttpServletResponse interface to complete the function?
-
A:设置HTTP头标
-
B:设置cookie
-
C:读取路径信息
-
D:输出返回数据
Answer: C
A: Setup HTTP header
1 |
|
B: Set cookie
1 2 |
|
C (Error): read path information, request information read path
1 2 3 4 5 |
|
D: return data output
1 |
|
HttpServletResponse in the Servlet, when the server responds to a request of the client, necessary to use HttpServletResponse interface. Type of response may be used provided the setContentType () method. Transmitting character data to use the getWriter () returns an object. The table below is a common method of HttpServletResponse interfaces. Interface HttpServletResponse common methods described addCookie (Cookie cookie) specified Cookie added to the current response addHeader (String name, String value) of the specified name and value is added to the header of the response containsHeader (String name) Returns a Boolean value, it is determined whether a header of the response is provided encodeURL (String url) encoding the specified URL sendError (int sc) send an error to the client sendRedirect (String location) sending a provisional response to the client using the specified status code setDateHeader ( setStatus header names and values set in response to a head setHeader (String name, String value) String name, long date) will be given names and dates will be set forth in response to (int sc) in response to the current setting state code setContentType (String ContentType)