Skip to content

Request->hasSession() fix#130

Closed
schmittjoh wants to merge 1 commit intofabpot:masterfrom
schmittjoh:requestGetSessionFix
Closed

Request->hasSession() fix#130
schmittjoh wants to merge 1 commit intofabpot:masterfrom
schmittjoh:requestGetSessionFix

Conversation

@schmittjoh
Copy link
Copy Markdown

This affects you if you do not have setup a session configuration yourself (thus no session implementation gets injected into the request), but you do call Request->getSession() from somewhere (e.g. your controller). Then a session with default values will be created.

Upon next request a call to ->hasSession() will return false if it is made before you again access the session from somewhere. This is incorrect since the session actually exists. Stateless requests are still possible and not affected by this.

While this commit fixes the problem, I think it would be cleaner if the decision - whether a session exists or not - was delegated to the concrete session / storage implementation. However, then we would always need an instance of the session which requires some more changes to the existing code to still support stateless requests.

@fabpot
Copy link
Copy Markdown
Owner

fabpot commented Nov 9, 2010

This commit 7b02766 should fix this problem as the session is now initialized if not already provided before we check if a session exists (have a look at the changes to RequestListener.)

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants