Page: 9
Unit- 4: Session Management
Q 23. A web application uses the HttpSession mechanism to determine if a user is "logged in." When a user supplies a valid user name and password, an HttpSession is created for that user.The user has access to the application for only 15 minutes after logging in. The code must determine how long the user has been logged in, and if this time is greater than 15 minutes, must destroy the HttpSession. Which method in HttpSession is used to accomplish this? A. getCreationTime B. invalidateAfter C. getLastAccessedTime D. getMaxInactiveInterval Answer: A Q 24. Which method must be used to encode a URL passed as an argument to HttpServletResponse.sendRedirect when using URL rewriting for session tracking? A. ServletResponse.encodeURL B. HttpServletResponse.encodeURL C. ServletResponse.encodeRedirectURL D. HttpServletResponse.encodeRedirectURL Answer: D Q25.Which interface must a session attribute implement if it needs to be notified when a web container persists a session? A. javax.servlet.http.HttpSessionListener B. javax.servlet.http.HttpSessionBindingListener C. javax.servlet.http.HttpSessionAttributeListener D. javax.servlet.http.HttpSessionActivationListener Answer: D
Page: 9
1
2
3
4
5
6
7
8
9
10
|