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 1 Question 52 Discussion

Actual exam question for GIAC's GSNA exam
Question #: 52
Topic #: 1
[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:

Afton
4 months ago
Ah, session management. The bane of every developer's existence. Can I get a virtual high-five for that one?
upvoted 0 times
Ronny
3 months ago
D) getSession(true)
upvoted 0 times
...
Karol
3 months ago
C) getSession()
upvoted 0 times
...
Mozelle
3 months ago
E) getNewSession()
upvoted 0 times
...
Lisandra
3 months ago
A) getNewSession(true)
upvoted 0 times
...
...
Sol
4 months ago
C and E, definitely. Although, I heard getNewSession(true) is the new hotness. Maybe I'll give that a try.
upvoted 0 times
Mireya
3 months ago
I haven't tried getNewSession(true) yet, but I'll give it a shot.
upvoted 0 times
...
Nakita
3 months ago
I think C and E are the most reliable methods for creating sessions.
upvoted 0 times
...
William
3 months ago
I prefer using getNewSession(true) for creating sessions.
upvoted 0 times
...
Buffy
4 months ago
I always use C and E for creating new sessions.
upvoted 0 times
...
...
Irene
4 months ago
I agree with Wei. 'getSession' without any parameters might just retriIrene an existing session, so A and E seem like the right choices for creating a new session.
upvoted 0 times
...
Wei
4 months ago
I think A and E are correct because 'getNewSession' implies creating a new session, and having 'true' as a parameter might indicate some specific settings for the session.
upvoted 0 times
...
Jamey
5 months ago
Hmm, I'm gonna go with B and D. Might as well cover all the bases, just in case.
upvoted 0 times
...
Jennifer
5 months ago
I'm not sure about this question. Can someone explain their rationale for choosing certain options?
upvoted 0 times
...
Caren
5 months ago
D and E seem like the obvious choices here. Why complicate things, right?
upvoted 0 times
Estrella
3 months ago
Definitely, keeping it simple with D and E is the way to go.
upvoted 0 times
...
Dawne
3 months ago
I agree, D and E are the best options.
upvoted 0 times
...
Vincenza
3 months ago
E) getNewSession()
upvoted 0 times
...
Shelba
3 months ago
D) getSession(true)
upvoted 0 times
...
Felice
3 months ago
C) getSession()
upvoted 0 times
...
Vernice
3 months ago
B) getSession(false)
upvoted 0 times
...
Viola
4 months ago
A) getNewSession(true)
upvoted 0 times
...
Stephen
4 months ago
I would go with D and E as well. Keep it simple.
upvoted 0 times
...
Roselle
4 months ago
Yeah, I agree. Those options seem straightforward.
upvoted 0 times
...
Eleni
4 months ago
I think D and E are the right choices.
upvoted 0 times
...
...
Stevie
5 months ago
I believe C and D are the correct methods to create a new session.
upvoted 0 times
...
Royce
5 months ago
I think the correct answers are C and E. Gotta love those classic session methods!
upvoted 0 times
Sherita
4 months ago
Yes, those are the methods you can use to create a new session.
upvoted 0 times
...
Mireya
5 months ago
I agree, C and E are the correct answers.
upvoted 0 times
...
...
Alfreda
5 months ago
I think A and E are correct options.
upvoted 0 times
...

Save Cancel