What happens if the browser does not support cookies but the application uses HttpSession to manage sessions?
4 phương ánCó giải thích
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Đáp án đúng: "The session will still work if the application uses URL rewriting to maintain the session ID". Phiên bên máy chủ chỉ cần định danh phiên đi theo mỗi yêu cầu; mặc định định danh đó nằm trong cookie, nhưng khi trình duyệt không nhận cookie thì ứng dụng có thể gắn nó vào chính địa chỉ bằng response.encodeURL(), container đọc lại từ đường dẫn rồi tìm đúng HttpSession cũ. Lựa chọn "The session will not work" bỏ qua con đường thứ hai này, phiên vẫn hoạt động miễn mọi liên kết đều được mã hoá lại. Lựa chọn "The application will crash as soon as the session is created" không có cơ sở, getSession() vẫn tạo được phiên bình thường, chỉ là lượt sau không nhận ra người dùng nếu định danh không được truyền. Lựa chọn "The session will still work but cannot save state between requests" tự phủ định mình, vì giữ trạng thái qua nhiều yêu cầu đúng là lý do tồn tại của phiên.
Cùng phần 6
How can Session Tracking be done?Có lời giảiCâu hỏiWhat is the most secure way to handle session invalidation during logout?Có lời giảiCâu hỏiAssuming that there is a link logout at the top of the profile.jsp, orderhistory.jsp.
<a href="logoutServlet">Logout</a>
When the client clicks the logout link, the following code in the logoutServlet runs:
HttpSession session = request.getSession();
//TODO
response.sendRedirect("login.jsp");
What is the best code to write in the TODO section to complete the logout function?Có lời giảiCâu hỏiCả 25 câu của chủ đề25 câu
Xuất hiện trong 1 bộ đề
Đi tiếp từ đây