1Z0-899 · Question #183
Which Java expression can be used to check whether the web container is currently configured to track sessions via URL rewriting?
The correct answer is D. servletContext.getEffectiveSessionTrackingModes() .contains (SessionTrackingMode.URL). String sessionID = null; if (request.getServletContext().getEffectiveSessionTrackingModes() contains(SessionTrackingMode.URL)) { // Get the session ID if there was one sessionID = request.getPathParameter( SessionConfig.getSessionUriParamName( request.getContext())); if…
Question
Options
- AservletContext.getSessionCookiesConfiq() .isHttpOnly()
- BservletContext.getSessionCookiesConfiq() .isSecure()
- CservletContext.getDefaultSessionTrackingModes() .contains(SessionTrackingMode.URL)
- DservletContext.getEffectiveSessionTrackingModes() .contains (SessionTrackingMode.URL)
How the community answered
(44 responses)- A5% (2)
- B2% (1)
- C11% (5)
- D82% (36)
Explanation
String sessionID = null; if (request.getServletContext().getEffectiveSessionTrackingModes() contains(SessionTrackingMode.URL)) { // Get the session ID if there was one sessionID = request.getPathParameter( SessionConfig.getSessionUriParamName( request.getContext())); if (sessionID != null) { request.setRequestedSessionId(sessionID); request.setRequestedSessionURL(true); C: getDefaultSessionTrackingModes java.util.Set<SessionTrackingMode> getDefaultSessionTrackingModes() Gets the session tracking modes that are supported by default for this ServletContext.
Topics
Community Discussion
No community discussion yet for this question.