nerdexam
Oracle

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…

Servlets

Question

Which Java expression can be used to check whether the web container is currently configured to track sessions via URL rewriting?

Options

  • AservletContext.getSessionCookiesConfiq() .isHttpOnly()
  • BservletContext.getSessionCookiesConfiq() .isSecure()
  • CservletContext.getDefaultSessionTrackingModes() .contains(SessionTrackingMode.URL)
  • DservletContext.getEffectiveSessionTrackingModes() .contains (SessionTrackingMode.URL)

How the community answered

(44 responses)
  • A
    5% (2)
  • B
    2% (1)
  • C
    11% (5)
  • D
    82% (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

#session tracking modes#URL rewriting#SessionTrackingMode#effective tracking modes

Community Discussion

No community discussion yet for this question.

Full 1Z0-899 Practice