Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session object #67

Closed
FunnyDevs opened this issue Jan 21, 2017 · 3 comments
Closed

Session object #67

FunnyDevs opened this issue Jan 21, 2017 · 3 comments

Comments

@FunnyDevs
Copy link

I have tried to access Session object (even adding SessionHandler.create), but is always null. How is possibile???

@aesteve
Copy link
Owner

aesteve commented Jan 24, 2017

Can you show me some code of yours ?

This should work, there's even a unit test checking that when you access the session objet from within a controller method it should not be null.

See : https://github.com/aesteve/nubes/blob/master/src/test/java/integration/session/SessionSpec.java
relying on https://github.com/aesteve/nubes/blob/master/src/test/java/mock/controllers/session/SessionAwareController.java

@FunnyDevs
Copy link
Author

I used routingContext.session() to get session, and it returned null value.
But if i use
(RoutingContext routingContext,Session session)
as method sign, session is not null (even if i call it with routingContext.session() inside method)

Thank you

@aesteve
Copy link
Owner

aesteve commented Jan 25, 2017

Ah OK I see.

Yes, if you declare the session in your method, Nubes automatically adds the SessionHandler to your route, so that Session will never be null.

I'm very interested in every remark you could have in the future, please do not hesitate to open issues just to tell me what you'd like as improvements, and what you're thinking about the framework overall.

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

No branches or pull requests

2 participants