nerdexam
GIAC

GSSP-JAVA · Question #91

Which of the following syntaxes can be used to retrieve a URL to a resource specified as WEBINF/example/sessionObject.txt? Note. Assume that session is an instance of the HttpSession interface…

The correct answer is E. context.getResource ("/WEB-INF/example/sessionObject.txt"). See the full explanation below for the reasoning.

Question

Which of the following syntaxes can be used to retrieve a URL to a resource specified as WEBINF/example/sessionObject.txt? Note. Assume that session is an instance of the HttpSession interface, request is an instance of the HttpServletRequest interface, and context is an instance of the ServletContext interface.

Options

  • Acontext.getResource ("/example/sessionObject.txt")
  • Bsession.getResource ("/WEB-INF/example/sessionObject.txt")
  • Crequest.getResource ("/WEB-INF/example/sessionObject.txt")
  • Dcontext.getResource ("WEB-INF/example/sessionObject.txt")
  • Econtext.getResource ("/WEB-INF/example/sessionObject.txt")
  • Frequest.getResource ("WEB-INF/example/sessionObject.txt")

How the community answered

(35 responses)
  • B
    6% (2)
  • D
    9% (3)
  • E
    83% (29)
  • F
    3% (1)

Community Discussion

No community discussion yet for this question.

Full GSSP-JAVA Practice