Home » Oracle » 1z0-899 » Which Java expression can be used to check whether the web container is currently configured to track sessions via URL rewriting?
Which Java expression can be used to check whether the web container is currently configured to track sessions via URL rewriting?
A. servletContext.getSessionCookiesConfiq() .isHttpOnly()
B. servletContext.getSessionCookiesConfiq() .isSecure()
C. servletContext.getDefaultSessionTrackingModes() .contains(SessionTrackingMode.URL)
D. servletContext.getEffectiveSessionTrackingModes() .contains (SessionTrackingMode.URL)
Correct Answer: D
Explanation/Reference:
Code example:
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.
Download Printable PDF. VALID exam to help you PASS.
|
|