tailieunhanh - Core Servlets and JavaServer Pages phần 3

Tham khảo tài liệu 'core servlets and javaserver pages phần 3', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Prentice Hall and Sun Microsystems. Personal use only do not redistribute. Chapter 4 Handling the Client Request HTTP Request Headers Authorization This header is used by clients to identify themselves when accessing password-protected Web pages. See Section Restricting Access to Web Pages for an example. Cache-Control This header can be used by the client to specify a number of options for how pages should be cached by proxy servers. The request header is usually ignored by servlets but the Cache-Control response header can be valuable to indicate that a page is constantly changing and shouldn t be cached. See Chapter 7 Generating the Server Response HTTP Response Headers for details. Connection This header tells whether or not the client can handle persistent HTTP connections. These let the client or other browser retrieve multiple files . an HTML file and several associated images with a single socket connection saving the overhead of negotiating several independent connections. With an HTTP request persistent connections are the default and the client must specify a value of close for this header to use old-style connections. In HTTP a value of keep-alive means that persistent connections should be used. Each HTTP request results in a new invocation of a servlet regardless of whether the request is a separate connection. That is the server invokes the servlet only after the server has already read the HTTP request. This means that servlets need help from the server to handle persistent connections. Consequently the servlet s job is just to make it possible for the server to use persistent connections which is done by sending a Content-Length response header. Section Using Persistent HTTP Connections has a detailed example. Content-Length This header is only applicable to POST requests and gives the size of the POST data in bytes. Rather than calling Content-Length you can simply use request .getContentLength . However .

TỪ KHÓA LIÊN QUAN