Cyber Monday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

GIAC Exam GSNA Topic 5 Question 50 Discussion

Actual exam question for GIAC's GSNA exam
Question #: 50
Topic #: 5
[All GSNA Questions]

You work as a Software Developer for UcTech Inc. You want to create a new session. Which of the following methods can you use to accomplish the task?

Each correct answer represents a complete solution. Choose all that apply.

Show Suggested Answer Hide Answer
Suggested Answer: C, D

The getSession() method of the HttpServletRequest interface returns the current session associated with the request, or creates a new

session if no session exists. The method has two syntaxes as follows:

public HttpSession getSession(): This method creates a new session if it does not exist.

public HttpSession getSession(boolean create): This method becomes similar to the above method if create is true, and returns the

current session if create is false. It returns null if no session exists.

Answer B is incorrect. The getSession(false) method returns a pre-existing session. It returns null if the

client has no session

associated with it.

Answer A and E are incorrect. There is no such method as getNewSession() in Java.


Contribute your Thoughts:

Isadora
5 months ago
I think C) getSession() is the simplest and most straightforward method to use for creating a new session.
upvoted 0 times
...
Aaron
5 months ago
But wouldn't E) getNewSession() also work for creating a new session?
upvoted 0 times
...
Beckie
5 months ago
I believe D) getSession(true) is also a valid method to create a new session.
upvoted 0 times
...
Aaron
5 months ago
I think A) getNewSession(true) is the correct method to create a new session.
upvoted 0 times
...
Fannie
5 months ago
This looks straightforward. The answer is clearly A, E, and maybe D if you want to specify a parameter. B and C seem like they're just getting an existing session, not creating a new one.
upvoted 0 times
...
Isreal
6 months ago
I think the correct answer is A and E. getNewSession(true) and getNewSession() both create a new session, while the others either get an existing session or create a session with a specific parameter.
upvoted 0 times
Phillip
5 months ago
I think you're right, A and E are the methods to create a new session.
upvoted 0 times
...
Fausto
5 months ago
I agree with you, A and E are the correct answers.
upvoted 0 times
...
...

Save Cancel