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 45 Discussion

Actual exam question for GIAC's GSNA exam
Question #: 45
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:

Tuyet
6 months ago
So maybe A, C, D, and E? This question is definitely testing our understanding.
upvoted 0 times
...
Hyman
6 months ago
You’re right. B doesn't seem to fit for creating a new session.
upvoted 0 times
...
Pamella
6 months ago
I'm not sure about B. getSession(false) seems more like retrieving an existing session.
upvoted 0 times
...
Maryanne
6 months ago
I'm going with E as well. getNewSession() sounds logical for creating a new session.
upvoted 0 times
...
Tuyet
7 months ago
Yeah, but what about C? getSession() looks like it might work too.
upvoted 0 times
...
Hyman
7 months ago
This question is tricky. I think A and D could be right.
upvoted 0 times
...

Save Cancel